Skip to main content

No project description provided

Project description

DinoBytes

dinobytes

DinoBytes is a dynamic serialization framework designed to simplify network communication by providing a robust set of tools for serializing and deserializing messages using the MessagePack format. With its easy-to-use decorator and base class, DinoBytes makes defining and handling network messages both efficient and intuitive, suitable for applications ranging from simple messaging systems to complex distributed architectures.

Features

  • Automatic Message Type Registration: Utilizes a decorator to automatically register message types and assign unique identifiers, ensuring a smooth serialization and deserialization process.
  • Simplified Serialization: Offers a straightforward method (to_bytes) for converting message objects into serialized bytes.
  • Effortless Deserialization: Allows for easy conversion of bytes back into message objects using the from_bytes method, facilitating quick and reliable message parsing.
  • Streamlined Message Definition: Leverages Python's dataclass decorator within the custom cerealbox decorator to reduce boilerplate and enhance readability when defining new message types.
  • Message Registry: Automatically maintains a registry of message types, simplifying the process of managing different kinds of network messages within your application.

Installation

Install DinoBytes using pip:

pip install dinobytes

Quick Start

Defining a Message

from dinobytes import cerealbox

@cerealbox
class MyMessage:
    content: str

Serializing a Message

message = MyMessage(content="Hello, DinoBytes!")
serialized_message = message.to_bytes() # or bytes(message)

Deserializing a Message

received_message = MyMessage.from_bytes(serialized_message)
print(received_message.content)  # Output: Hello, DinoBytes!

The consume convenience method can also be used to automatically unpack into the correct type:

from dinobytes import consume

received_message = consume(serialized_message)
print(received_message.content)  # Output: Hello, DinoBytes!

Contributing

Contributions to DinoBytes are welcome! Whether it's bug reports, feature requests, or code contributions, please feel free to reach out or submit a pull request. For major changes, please open an issue first to discuss what you would like to change.

License

DinoBytes is released under the Apache 2 License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dinobytes-0.2.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dinobytes-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file dinobytes-0.2.0.tar.gz.

File metadata

  • Download URL: dinobytes-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.3 Darwin/23.2.0

File hashes

Hashes for dinobytes-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4e6b534f36cfdab93b6417b831710b1ef9d52555f2b133486321c3a436edbdce
MD5 f671b941d598df7873acfdf1925b21d5
BLAKE2b-256 bc2f39aaf64c57438c3e588505d81dfb5c292c2477de0108848c2033f9587977

See more details on using hashes here.

File details

Details for the file dinobytes-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dinobytes-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.3 Darwin/23.2.0

File hashes

Hashes for dinobytes-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c832ec92eda8ddb8e374d3c3bf5805577074044b05483609d25430d9a0fc4c93
MD5 551658958d8232ee9b78bb0eb8282dc1
BLAKE2b-256 181cea486980e3bc008be090a74eda3bf336f04c90c49047de15b637a1ed3f1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page