Skip to content

Commit 288e820

Browse files
committed
prepare 0.2
1 parent 06ed24a commit 288e820

File tree

3 files changed

+70
-23
lines changed

3 files changed

+70
-23
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include setup.py
22
include COPYING
3+
include README.rst
34
recursive-include msgpack *.h *.c *.pyx *.cpp
45
recursive-include test *.py
5-
recursive-include test3 *.py

README.rst

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,83 @@ MessagePack Python Binding
33
===========================
44

55
:author: INADA Naoki
6-
:version: 0.1.0
7-
:date: 2009-07-12
6+
:version: 0.2.0
7+
:date: 2012-06-27
88

99
HOW TO USE
1010
-----------
11-
You can read document in docstring after `import msgpack`
11+
12+
one-shot pack & unpack
13+
^^^^^^^^^^^^^^^^^^^^^^
14+
15+
Use ``packb`` for packing and ``unpackb`` for unpacking.
16+
msgpack provides ``dumps`` and ``loads`` as alias for compatibility with
17+
``json`` and ``pickle``.
18+
19+
``pack`` and ``dump`` packs to file-like object.
20+
``unpack`` and ``load`` unpacks from file-like object.
21+
22+
>>> import msgpack
23+
>>> msgpack.packb([1, 2, 3])
24+
'\x93\x01\x02\x03'
25+
>>> msgpack.unpackb(_)
26+
(1, 2, 3)
27+
28+
29+
``unpack`` unpacks msgpack's array to Python's tuple.
30+
To unpack it to list, Use ``use_list`` option.
31+
32+
>>> msgpack.unpackb(b'\x93\x01\x02\x03', use_list=True)
33+
[1, 2, 3]
34+
35+
Read docstring for other options.
36+
37+
38+
streaming unpacking
39+
^^^^^^^^^^^^^^^^^^^
40+
41+
``Unpacker`` is "streaming unpacker". It unpacks multiple objects from one
42+
stream.
43+
44+
::
45+
46+
import msgpack
47+
from io import BytesIO
48+
49+
buf = BytesIO()
50+
for i in range(100):
51+
buf.write(msgpack.packb(range(i)))
52+
53+
buf.seek(0)
54+
55+
unpacker = msgpack.Unpacker()
56+
while True:
57+
data = buf.read(4)
58+
if not data:
59+
break
60+
unpacker.seed(buf.read(16))
61+
for unpacked in unpacker:
62+
print unpacked
1263

1364

1465
INSTALL
1566
---------
16-
Cython_ is required to build msgpack.
67+
You can use ``pip`` or ``easy_install`` to install msgpack::
1768

18-
.. _Cython: http://www.cython.org/
69+
$ easy_install msgpack-python
70+
or
71+
$ pip install msgpack-python
1972

20-
posix
21-
''''''
22-
You can install msgpack in common way.
23-
24-
$ python setup.py install
2573

2674
Windows
2775
''''''''
28-
MessagePack requires gcc currently. So you need to prepare
29-
MinGW GCC.
76+
msgpack provides some binary distribution for Windows.
77+
You can install msgpack without compiler with them.
78+
79+
When you can't use binary distribution, you need to install Visual Studio
80+
or Windows SDK on Windows. (NOTE: Visual C++ Express 2010 doesn't support
81+
amd64. Windows SDK is recommanded way to build amd64 msgpack without any fee.)
3082

31-
$ python setup.py build -c mingw32
32-
$ python setup.py install
3383

3484
TEST
3585
----

setup.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
# coding: utf-8
3-
version = (0, 1, 14, 'dev')
3+
version = (0, 2, 0, 'dev')
44

55
import os
66
import sys
@@ -59,13 +59,10 @@ def __init__(self, *args, **kwargs):
5959

6060

6161
desc = 'MessagePack (de)serializer.'
62-
long_desc = """MessagePack (de)serializer for Python.
63-
64-
What's MessagePack? (from http://msgpack.org/)
65-
66-
MessagePack is a binary-based efficient data interchange format that is
67-
focused on high performance. It is like JSON, but very fast and small.
68-
"""
62+
f = open('README.rst')
63+
long_desc = f.read()
64+
f.close()
65+
del f
6966

7067
setup(name='msgpack-python',
7168
author='INADA Naoki',

0 commit comments

Comments
 (0)