py-multicodec


Namepy-multicodec JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/multiformats/py-multicodec
SummaryMulticodec implementation in Python
upload_time2019-08-04 07:09:26
maintainer
docs_urlNone
authorDhruv Baldawa
requires_python
licenseMIT license
keywords multicodec
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            py-multicodec
-------------

.. image:: https://img.shields.io/pypi/v/py-multicodec.svg
        :target: https://pypi.python.org/pypi/py-multicodec

.. image:: https://img.shields.io/travis/multiformats/py-multicodec.svg?branch=master
        :target: https://travis-ci.org/multiformats/py-multicodec?branch=master

.. image:: https://codecov.io/gh/multiformats/py-multicodec/branch/master/graph/badge.svg
        :target: https://codecov.io/gh/multiformats/py-multicodec

.. image:: https://readthedocs.org/projects/py-multicodec/badge/?version=stable
        :target: https://py-multicodec.readthedocs.io/en/stable/?badge=stable
        :alt: Documentation Status


`Multicodec <https://github.com/multiformats/multicodec>`_ implementation in Python

``multicodec`` *is a self-describing multiformat*, it wraps other formats with a tiny bit of self-description.

A multicodec identifier is both a varint and the code identifying the following data, this means that the most
significant bit of every multicodec code is reserved to signal the continuation.

You can check `the table here <https://github.com/multiformats/multicodec/blob/7c57cd4477e391d27b8d7cc0995da9e674434ffb/table.csv>`_ for the list of supported codecs by ``py-multicodec``.

* Free software: MIT license
* Documentation: https://py-multicodec.readthedocs.io.
* Python versions: 3.5, 3.6


Installation
============

.. code-block:: shell

    $ pip install py-multicodec


Sample Usage
============

.. code-block:: python

    >>> from multicodec import add_prefix, remove_prefix, get_codec
    >>> # adding a prefix to existing data
    >>> add_prefix('sha2-256', 'EiC5TSe5k00')
    b'\x12EiC5TSe5k00'
    >>> # removing prefix from prefixed data
    >>> remove_prefix(b'\x12EiC5TSe5k00')
    EiC5TSe5k00
    >>> # get codec used to prefix the prefixed data
    >>> get_codec(b'\x12EiC5TSe5k00')
    'sha2-256'

Updating the lookup table
==========================

Updating the lookup table is done with a script. The source of truth is the
`multicodec default table <https://github.com/multiformats/multicodec/blob/master/table.csv>`_.
Update the table with running:

.. code-block:: shell

    $ curl -X GET https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv | ./tools/update-table.py


=======
History
=======

0.1.3 (2018-10-20)
------------------

* Handle exception when the varint is invalid

0.1.0 (2017-09-03)
------------------

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/multiformats/py-multicodec",
    "name": "py-multicodec",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "multicodec",
    "author": "Dhruv Baldawa",
    "author_email": "dhruv@dhruvb.com",
    "download_url": "https://files.pythonhosted.org/packages/77/33/ff388b34002239c367f6544678667efff079d29aabf7e3c4a3ec392310be/py-multicodec-0.2.1.tar.gz",
    "platform": "",
    "description": "py-multicodec\n-------------\n\n.. image:: https://img.shields.io/pypi/v/py-multicodec.svg\n        :target: https://pypi.python.org/pypi/py-multicodec\n\n.. image:: https://img.shields.io/travis/multiformats/py-multicodec.svg?branch=master\n        :target: https://travis-ci.org/multiformats/py-multicodec?branch=master\n\n.. image:: https://codecov.io/gh/multiformats/py-multicodec/branch/master/graph/badge.svg\n        :target: https://codecov.io/gh/multiformats/py-multicodec\n\n.. image:: https://readthedocs.org/projects/py-multicodec/badge/?version=stable\n        :target: https://py-multicodec.readthedocs.io/en/stable/?badge=stable\n        :alt: Documentation Status\n\n\n`Multicodec <https://github.com/multiformats/multicodec>`_ implementation in Python\n\n``multicodec`` *is a self-describing multiformat*, it wraps other formats with a tiny bit of self-description.\n\nA multicodec identifier is both a varint and the code identifying the following data, this means that the most\nsignificant bit of every multicodec code is reserved to signal the continuation.\n\nYou can check `the table here <https://github.com/multiformats/multicodec/blob/7c57cd4477e391d27b8d7cc0995da9e674434ffb/table.csv>`_ for the list of supported codecs by ``py-multicodec``.\n\n* Free software: MIT license\n* Documentation: https://py-multicodec.readthedocs.io.\n* Python versions: 3.5, 3.6\n\n\nInstallation\n============\n\n.. code-block:: shell\n\n    $ pip install py-multicodec\n\n\nSample Usage\n============\n\n.. code-block:: python\n\n    >>> from multicodec import add_prefix, remove_prefix, get_codec\n    >>> # adding a prefix to existing data\n    >>> add_prefix('sha2-256', 'EiC5TSe5k00')\n    b'\\x12EiC5TSe5k00'\n    >>> # removing prefix from prefixed data\n    >>> remove_prefix(b'\\x12EiC5TSe5k00')\n    EiC5TSe5k00\n    >>> # get codec used to prefix the prefixed data\n    >>> get_codec(b'\\x12EiC5TSe5k00')\n    'sha2-256'\n\nUpdating the lookup table\n==========================\n\nUpdating the lookup table is done with a script. The source of truth is the\n`multicodec default table <https://github.com/multiformats/multicodec/blob/master/table.csv>`_.\nUpdate the table with running:\n\n.. code-block:: shell\n\n    $ curl -X GET https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv | ./tools/update-table.py\n\n\n=======\nHistory\n=======\n\n0.1.3 (2018-10-20)\n------------------\n\n* Handle exception when the varint is invalid\n\n0.1.0 (2017-09-03)\n------------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Multicodec implementation in Python",
    "version": "0.2.1",
    "split_keywords": [
        "multicodec"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "714726ad3a2d5a0f3d22ac051f258901",
                "sha256": "55b6bb53088a63e56c434cb11b29795e8805652bac43d50a8f2a9bcf5ca84e1f"
            },
            "downloads": -1,
            "filename": "py_multicodec-0.2.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "714726ad3a2d5a0f3d22ac051f258901",
            "packagetype": "bdist_wheel",
            "python_version": "3.5",
            "requires_python": null,
            "size": 8536,
            "upload_time": "2019-08-04T07:09:32",
            "upload_time_iso_8601": "2019-08-04T07:09:32.504942Z",
            "url": "https://files.pythonhosted.org/packages/6c/96/3ffb721c2fe100f6613a0d2db3b4b3229c6de52b279fd41aab0e84ea0725/py_multicodec-0.2.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "ac5dbadc49ab0e2a792443467c38651f",
                "sha256": "83021ffe8c0e272d19b5b86bc5b39efa67c8e9f4735ce6cafdbc1ace767ec647"
            },
            "downloads": -1,
            "filename": "py-multicodec-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ac5dbadc49ab0e2a792443467c38651f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22542,
            "upload_time": "2019-08-04T07:09:26",
            "upload_time_iso_8601": "2019-08-04T07:09:26.258205Z",
            "url": "https://files.pythonhosted.org/packages/77/33/ff388b34002239c367f6544678667efff079d29aabf7e3c4a3ec392310be/py-multicodec-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-08-04 07:09:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "multiformats",
    "github_project": "py-multicodec",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "py-multicodec"
}
        
Elapsed time: 0.01891s