Skip to main content

A lightweight binary protocol serialization library like ProtoDef but in Python.

Project description

PyProtoDef

PyProtoDef is a Python package for defining and handling binary protocols, inspired by ProtoDef.

Features

✅ Compact binary serialization
✅ Faster parsing than JSON
✅ Strong data typing (int, float, string)
✅ Ideal for networking, gaming, and IoT

Installation

pip install pyprotodef

## Usage Example

To try out PyProtoDef, create a new file (for example, example.py) with the following content:

```python
from pyprotodef import ProtoDef

# Define a schema
schema = {
    "name": "player_data",
    "fields": [
        {"name": "id", "type": "int"},
        {"name": "score", "type": "float"},
        {"name": "nickname", "type": "string"}
    ]
}

# Create a ProtoDef instance
proto = ProtoDef(schema)

# Serialize data
data = {"id": 123, "score": 99.5, "nickname": "PlayerOne"}
binary_data = proto.serialize(data)

# Deserialize data
parsed_data = proto.deserialize(binary_data)

print("Serialized:", binary_data)
print("Deserialized:", parsed_data)

Then, run the example with:

python example.py

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

pyprotodef-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

pyprotodef-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pyprotodef-0.1.0.tar.gz.

File metadata

  • Download URL: pyprotodef-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pyprotodef-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7479da43b24b495575e4dbcfd3dac95ccdb18f34068dc691eb0a6f71d211e745
MD5 9929fa8ec71afc871c5c3ed2d608c96a
BLAKE2b-256 2171cb91844ef6a838f4ed2b0d72a61a6d0cb0b93c547315b58008be52a26d5f

See more details on using hashes here.

File details

Details for the file pyprotodef-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyprotodef-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pyprotodef-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6fc9aedf28103bc83d49161f70de5ea76d14cb9d656e6a4cf4830889dd1618a9
MD5 d3420d7d758030343f822fc56e6cf0bf
BLAKE2b-256 6f97a38eb7554a20c7f154ce5080e6d772200a01ecc4aec6685cb8667087ab8b

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