GithubHelp home page GithubHelp logo

griels / cbors Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mjkoo/cbors

0.0 1.0 0.0 33 KB

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

License: MIT License

Rust 59.89% Python 40.11%

cbors's Introduction

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!

cbors's People

Contributors

mjkoo avatar

Watchers

 avatar

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.