Skip to main content

A Python CBOR (de)serialization module, powered by Rust

Project description

cbo-rs

Build Status codecov PyPI

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 maturin to build a wheel from repository root.

maturin 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 maturin 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 Distribution

cbors-0.1.3.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distributions

cbors-0.1.3-cp38-cp38-manylinux1_x86_64.whl (181.3 kB view hashes)

Uploaded CPython 3.8

cbors-0.1.3-cp37-cp37m-manylinux1_x86_64.whl (181.3 kB view hashes)

Uploaded CPython 3.7m

cbors-0.1.3-cp36-cp36m-manylinux1_x86_64.whl (181.4 kB view hashes)

Uploaded CPython 3.6m

cbors-0.1.3-cp35-cp35m-manylinux1_x86_64.whl (182.1 kB view hashes)

Uploaded CPython 3.5m

Supported by

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