dag-cbor


Namedag-cbor JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/hashberg-io/dag-cbor
SummaryPython implementation of the DAG-CBOR codec.
upload_time2023-12-18 22:32:32
maintainer
docs_urlNone
authorhashberg
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            dag-cbor: A Python implementation of the `DAG-CBOR codec <https://ipld.io/specs/codecs/dag-cbor/spec/>`_
========================================================================================================

.. image:: https://img.shields.io/badge/python-3.7+-green.svg
    :target: https://docs.python.org/3.7/
    :alt: Python versions

.. image:: https://img.shields.io/pypi/v/dag-cbor.svg
    :target: https://pypi.python.org/pypi/dag-cbor/
    :alt: PyPI version

.. image:: https://img.shields.io/pypi/status/dag-cbor.svg
    :target: https://pypi.python.org/pypi/dag-cbor/
    :alt: PyPI status

.. image:: http://www.mypy-lang.org/static/mypy_badge.svg
    :target: https://github.com/python/mypy
    :alt: Checked with Mypy
    
.. image:: https://readthedocs.org/projects/dag-cbor/badge/?version=latest
    :target: https://dag-cbor.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://github.com/hashberg-io/dag-cbor/actions/workflows/python-pytest.yml/badge.svg
    :target: https://github.com/hashberg-io/dag-cbor/actions/workflows/python-pytest.yml
    :alt: Python package status

.. image:: https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square
    :target: https://github.com/RichardLitt/standard-readme
    :alt: standard-readme compliant


This is a fully compliant Python implementation of the `DAG-CBOR codec <https://ipld.io/specs/codecs/dag-cbor/spec/>`_, a subset of the `Concise Binary Object Representation (CBOR) <https://cbor.io/>`_ supporting the `IPLD Data Model <https://ipld.io/docs/data-model/>`_ and enforcing a unique (strict) encoded representation of items.


.. contents::


Install
-------

You can install the latest release from `PyPI <https://pypi.org/project/dag-cbor/>`_ as follows:

.. code-block:: console

    $ pip install --upgrade dag-cbor


Usage
-----

We suggest you import DAG-CBOR as follows:

>>> import dag_cbor

Below are some basic usage examples, to get you started: for detailed documentation, see https://dag-cbor.readthedocs.io/


Encoding and decoding
^^^^^^^^^^^^^^^^^^^^^

>>> dag_cbor.encode({'a': 12, 'b': 'hello!'})
b'\xa2aa\x0cabfhello!'
>>> dag_cbor.decode(b'\xa2aa\x0cabfhello!')
{'a': 12, 'b': 'hello!'}


Random DAG-CBOR data
^^^^^^^^^^^^^^^^^^^^

>>> import pprint # pretty-printing
>>> custom_opts = dict(min_codepoint=0x41, max_codepoint=0x5a, include_cid=False)
>>> with dag_cbor.random.options(**custom_opts):
...     for d in dag_cbor.random.rand_dict(3):
...             pprint.pp(d)
...
{'BIQPMZ': b'\x85\x1f\x07/\xcc\x00\xfc\xaa',
 'EJEYDTZI': {},
 'PLSG': {'G': 'JFG',
          'HZE': -61.278,
          'JWDRKRGZ': b'-',
          'OCCKQPDJ': True,
          'SJOCTZMK': False},
 'PRDLN': 39.129,
 'TUGRP': None,
 'WZTEJDXC': -69.933}
{'GHAXI': 39.12,
 'PVUWZLC': 4.523,
 'TDPSU': 'TVCADUGT',
 'ZHGVSNSI': [-57, 9, -78.312]}
{'': 11, 'B': True, 'FWD': {}, 'GXZBVAR': 'BTDWMGI', 'TDICHC': 87}



API
---

For the full API documentation, see https://dag-cbor.readthedocs.io/


Contributing
------------

Please see `<CONTRIBUTING.md>`_.


License
-------

