Giter Site home page Giter Site logo

cbors's Introduction

cbo-rs

CI 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!

cbors's People

Contributors

mjkoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

moreati griels

cbors's Issues

pip install can't find cbors

> pip3 install cbors
ERROR: Could not find a version that satisfies the requirement cbors (from versions: none)
ERROR: No matching distribution found for cbors

Implement tags

Support for this landed upstream, we should be able to support this and remove the caveat from the readme

Is nightly necessary?

Hi,

Considering cbors for a project I'm working on, and curious if it actually needs nightly at this point? PyO3 at least works with stable Rust these days.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.