Skip to main content

MessagePack (de)serializer.

Project description

Author:

INADA Naoki

Version:
0.2.0
Date:
2012-06-27

HOW TO USE

one-shot pack & unpack

Use packb for packing and unpackb for unpacking. msgpack provides dumps and loads as alias for compatibility with json and pickle.

pack and dump packs to file-like object. unpack and load unpacks from file-like object.

>>> import msgpack
>>> msgpack.packb([1, 2, 3])
'\x93\x01\x02\x03'
>>> msgpack.unpackb(_)
(1, 2, 3)

unpack unpacks msgpack’s array to Python’s tuple. To unpack it to list, Use use_list option.

>>> msgpack.unpackb(b'\x93\x01\x02\x03', use_list=True)
[1, 2, 3]

Read docstring for other options.

streaming unpacking

Unpacker is “streaming unpacker”. It unpacks multiple objects from one stream.

import msgpack
from io import BytesIO

buf = BytesIO()
for i in range(100):
   buf.write(msgpack.packb(range(i)))

buf.seek(0)

unpacker = msgpack.Unpacker()
while True:
    data = buf.read(4)
    if not data:
        break
    unpacker.seed(buf.read(16))
    for unpacked in unpacker:
        print unpacked

INSTALL

You can use pip or easy_install to install msgpack:

$ easy_install msgpack-python
  or
$ pip install msgpack-python

Windows

msgpack provides some binary distribution for Windows. You can install msgpack without compiler with them.

When you can’t use binary distribution, you need to install Visual Studio or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn’t support amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)

TEST

MessagePack uses nosetest for testing. Run test with following command:

$ nosetests test

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-python-0.2.0.tar.gz (90.1 kB view details)

Uploaded Source

Built Distributions

msgpack_python-0.2.0-py3.2-win-amd64.egg (28.6 kB view details)

Uploaded Source

msgpack_python-0.2.0-py3.2-win32.egg (27.0 kB view details)

Uploaded Source

msgpack_python-0.2.0-py2.7-win-amd64.egg (28.5 kB view details)

Uploaded Source

msgpack_python-0.2.0-py2.7-win32.egg (26.8 kB view details)

Uploaded Source

File details

Details for the file msgpack-python-0.2.0.tar.gz.

File metadata

File hashes

Hashes for msgpack-python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c63a95128824f8983962298e32f59ff296bf1270c5b3681d083d78b63bf1310b
MD5 cdac1d250cf9c0f0bd36abdfe2c96f8b
BLAKE2b-256 a6008f4713588f5ae095216f43f475dca7553e516d8044fd822c447a9a56a10e

See more details on using hashes here.

File details

Details for the file msgpack_python-0.2.0-py3.2-win-amd64.egg.

File metadata

File hashes

Hashes for msgpack_python-0.2.0-py3.2-win-amd64.egg
Algorithm Hash digest
SHA256 620634219179328fb128ee289e2340de53c8f5398e179b0a6a53bfa5b6cb1c7c
MD5 4ac6e179b3dfe9a919e98e72fbe62965
BLAKE2b-256 a88be4f9af75124cd6225c144f1b6f0eefb81ec224393cfe4c3cd4b00b63bd45

See more details on using hashes here.

File details

Details for the file msgpack_python-0.2.0-py3.2-win32.egg.

File metadata

File hashes

Hashes for msgpack_python-0.2.0-py3.2-win32.egg
Algorithm Hash digest
SHA256 2d87c4349de84a5a89a4e55f52befc187cc876e808162746de0ed7768b702dcf
MD5 985a37940d2bb87637f851e614f3b96e
BLAKE2b-256 04f0e8f507a22ad6b8b6c352e531ae9cba5518282f62d3ac7271d4728ac853bc

See more details on using hashes here.

File details

Details for the file msgpack_python-0.2.0-py2.7-win-amd64.egg.

File metadata

File hashes

Hashes for msgpack_python-0.2.0-py2.7-win-amd64.egg
Algorithm Hash digest
SHA256 352ab1f696436d12c472139d8d2936b0ebaacd0d22f381b1158fbd4e94d61706
MD5 a8d0d3ce2b02fdc0b053e835c14726c5
BLAKE2b-256 151262ca253e88fe8cbab2463110a5e8590d760e7428b6e43b63f8232ff1d890

See more details on using hashes here.

File details

Details for the file msgpack_python-0.2.0-py2.7-win32.egg.

File metadata

File hashes

Hashes for msgpack_python-0.2.0-py2.7-win32.egg
Algorithm Hash digest
SHA256 7cb7700198e486ee0a253640f9abe2dfb3b30df1ada49546e70af2ee299a793d
MD5 d52bd856ca8c8d9a6ee86937e1b4c644
BLAKE2b-256 012eff2faf03cee18c829df28f973e80a46a4fc6ffa65c0c665531ed067b7345

See more details on using hashes here.

Supported by

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