Your data stays a valid
msgpack/cborblob. We just tack on a table of contents so you can jump straight to the piece you need β instead of decoding the whole file.
msgpack and cbor are compact and fast β until your file hits a few hundred MB and you only need one value buried
inside.
Vanilla decoding forces you to read and decode everything, every time. That is wasteful after cold storage, it blows up memory, and it makes small reads feel huge.
msglc appends a tiny table of contents to the payload, like a ZIP central directory.
On open, only that index is read.
The value you actually want is located and decoded directly β nothing more.
- β‘ Lazy & partial β pull one node from a multi-GB file.
- π§© Still valid
msgpack/cborβ drop the index and any compliant decoder reads it. - π¦ Rust backend β serialize at near-vanilla speed, or stream custom containers.
- 𧬠Merge archives β combine files into one blob without decoding and re-encoding.
- π Every filesystem β local,
UPath,fsspec, and S3.
from msglc import dump
from msglc.reader import LazyReader
dump("data.msg", {"a": [1, 2, 3], "b": {"c": 4, "d": 5, "e": [0x221548313] * 10}})
with LazyReader("data.msg") as reader:
print(reader["b/c"]) # 4 β only this node is decoded
print(reader.read("b/d")) # 5
print(list(reader.keys())) # ['a', 'b']pip install msglcSnap on some extras for extra speed / features:
pip install "msglc[msgspec]" # faster msgpack decoding
pip install "msglc[numpy]" # numpy.ndarray support
pip install "msglc[s3fs]" # S3 support
pip install "msglc[all]" # everything aboveEverything the README leaves out lives in the docs β cleanly split by concern:
| Page | What you'll find |
|---|---|
| Guide | Serialization, deserialization, combining, streaming & custom codecs |
| Internals | Why it's fast β the binary layout & TOC design |
| Configuration | Every tunable option, its default & performance tips |
| Storage | Local files, UPath, fsspec & S3 |
| API reference | The generated reference |
β¨ In one line:
msglc=msgpack/cbor+ a table of contents.
A working Rust toolchain is required. Install it via the official guide, then:
pip install -e ".[all]"Not all optional dependencies are universally available β some are unavailable on platforms other than CPython.