Skip to main content

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.

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, and Extemsions) must not be used concurrently across threads.

Questions & Feedback

Have a question, issue, or idea? Feel free to open an issue.

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

cmsgpack-0.1.3.tar.gz (33.1 kB view details)

Uploaded Source

File details

Details for the file cmsgpack-0.1.3.tar.gz.

File metadata

  • Download URL: cmsgpack-0.1.3.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for cmsgpack-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ccb77201ec6b630cd2ec9cae88fd5541370666dc8029825ade2f6ad2e2606c47
MD5 72b1658d0ddd547d01ee03952c213723
BLAKE2b-256 9a78f0587c830eff3cfb2dba52e579b2e774feac84e02feab562d4c4ed4a5d8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page