MessagePack (de)serializer.
Project description
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file msgpack-python-0.2.0.tar.gz.
File metadata
- Download URL: msgpack-python-0.2.0.tar.gz
- Upload date:
- Size: 90.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c63a95128824f8983962298e32f59ff296bf1270c5b3681d083d78b63bf1310b
|
|
| MD5 |
cdac1d250cf9c0f0bd36abdfe2c96f8b
|
|
| BLAKE2b-256 |
a6008f4713588f5ae095216f43f475dca7553e516d8044fd822c447a9a56a10e
|
File details
Details for the file msgpack_python-0.2.0-py3.2-win-amd64.egg.
File metadata
- Download URL: msgpack_python-0.2.0-py3.2-win-amd64.egg
- Upload date:
- Size: 28.6 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
620634219179328fb128ee289e2340de53c8f5398e179b0a6a53bfa5b6cb1c7c
|
|
| MD5 |
4ac6e179b3dfe9a919e98e72fbe62965
|
|
| BLAKE2b-256 |
a88be4f9af75124cd6225c144f1b6f0eefb81ec224393cfe4c3cd4b00b63bd45
|
File details
Details for the file msgpack_python-0.2.0-py3.2-win32.egg.
File metadata
- Download URL: msgpack_python-0.2.0-py3.2-win32.egg
- Upload date:
- Size: 27.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d87c4349de84a5a89a4e55f52befc187cc876e808162746de0ed7768b702dcf
|
|
| MD5 |
985a37940d2bb87637f851e614f3b96e
|
|
| BLAKE2b-256 |
04f0e8f507a22ad6b8b6c352e531ae9cba5518282f62d3ac7271d4728ac853bc
|
File details
Details for the file msgpack_python-0.2.0-py2.7-win-amd64.egg.
File metadata
- Download URL: msgpack_python-0.2.0-py2.7-win-amd64.egg
- Upload date:
- Size: 28.5 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
352ab1f696436d12c472139d8d2936b0ebaacd0d22f381b1158fbd4e94d61706
|
|
| MD5 |
a8d0d3ce2b02fdc0b053e835c14726c5
|
|
| BLAKE2b-256 |
151262ca253e88fe8cbab2463110a5e8590d760e7428b6e43b63f8232ff1d890
|
File details
Details for the file msgpack_python-0.2.0-py2.7-win32.egg.
File metadata
- Download URL: msgpack_python-0.2.0-py2.7-win32.egg
- Upload date:
- Size: 26.8 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cb7700198e486ee0a253640f9abe2dfb3b30df1ada49546e70af2ee299a793d
|
|
| MD5 |
d52bd856ca8c8d9a6ee86937e1b4c644
|
|
| BLAKE2b-256 |
012eff2faf03cee18c829df28f973e80a46a4fc6ffa65c0c665531ed067b7345
|