Numpy data serialization using msgpack
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.
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.
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.
The latest source code can be obtained from GitHub.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size msgpack_numpy-0.4.3.2-py2.py3-none-any.whl (5.2 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size msgpack-numpy-0.4.3.2.tar.gz (7.8 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for msgpack_numpy-0.4.3.2-py2.py3-none-any.whl