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 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
Built Distributions
File details
Details for the file cbors-0.1.4.tar.gz
.
File metadata
- Download URL: cbors-0.1.4.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5060b26e97e51d2f9754017b300da72d7ccb1bd6064ba3b8ee10797d8dea33c8 |
|
MD5 | 1efbaba311ecefe852610144ddec1618 |
|
BLAKE2b-256 | 1a5e9f8bf97ac3815baf846f65527b86b1f9aeb13f192091ade359a759eadc48 |
File details
Details for the file cbors-0.1.4-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: cbors-0.1.4-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 181.2 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e31108e7c8c09ffc2ea880e430b18185031bfc517ed19b9e06d836b896975c26 |
|
MD5 | ffb66ead462c5d2deb65c164681ac66b |
|
BLAKE2b-256 | 285b813e1bbc7787b7c33fb8f87c64896bc166fb1931f410018aa758a28d77c8 |
File details
Details for the file cbors-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: cbors-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 181.2 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84a38687a755e01e5300588fd3c52d76715184d488f5dd36e08491d1f71e0980 |
|
MD5 | 1958046ef9f23e7971e147d574a1f1ce |
|
BLAKE2b-256 | aa491b7c64acc2829bbf790a88f8fe16ce814d11befa2cece36136d8ce0a89bf |
File details
Details for the file cbors-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: cbors-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 181.5 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bc7239b1a88e8cc49898dba16f7b0b29a7289fe401e770a04d1df971ca9d1f8 |
|
MD5 | 107b703b7fcb66b11270aba410d45c96 |
|
BLAKE2b-256 | 17d873369559c8826ba1dc36eec0db699e43b1cb2facc29b857086c979a839bf |
File details
Details for the file cbors-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: cbors-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 182.1 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03f8b56ce2b488ac18717104d68b72b2782d0b2fe33848a4df4b1e457f03cd3 |
|
MD5 | 921d3c7dadf93ec68583a4223a343d32 |
|
BLAKE2b-256 | bdb1e30a7251fdeaa60a1e965acc80c45b3afc273f0120a59056aae71234d116 |