Skip to main content

Numpy data serialization using msgpack

Project description

Package Description

This package provides encoding and decoding routines that enable the serialization and deserialization of numerical and array data types provided by numpy using the highly efficient msgpack format. Serialization of Python’s native complex data types is also supported.

Latest Version

Installation

msgpack-numpy requires msgpack-python and numpy. If you have pip 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.

Development

The latest source code can be obtained from GitHub.

Authors

See the included AUTHORS.rst file for more information.

License

This software is licensed under the BSD License. See the included LICENSE.rst file for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msgpack-numpy-0.4.4.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msgpack_numpy-0.4.4.2-py2.py3-none-any.whl (6.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file msgpack-numpy-0.4.4.2.tar.gz.

File metadata

  • Download URL: msgpack-numpy-0.4.4.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for msgpack-numpy-0.4.4.2.tar.gz
Algorithm Hash digest
SHA256 a1638108538aaba55bebaef9d847dfb3064bb1c829e68301716a6a956fa6a0d6
MD5 f112292bea9008203e457d9482e77ce3
BLAKE2b-256 b8705d804a4ff26788d5b5abcebeb57498e45c33816957edb5cea38982c69a93

See more details on using hashes here.

File details

Details for the file msgpack_numpy-0.4.4.2-py2.py3-none-any.whl.

File metadata

  • Download URL: msgpack_numpy-0.4.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for msgpack_numpy-0.4.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 20d3f679cd727e2b9acb59297988895a148add8995618e7437b80bb95e7a0d7d
MD5 7b11c7c7fb84628c9bd379fc2d47352f
BLAKE2b-256 b41c68fcaeb72ac4a9c7f44cf4d19082bd4e486cd035134b118ddea6eff10e7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page