Metadata-Version: 2.1
Name: cmsgpack
Version: 0.1.3
Summary: Fast MessagePack serializer for Python
License: Copyright 2025 Sven Boertjens
         
         Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project-URL: Homepage, https://github.com/svenboertjens/cmsgpack
Requires-Python: <3.15,>=3.12
Description-Content-Type: text/markdown

# `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](USAGE.md) for the complete documentation.

### Installation

`cmsgpack` can be installed using **pip**:

```shell
pip install cmsgpack
```


### Basic Serialization

To serialize data, use `cmsgpack.encode` and `cmsgpack.decode`:

```python
cmsgpack.encode(obj: any) -> bytes
cmsgpack.decode(encoded: bytes) -> any
```

An example of how these functions can be used:

```python
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](USAGE.md#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](https://github.com/svenboertjens/cmsgpack/issues).


## License

This library is licensed under the MIT license. See [LICENSE](LICENSE).

