protobug
A pythonic protobuf library using dataclasses and enums
Usage
First, define a protobug.message. It is similar to a dataclass,
except it uses protobug.field and protobug types:
import protobug
@protobug.message
class Message:
a: protobug.String | None = protobug.field(1, default=None)
b: list[protobug.String] = protobug.field(2, default_factory=list)
c: dict[protobug.UInt32, protobug.String] = protobug.field(3, default_factory=dict)
After defining the model, you can freely decode and encode messages.
protobug's API follows the familiar load/loads & dump/dumps convention:
>>> payload = b"\x0a\x0bhello world"
>>> protobug.loads(payload, Message)
Message(a='hello world', b=[], c={})
>>> payload = b"\x12\x05hello\x12\x05world"
>>> protobug.loads(payload, Message)
Message(a=None, b=['hello', 'world'], c={})
>>> payload = b"\x1a\x09\x08\x00\x12\x05val 0\x1a\x09\x08\x01\x12\x05val 1"
>>> protobug.loads(payload, Message)
Message(a=None, b=[], c={0: 'val 0', 1: 'val 1'})
>>> data = Message(a='val a', b=['val b'], c={0: 'val c'})
>>> protobug.dumps(data)
b'\n\x05val a\x12\x05val b\x1a\t\x08\x00\x12\x05val c'
License
protobug is distributed under the terms of the Unlicense license.
Metadata
Release files for protobug 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| protobug-1.0.0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| protobug-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / protobug-1.0.0.tar.gz
| Download URL | protobug-1.0.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6ea277e83e1a468b1c75a928fbba97e0cb10743df5558e8f326170984364fbb
|
|
BLAKE2b-256 checksum How to use checksums |
fdf73174903b46402b4bd8a2cce57d7b363dedde93ebcdbaf63a5a630d22fe3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency logRelease files / protobug-1.0.0-py3-none-any.whl
| Download URL | protobug-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b1b5cb3f4b2dd4fa0a6219ca770f687d0af32606d344ac7acedf00943f220c3
|
|
BLAKE2b-256 checksum How to use checksums |
44bb02eccbae7de82571c9ca8ef0cca6d07dfd2cca2c1d7053cd0864f688af55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency log