Fast MessagePack serializer for Python
Project description
cmsgpack
Introduction
cmsgpack is an optimized MessagePack implementation for Python, offering high performance and a developer-friendly API.
But why use cmsgpack, and not the default msgpack? Well, cmsgpack...
- is optimized for high-performance serialization and uses heuristics-based allocation to avoid reallocations and memory waste where possible;
- supports native, chunked file streaming for efficient large file operations;
- provides unique features that make the API more intuitive and flexible.
If you're looking for something specific, see these:
- :rocket: Quick Start: For a quick look on how to use
cmsgpack, see the Quick Start. - :wrench: API & Usage: For details on
cmsgpack's API and how to use it, see USAGE. - :watch: Benchmarks: For benchmark comparisons, see BENCHMARK.
- :information_source: Compatibility: For compatibility details, see Compatibility
Quick Start
This section gives a basic example of how to install and use cmsgpack. See USAGE for the complete documentation.
Installation
cmsgpack can be installed using pip:
pip install cmsgpack
Basic Serialization
To serialize data, use cmsgpack.encode and cmsgpack.decode:
cmsgpack.encode(obj: any) -> bytes
cmsgpack.decode(encoded: bytes) -> any
An example of how these functions can be used:
import cmsgpack
# Any value we want to encode
obj = "Hello, world!"
# Encode it using `cmsgpack.encode`:
encoded = cmsgpack.encode(obj)
# `encoded` now holds our encoded data as bytes
# Decode it again using `cmsgpack.decode`:
decoded = cmsgpack.decode(encoded)
# `decoded` now holds the original value, `obj`
assert obj == decoded # True
If you are unsure if a type is supported, check the supported types to see if it's mentioned there, or what to do otherwise.
Compatibility
- Compilers: Supports all compilers compatible with C11. When building from source, ensure a compliant compiler is used.
- Endianness: Supports both big-endian and little-endian systems. Endianness is determined at compile-time; runtime changes are not supported.
- Word size: Tested on 64-bit systems; 32-bit systems are expected to work but are not officially tested.
- Multi-Threading: Internal thread safety is ensured for no-GIL Python builds. All class objects (
Stream,FileStream, andExtemsions) must not be used concurrently across threads.
Questions & Feedback
Have a question, issue, or idea? Feel free to open an issue or email me.
License
This library is licensed under the MIT license. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmsgpack-0.1.2.tar.gz.
File metadata
- Download URL: cmsgpack-0.1.2.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f5e3dbd79a114c48817fd25a25c45de3bbec6fd31f1300200e296d668046db5
|
|
| MD5 |
96ed02eea288e0bf05d37ee1ee7fa4f2
|
|
| BLAKE2b-256 |
58e2631f452909668867f11438d4fff868b7017f77ab7d106cca8077fe344aff
|
File details
Details for the file cmsgpack-0.1.2-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cmsgpack-0.1.2-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 31.0 kB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ef43513e1a6a30e4d0581e62bf1e98bc3bf85ebbc60cbf14c8afd0392b22bd
|
|
| MD5 |
1537bc7fe41bcbe1fe7e04cdc097e654
|
|
| BLAKE2b-256 |
7488c121c2d5568dcad727504c4d6202f7b83c47a21b8a0d946e83025b9313d2
|
File details
Details for the file cmsgpack-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: cmsgpack-0.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c13383e37b58fbd487604c2a518af3712ab60e653ec7b697c72c3241fb7a93f9
|
|
| MD5 |
5a4367a64124a66fa22040a60d38c892
|
|
| BLAKE2b-256 |
9bfd5944f40fd5769a36e286b4eaf19f05f49a3a9537a69b194bfa6503ef0f02
|
File details
Details for the file cmsgpack-0.1.2-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: cmsgpack-0.1.2-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 31.0 kB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b797d13c5a74ebeec318cd488f06ca3d8b88c72e90905b73e2c75ed106f4390
|
|
| MD5 |
2f21fcac678c4ac9991f30ac1ab2ec99
|
|
| BLAKE2b-256 |
c8a45c4e39b2c8f3d28001f5677bcdfb6692e9a5273ad3598f1f509cd4336540
|
File details
Details for the file cmsgpack-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: cmsgpack-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 30.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88707c5dccb4a394bb5d9f2cd615020fa9d9905b37305867452581cecc7497a
|
|
| MD5 |
52086d831d0f21affad89153c8a12ffd
|
|
| BLAKE2b-256 |
4241a4fd40e5b0783c8fba7def8b3c7605fc9c5b8da68d9c346f602a659bcd72
|