1- ===========================
2- MessagePack Python Binding
3- ===========================
1+ =======================
2+ MessagePack for Python
3+ =======================
44
55:author: INADA Naoki
66:version: 0.3.0
@@ -9,30 +9,53 @@ MessagePack Python Binding
99.. image :: https://secure.travis-ci.org/msgpack/msgpack-python.png
1010 :target: https://travis-ci.org/#!/msgpack/msgpack-python
1111
12- WHAT IT IS
13- ----------
12+ What's this
13+ ------------
1414
1515`MessagePack <http://msgpack.org/ >`_ is a fast, compact binary serialization format, suitable for
1616similar data to JSON. This package provides CPython bindings for reading and
1717writing MessagePack data.
1818
19- NOTE for msgpack 0.2.x users
19+ Install
20+ ---------
21+ You can use ``pip `` or ``easy_install `` to install msgpack::
22+
23+ $ easy_install msgpack-python
24+ or
25+ $ pip install msgpack-python
26+
27+ PyPy
28+ ^^^^^
29+
30+ msgpack-python provides pure python implementation.
31+ PyPy can use this.
32+
33+ Windows
34+ ^^^^^^^
35+
36+ When you can't use binary distribution, you need to install Visual Studio
37+ or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn't support
38+ amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)
39+
40+ Without extension, using pure python implementation on CPython runs slowly.
41+
42+ Note for msgpack 0.2.x users
2043----------------------------
2144
2245The msgpack 0.3 have some incompatible changes.
2346
24- The default value of ``use_list `` keyword argument is ``True `` from 0.3.x.
47+ The default value of ``use_list `` keyword argument is ``True `` from 0.3.
2548You should pass the argument explicitly for backward compatibility.
2649
2750`Unpacker.unpack() ` and some unpack methods now raises `OutOfData `
2851instead of `StopIteration `.
2952`StopIteration ` is used for iterator protocol only.
3053
3154
32- HOW TO USE
55+ How to use
3356-----------
3457
35- one -shot pack & unpack
58+ One -shot pack & unpack
3659^^^^^^^^^^^^^^^^^^^^^^
3760
3861Use ``packb `` for packing and ``unpackb `` for unpacking.
@@ -60,7 +83,7 @@ You should always pass the ``use_list`` keyword argument. See performance issues
6083Read the docstring for other options.
6184
6285
63- streaming unpacking
86+ Streaming unpacking
6487^^^^^^^^^^^^^^^^^^^
6588
6689``Unpacker `` is a "streaming unpacker". It unpacks multiple objects from one
@@ -82,7 +105,7 @@ stream (or from bytes provided through its ``feed`` method).
82105 print unpacked
83106
84107
85- packing /unpacking of custom data type
108+ Packing /unpacking of custom data type
86109^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87110
88111It is also possible to pack/unpack custom data types. Here is an example for
@@ -118,7 +141,7 @@ It is also possible to pack/unpack custom data types. Here is an example for
118141key-value pairs.
119142
120143
121- advanced unpacking control
144+ Advanced unpacking control
122145^^^^^^^^^^^^^^^^^^^^^^^^^^
123146
124147As an alternative to iteration, ``Unpacker `` objects provide ``unpack ``,
@@ -150,27 +173,8 @@ callback function:
150173 unpacker.skip(bytestream.write)
151174 worker.send(bytestream.getvalue())
152175
153- INSTALL
154- ---------
155- You can use ``pip `` or ``easy_install `` to install msgpack::
156-
157- $ easy_install msgpack-python
158- or
159- $ pip install msgpack-python
160-
161-
162- Windows
163- ^^^^^^^
164- msgpack provides some binary distribution for Windows.
165- You can install msgpack without compiler with them.
166-
167- When you can't use binary distribution, you need to install Visual Studio
168- or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn't support
169- amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)
170-
171-
172- PERFORMANCE NOTE
173- -----------------
176+ Note about performance
177+ ------------------------
174178
175179GC
176180^^
@@ -179,8 +183,8 @@ CPython's GC starts when growing allocated object.
179183This means unpacking may cause useless GC.
180184You can use ``gc.disable() `` when unpacking large message.
181185
182- use_list
183- ^^^^^^^^^
186+ ` use_list ` option
187+ ^^^^^^^^^^^^^^^^^^
184188List is the default sequence type of Python.
185189But tuple is lighter than list.
186190You can use ``use_list=False `` while unpacking when performance is important.
@@ -190,13 +194,12 @@ Python's dict can't use list as key and MessagePack allows array for key of mapp
190194Another way to unpacking such object is using ``object_pairs_hook ``.
191195
192196
193- TEST
197+ Test
194198----
195199MessagePack uses `pytest ` for testing.
196200Run test with following command:
197201
198202 $ py.test
199203
200-
201204..
202205 vim: filetype=rst
0 commit comments