MessagePack for Python
MessagePack is a fast and compact binary serialization format. The Python implementation, msgpack-python, is actively maintained with the latest release being version 1.1.2. It supports Python versions 3.9 and above, with a release cadence of approximately every few months.
Warnings
- breaking Python 3.8 support dropped in version 1.1.2
- gotcha Ensure Python version is >=3.9 to install msgpack
Install
-
pip install msgpack
Imports
- packb
from msgpack import packb
Quickstart
import msgpack
# Data to be serialized
data = {'key': 'value', 'number': 42}
# Serialize data
packed = msgpack.packb(data)
# Deserialize data
unpacked = msgpack.unpackb(packed)
print(unpacked)