u-msgpack-python is a lightweight MessagePack serializer and deserializer module written entirely in pure Python. It is compatible with both Python 2 and 3, as well as CPython and PyPy implementations, and fully complies with the latest MessagePack specification, including support for binary, UTF-8 string, application-defined ext, and timestamp types. The current version is 2.8.0, with releases occurring a few times per year to maintain compliance and add features.
Install & Compatibility
Where this runs
tested against v2.8.0 · 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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.002s · 17.9MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.001s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The package name on PyPI is `u-msgpack-python`, but the module to import is `umsgpack`.
import umsgpack
This quickstart demonstrates how to pack Python objects into MessagePack bytes and unpack them. It also shows an example of streaming serialization and deserialization using file-like objects for multiple MessagePack objects.
import umsgpack
data = {"name": "Alice", "age": 30, "is_student": False}
# Serialize a Python object to MessagePack bytes
packed_data = umsgpack.packb(data)
print(f"Packed data: {packed_data}")
# Deserialize MessagePack bytes back to a Python object
unpacked_data = umsgpack.unpackb(packed_data)
print(f"Unpacked data: {unpacked_data}")
# Example with streaming to/from a file-like object
from io import BytesIO
f = BytesIO()
umsgpack.pack({"compact": True, "schema": 0}, f)
umsgpack.pack([1, 2, 3], f)
f.seek(0)
# Unpack multiple objects from the stream
obj1 = umsgpack.unpack(f)
obj2 = umsgpack.unpack(f)
print(f"Object 1 from stream: {obj1}")
print(f"Object 2 from stream: {obj2}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.