msgpack-numpy


Namemsgpack-numpy JSON
Version 0.4.8 PyPI version JSON
download
home_pagehttps://github.com/lebedov/msgpack-numpy
SummaryNumpy data serialization using msgpack
upload_time2022-06-09 03:43:08
maintainer
docs_urlNone
authorLev E. Givon
requires_python
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Package Description
-------------------
This package provides encoding and decoding routines that enable the
serialization and deserialization of numerical and array data types provided by 
[numpy](http://www.numpy.org/) using the highly efficient
[msgpack](http://msgpack.org/) format. Serialization of Python's
native complex data types is also supported.

[![Latest Version](https://img.shields.io/pypi/v/msgpack-numpy.svg)](https://pypi.python.org/pypi/msgpack-numpy)
[![Build Status](https://travis-ci.org/lebedov/msgpack-numpy.svg?branch=master)](https://travis-ci.org/lebedov/msgpack-numpy)

Installation
------------
msgpack-numpy requires msgpack-python and numpy. If you 
have [pip](http://www.pip-installer.org/) installed on your
system, run

    pip install msgpack-numpy

to install the package and all dependencies. You can also download 
the source tarball, unpack it, and run

    python setup.py install

from within the source directory.

Usage
-----
The easiest way to use msgpack-numpy is to call its monkey patching
function after importing the Python msgpack package:

    import msgpack
    import msgpack_numpy as m
    m.patch()

This will automatically force all msgpack serialization and deserialization
routines (and other packages that use them) to become numpy-aware. 
Of course, one can also manually pass the encoder and 
decoder provided by msgpack-numpy to the msgpack routines:

    import msgpack
    import msgpack_numpy as m
    import numpy as np

    x = np.random.rand(5)
    x_enc = msgpack.packb(x, default=m.encode)
    x_rec = msgpack.unpackb(x_enc, object_hook=m.decode)

msgpack-numpy will try to use the binary (fast) extension in msgpack by default.  
If msgpack was not compiled with Cython (or if the ``MSGPACK_PUREPYTHON`` 
variable is set), it will fall back to using the slower pure Python msgpack 
implementation.

Notes
-----
The primary design goal of msgpack-numpy is ensuring preservation of numerical
data types during msgpack serialization and deserialization. Inclusion of type
information in the serialized data necessarily incurs some storage overhead; if
preservation of type information is not needed, one may be able to avoid some
of this overhead by writing a custom encoder/decoder pair that produces more
efficient serializations for those specific use cases. 

Numpy arrays with a dtype of 'O' are serialized/deserialized using pickle as 
a fallback solution to enable msgpack-numpy to handle
such arrays. As the additional overhead of pickle serialization negates one
of the reasons to use msgpack, it may be advisable to either write a custom
encoder/decoder to handle the specific use case efficiently or else not bother
using msgpack-numpy.

Note that numpy arrays deserialized by msgpack-numpy are read-only and must be copied 
if they are to be modified.

Development
-----------
The latest source code can be obtained from [GitHub](https://github.com/lebedov/msgpack-numpy/).

msgpack-numpy maintains compatibility with python versions 2.7 and 3.5+.

Install [`tox`](https://tox.readthedocs.io/en/latest/) to support testing
across multiple python versions in your development environment. If you
use [`conda`](https://docs.conda.io/en/latest/) to install `python` use
[`tox-conda`](https://github.com/tox-dev/tox-conda) to automatically manage
testing across all supported python versions.

    # Using a system python
    pip install tox

    # Additionally, using a conda-provided python
    pip install tox tox-conda

Execute tests across supported python versions:

    tox

Authors
-------
See the included [AUTHORS.md](https://github.com/lebedov/msgpack-numpy/blob/master/AUTHORS.md) file for 
more information.

License
-------
This software is licensed under the [BSD License](http://www.opensource.org/licenses/bsd-license).
See the included [LICENSE.md](https://github.com/lebedov/msgpack-numpy/blob/master/LICENSE.md) file for 
more information.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lebedov/msgpack-numpy",
    "name": "msgpack-numpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lev E. Givon",
    "author_email": "lev@columbia.edu",
    "download_url": "https://files.pythonhosted.org/packages/08/94/61e8aee142733ebfdc400a05bdac6e1763c4514bba3b42743d223f388450/msgpack-numpy-0.4.8.tar.gz",
    "platform": null,
    "description": "Package Description\n-------------------\nThis package provides encoding and decoding routines that enable the\nserialization and deserialization of numerical and array data types provided by \n[numpy](http://www.numpy.org/) using the highly efficient\n[msgpack](http://msgpack.org/) format. Serialization of Python's\nnative complex data types is also supported.\n\n[![Latest Version](https://img.shields.io/pypi/v/msgpack-numpy.svg)](https://pypi.python.org/pypi/msgpack-numpy)\n[![Build Status](https://travis-ci.org/lebedov/msgpack-numpy.svg?branch=master)](https://travis-ci.org/lebedov/msgpack-numpy)\n\nInstallation\n------------\nmsgpack-numpy requires msgpack-python and numpy. If you \nhave [pip](http://www.pip-installer.org/) installed on your\nsystem, run\n\n    pip install msgpack-numpy\n\nto install the package and all dependencies. You can also download \nthe source tarball, unpack it, and run\n\n    python setup.py install\n\nfrom within the source directory.\n\nUsage\n-----\nThe easiest way to use msgpack-numpy is to call its monkey patching\nfunction after importing the Python msgpack package:\n\n    import msgpack\n    import msgpack_numpy as m\n    m.patch()\n\nThis will automatically force all msgpack serialization and deserialization\nroutines (and other packages that use them) to become numpy-aware. \nOf course, one can also manually pass the encoder and \ndecoder provided by msgpack-numpy to the msgpack routines:\n\n    import msgpack\n    import msgpack_numpy as m\n    import numpy as np\n\n    x = np.random.rand(5)\n    x_enc = msgpack.packb(x, default=m.encode)\n    x_rec = msgpack.unpackb(x_enc, object_hook=m.decode)\n\nmsgpack-numpy will try to use the binary (fast) extension in msgpack by default.  \nIf msgpack was not compiled with Cython (or if the ``MSGPACK_PUREPYTHON`` \nvariable is set), it will fall back to using the slower pure Python msgpack \nimplementation.\n\nNotes\n-----\nThe primary design goal of msgpack-numpy is ensuring preservation of numerical\ndata types during msgpack serialization and deserialization. Inclusion of type\ninformation in the serialized data necessarily incurs some storage overhead; if\npreservation of type information is not needed, one may be able to avoid some\nof this overhead by writing a custom encoder/decoder pair that produces more\nefficient serializations for those specific use cases. \n\nNumpy arrays with a dtype of 'O' are serialized/deserialized using pickle as \na fallback solution to enable msgpack-numpy to handle\nsuch arrays. As the additional overhead of pickle serialization negates one\nof the reasons to use msgpack, it may be advisable to either write a custom\nencoder/decoder to handle the specific use case efficiently or else not bother\nusing msgpack-numpy.\n\nNote that numpy arrays deserialized by msgpack-numpy are read-only and must be copied \nif they are to be modified.\n\nDevelopment\n-----------\nThe latest source code can be obtained from [GitHub](https://github.com/lebedov/msgpack-numpy/).\n\nmsgpack-numpy maintains compatibility with python versions 2.7 and 3.5+.\n\nInstall [`tox`](https://tox.readthedocs.io/en/latest/) to support testing\nacross multiple python versions in your development environment. If you\nuse [`conda`](https://docs.conda.io/en/latest/) to install `python` use\n[`tox-conda`](https://github.com/tox-dev/tox-conda) to automatically manage\ntesting across all supported python versions.\n\n    # Using a system python\n    pip install tox\n\n    # Additionally, using a conda-provided python\n    pip install tox tox-conda\n\nExecute tests across supported python versions:\n\n    tox\n\nAuthors\n-------\nSee the included [AUTHORS.md](https://github.com/lebedov/msgpack-numpy/blob/master/AUTHORS.md) file for \nmore information.\n\nLicense\n-------\nThis software is licensed under the [BSD License](http://www.opensource.org/licenses/bsd-license).\nSee the included [LICENSE.md](https://github.com/lebedov/msgpack-numpy/blob/master/LICENSE.md) file for \nmore information.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Numpy data serialization using msgpack",
    "version": "0.4.8",
    "project_urls": {
        "Homepage": "https://github.com/lebedov/msgpack-numpy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b5df25ac7d4fb77cbd53ddc6d05d833c6bf52b12770a44fa9a447eed470ca9a",
                "md5": "6c2dc5bdd55a65c0a289013a7ee98139",
                "sha256": "773c19d4dfbae1b3c7b791083e2caf66983bb19b40901646f61d8731554ae3da"
            },
            "downloads": -1,
            "filename": "msgpack_numpy-0.4.8-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c2dc5bdd55a65c0a289013a7ee98139",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 6919,
            "upload_time": "2022-06-09T03:43:06",
            "upload_time_iso_8601": "2022-06-09T03:43:06.820447Z",
            "url": "https://files.pythonhosted.org/packages/9b/5d/f25ac7d4fb77cbd53ddc6d05d833c6bf52b12770a44fa9a447eed470ca9a/msgpack_numpy-0.4.8-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "089461e8aee142733ebfdc400a05bdac6e1763c4514bba3b42743d223f388450",
                "md5": "a901362305b95dabc2a57ae1fefc2f44",
                "sha256": "c667d3180513422f9c7545be5eec5d296dcbb357e06f72ed39cc683797556e69"
            },
            "downloads": -1,
            "filename": "msgpack-numpy-0.4.8.tar.gz",
            "has_sig": false,
            "md5_digest": "a901362305b95dabc2a57ae1fefc2f44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10923,
            "upload_time": "2022-06-09T03:43:08",
            "upload_time_iso_8601": "2022-06-09T03:43:08.739146Z",
            "url": "https://files.pythonhosted.org/packages/08/94/61e8aee142733ebfdc400a05bdac6e1763c4514bba3b42743d223f388450/msgpack-numpy-0.4.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-09 03:43:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lebedov",
    "github_project": "msgpack-numpy",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "msgpack-numpy"
}
        
Elapsed time: 0.08612s