A Python CBOR (de)serialization module, powered by Rust
Project description
cbo-rs
A Python CBOR (de)serialization module, powered by Rust.
Wraps the excellent serde_cbor crate and provides a pythonic interface via pyo3.
Installation
Python>=3.5 is required due to the requirements of pyo3.
Recommended to install from PyPI, e.g.
pip install cbors
To install from source, use pyo3-pack to build a wheel from repository root.
pyo3-pack build -i python3
pip install target/wheels/*.whl
Usage
Serialize data via cbors.dumpb
, deserialize via cbors.loadb
.
Interface is similar to the standard library's json
module.
import cbors
b = cbors.dumpb("foo")
assert(b == b"cfoo")
s = cbors.loadb(b)
assert(s = "foo")
Limitations
As this uses serde_cbor
under the hood, the same limitations apply here.
Notably, tags are not currently supported (see pyfisch/cbor#3).
If this functionality is important to you, cbor2 might be a better choice.
Development
For local development, it is recommended to create a virtual environment, and build the module via pyo3-pack develop
.
A Dockerfile is provided which will build and install the module and run the test suite.
If you do not want to use docker, it is recommended to use tox
for testing.
Pull requests welcome!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for cbors-0.1.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1680a3bb47b46e444178afe088332de4e327c3ded418ea4eca041102a130e094 |
|
MD5 | 549feb80a606fd5038c03440f553bf5e |
|
BLAKE2b-256 | bd6db09eee4fed368191292a45204c473b4a26c3cd361dc69dbcae3295b5a8e9 |
Hashes for cbors-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 767aaaef699bf83f6a9396fd63582feaf3077e925ba6273263fc1c527d57fe3c |
|
MD5 | 66bcf1c792539729da925af39261867e |
|
BLAKE2b-256 | e426eb5c7a31fb83f078ba3d811e30593449f67e684fa01c03ae84f4e4dd1676 |
Hashes for cbors-0.1.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f32ec27a0b3e00105db7970bdbf12d8259cde9361ff785da7a61df492bac3ba |
|
MD5 | c3daab2cae7915c212051c10fd23fd8c |
|
BLAKE2b-256 | 4393f7ccfadcbda1d80c0d8f47c258ab624c26a294cc8678bcf452e7d2b52de4 |