chumicro-msgpack¶
Cross-runtime MessagePack serialization for CircuitPython, MicroPython, and CPython.
Encodes Python objects to compact binary bytes and decodes them back. On CircuitPython boards with the native msgpack C module, all functions delegate to the built-in — the pure-Python encoder is never loaded, saving ~700 bytes of heap RAM.
Quick example¶
from chumicro_msgpack import packb, unpackb
settings = {0: "MyNetwork", 1: "secret", 2: True}
data = packb(settings) # compact binary bytes
print(len(data)) # much smaller than JSON
restored = unpackb(data)
print(restored) # {0: 'MyNetwork', 1: 'secret', 2: True}
Documentation¶
- User Guide — getting started, usage patterns, size comparison
- API Reference — full API documentation