Registry / serialization / bbpb
library1.4.2pypypi✓ verified 80d ago

Library for encoding and decoding protobuf messages without needing a .proto type definition. It infers the schema automatically and supports repeated fields, enums, and nested messages. Current version 1.4.2, supports Python 3.8+, released irregularly.

pip install bbpb
INSTALL
IMPORT
SIG · BBPB
B
bbpb
serializationpythonv1.4.2
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

encode_message
from blackboxprotobuf import encode_message
from bbpb import encode_message
decode_message
from blackboxprotobuf import decode_message
protobuf_to_json
from blackboxprotobuf import protobuf_to_json

Decode and encode protobuf binary data without a .proto file. The library infers a type definition (typedef) that can be reused for encoding.

from bbpb import decode_message, encode_message # Example protobuf raw bytes (from a known message) raw_bytes = b'\x08\x96\x01' # field 1, varint 150 # Decode to a plain data structure decoded = decode_message(raw_bytes) print(decoded) # {'data': {1: 150}, 'typedef': {'1': {'type': 'uint'}}} # Modify and re-encode encoded = encode_message({'data': {1: 200}}, decoded['typedef']) print(encoded.hex()) # 08c801
Debug
Known issues
breakingVersion 1.4.0 changed the return format of decode_message: it now returns a dict with 'data' and 'typedef' keys, not a tuple. Old code expecting a tuple will break.
fix
Update code to handle dict: result = decode_message(blob); data = result['data']; typedef = result['typedef']
affects: >=1.4.0
gotchaThe library does not support all protobuf features (e.g. groups, maps, oneofs). It may misinterpret or skip unsupported wire types silently.
fix
Test against known messages; verify round-trip encoding/decoding. For complex schemas, consider using actual .proto files.
affects: all
deprecatedThe function 'decode_message_with_type' is deprecated since v1.3.0 and removed in v1.4.0. Use decode_message instead.
fix
Replace decode_message_with_type(blob, typedef) with decode_message(blob, typedef). Note the return format change.
affects: >=1.4.0
gotchaField numbers are treated as keys in the data dict; they are integers, not strings. Attempting to access by string will fail.
fix
Use integer keys: data[1] not data['1']. The typedef dict uses string keys for field numbers.
affects: all
Upgrade
Version history
1.4.2latest on PyPI · released Mar 14, 2025
Audit
Dependencies
protobufrequiredUsed for serialization/deserialization of wire format
Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
1
Resources
bbpb — pip install bbpb · libregistry