`MIT © Hashberg Ltd. <LICENSE>`_

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hashberg-io/dag-cbor",
    "name": "dag-cbor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "hashberg",
    "author_email": "sg495@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/28/18/b318561a2cb51bfb80664394c507bad6bf9f77fa9e5e7b56a35cc5fe8772/dag-cbor-0.3.3.tar.gz",
    "platform": null,
    "description": "dag-cbor: A Python implementation of the `DAG-CBOR codec <https://ipld.io/specs/codecs/dag-cbor/spec/>`_\r\n========================================================================================================\r\n\r\n.. image:: https://img.shields.io/badge/python-3.7+-green.svg\r\n    :target: https://docs.python.org/3.7/\r\n    :alt: Python versions\r\n\r\n.. image:: https://img.shields.io/pypi/v/dag-cbor.svg\r\n    :target: https://pypi.python.org/pypi/dag-cbor/\r\n    :alt: PyPI version\r\n\r\n.. image:: https://img.shields.io/pypi/status/dag-cbor.svg\r\n    :target: https://pypi.python.org/pypi/dag-cbor/\r\n    :alt: PyPI status\r\n\r\n.. image:: http://www.mypy-lang.org/static/mypy_badge.svg\r\n    :target: https://github.com/python/mypy\r\n    :alt: Checked with Mypy\r\n    \r\n.. image:: https://readthedocs.org/projects/dag-cbor/badge/?version=latest\r\n    :target: https://dag-cbor.readthedocs.io/en/latest/?badge=latest\r\n    :alt: Documentation Status\r\n\r\n.. image:: https://github.com/hashberg-io/dag-cbor/actions/workflows/python-pytest.yml/badge.svg\r\n    :target: https://github.com/hashberg-io/dag-cbor/actions/workflows/python-pytest.yml\r\n    :alt: Python package status\r\n\r\n.. image:: https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square\r\n    :target: https://github.com/RichardLitt/standard-readme\r\n    :alt: standard-readme compliant\r\n\r\n\r\nThis is a fully compliant Python implementation of the `DAG-CBOR codec <https://ipld.io/specs/codecs/dag-cbor/spec/>`_, a subset of the `Concise Binary Object Representation (CBOR) <https://cbor.io/>`_ supporting the `IPLD Data Model <https://ipld.io/docs/data-model/>`_ and enforcing a unique (strict) encoded representation of items.\r\n\r\n\r\n.. contents::\r\n\r\n\r\nInstall\r\n-------\r\n\r\nYou can install the latest release from `PyPI <https://pypi.org/project/dag-cbor/>`_ as follows:\r\n\r\n.. code-block:: console\r\n\r\n    $ pip install --upgrade dag-cbor\r\n\r\n\r\nUsage\r\n-----\r\n\r\nWe suggest you import DAG-CBOR as follows:\r\n\r\n>>> import dag_cbor\r\n\r\nBelow are some basic usage examples, to get you started: for detailed documentation, see https://dag-cbor.readthedocs.io/\r\n\r\n\r\nEncoding and decoding\r\n^^^^^^^^^^^^^^^^^^^^^\r\n\r\n>>> dag_cbor.encode({'a': 12, 'b': 'hello!'})\r\nb'\\xa2aa\\x0cabfhello!'\r\n>>> dag_cbor.decode(b'\\xa2aa\\x0cabfhello!')\r\n{'a': 12, 'b': 'hello!'}\r\n\r\n\r\nRandom DAG-CBOR data\r\n^^^^^^^^^^^^^^^^^^^^\r\n\r\n>>> import pprint # pretty-printing\r\n>>> custom_opts = dict(min_codepoint=0x41, max_codepoint=0x5a, include_cid=False)\r\n>>> with dag_cbor.random.options(**custom_opts):\r\n...     for d in dag_cbor.random.rand_dict(3):\r\n...             pprint.pp(d)\r\n...\r\n{'BIQPMZ': b'\\x85\\x1f\\x07/\\xcc\\x00\\xfc\\xaa',\r\n 'EJEYDTZI': {},\r\n 'PLSG': {'G': 'JFG',\r\n          'HZE': -61.278,\r\n          'JWDRKRGZ': b'-',\r\n          'OCCKQPDJ': True,\r\n          'SJOCTZMK': False},\r\n 'PRDLN': 39.129,\r\n 'TUGRP': None,\r\n 'WZTEJDXC': -69.933}\r\n{'GHAXI': 39.12,\r\n 'PVUWZLC': 4.523,\r\n 'TDPSU': 'TVCADUGT',\r\n 'ZHGVSNSI': [-57, 9, -78.312]}\r\n{'': 11, 'B': True, 'FWD': {}, 'GXZBVAR': 'BTDWMGI', 'TDICHC': 87}\r\n\r\n\r\n\r\nAPI\r\n---\r\n\r\nFor the full API documentation, see https://dag-cbor.readthedocs.io/\r\n\r\n\r\nContributing\r\n------------\r\n\r\nPlease see `<CONTRIBUTING.md>`_.\r\n\r\n\r\nLicense\r\n-------\r\n\r\n`MIT \u00a9 Hashberg Ltd. <LICENSE>`_\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python implementation of the DAG-CBOR codec.",
    "version": "0.3.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/hashberg-io/dag-cbor/issues",
        "Homepage": "https://github.com/hashberg-io/dag-cbor"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "148e3fa50f0e4d709610be14b8b8049f5bdd9dbeddf5147286a4c59ba55f8af0",
                "md5": "24077b550d5f2bb7d6e513468128fd30",
                "sha256": "e0d1c45427ed1fa21bbd103163d4b250f4ce9066337d6ffb976da1fac3a67454"
            },
            "downloads": -1,
            "filename": "dag_cbor-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "24077b550d5f2bb7d6e513468128fd30",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 25457,
            "upload_time": "2023-12-18T22:32:30",
            "upload_time_iso_8601": "2023-12-18T22:32:30.670146Z",
            "url": "https://files.pythonhosted.org/packages/14/8e/3fa50f0e4d709610be14b8b8049f5bdd9dbeddf5147286a4c59ba55f8af0/dag_cbor-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2818b318561a2cb51bfb80664394c507bad6bf9f77fa9e5e7b56a35cc5fe8772",
                "md5": "32a7531eb152018a0dd3941e4e5e2d94",
                "sha256": "d8d1e7c7a022af758932e5343b7a2c9d7afa1cc64860246cae22f90cab1c9d8a"
            },
            "downloads": -1,
            "filename": "dag-cbor-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "32a7531eb152018a0dd3941e4e5e2d94",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 54550,
            "upload_time": "2023-12-18T22:32:32",
            "upload_time_iso_8601": "2023-12-18T22:32:32.644814Z",
            "url": "https://files.pythonhosted.org/packages/28/18/b318561a2cb51bfb80664394c507bad6bf9f77fa9e5e7b56a35cc5fe8772/dag-cbor-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-18 22:32:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hashberg-io",
    "github_project": "dag-cbor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "dag-cbor"
}
        
Elapsed time: 0.15295s