||# MessagePack for Python
## What's this
[MessagePack] is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON.
But it's faster and smaller.
This package provides CPython bindings for reading and writing MessagePack
## Very important notes for existing users
### PyPI package name
Package name on PyPI was changed from `msgpack-python` to `msgpack` from
When upgrading from msgpack-0.4 or earlier, do `pip uninstall
`pip install -U msgpack`.
### Compatibility with the old format
You can use `use_bin_type=False` option to pack `bytes`
object into raw type in the old msgpack spec, instead of bin type in new
You can unpack old msgpack format using `raw=True` option.
It unpacks str (raw) type in msgpack into Python bytes.
See note below for detail.
### Major breaking changes in msgpack 1.0
* Python 2
* The extension module does not support Python 2 anymore.
The pure Python implementation (`msgpack.fallback`) is used for Python
* `use_bin_type=True` by default. bytes are encoded in bin type in
**If you are still using Python 2, you must use unicode for all string
You can use `use_bin_type=False` to encode into old msgpack format.
* `encoding` option is removed. UTF-8 is used always.
* `raw=False` by default. It assumes str types are valid UTF-8 string
and decode them to Python str (unicode) object.
* `encoding` option is removed. You can use `raw=True` to support old
* Default value of `max_buffer_size` is changed from 0 to 100 MiB.
* Default value of `strict_map_key` is changed to True to avoid hashdos.
You need to pass `strict_map_key=False` if you have data which contain
which type is not bytes or str.
$ pip install msgpack
### Pure Python implementation
The extension module in msgpack (`msgpack._cmsgpack`) does not support
Python 2 and PyPy.
But msgpack provides a pure Python implementation (`msgpack.fallback`)
for PyPy and Python 2.
When you can't use a binary distribution, you need to install Visual Studio
or Windows SDK on Windows.
Without extension, using pure Python implementation on CPython runs slowly.
## How to use
NOTE: In examples below, I use `raw=False` and `use_bin_type=True` for
using msgpack < 1.0. These options are default from msgpack 1.0 so you can
### One-shot pack & unpack
Use `packb` for packing and `unpackb` for unpacking.
msgpack provides `dumps` and `loads` as an alias for compatibility with
`json` and `pickle`.
`pack` and `dump` packs to a file-like object.
`unpack` and `load` unpacks from a file-like object.
Configuration Switches (platform-specific settings discarded)
PY310 OFF Build using Python 3.10
PY39 ON Build using Python 3.9
Package Dependencies by Type
Distribution File Information
f5d869c18f030202eb412f08b28d2afeea553d6613aee89e200d7aca7ef01f5f 128053 msgpack-1.0.4.tar.gz
Ports that require python-msgpack:py39