From 9d6147bd8fbc0b05bf759ba2ac26e3bcfb10086e Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Sun, 24 Nov 2013 15:50:00 -0800 Subject: [PATCH] add install instruction to READMEs --- README.md | 41 +++++++++++++++++++++++++++++++++++------ msgpack.org.md | 23 ++++++++++++++++++++--- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9a705e7..7894ea5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,23 @@ u-msgpack-python is a lightweight [MessagePack](http://msgpack.org/) serializer u-msgpack-python is written in pure Python and is currently distributed as a single file: [umsgpack.py](umsgpack.py) and on PyPI: https://pypi.python.org/pypi/u-msgpack-python +## Installation + +With pip: +``` text +$ pip install u-msgpack-python +``` + +With easy_install: +``` text +$ easy_install u-msgpack-python +``` + +or simply drop [umsgpack.py](https://raw.github.com/vsergeev/u-msgpack-python/master/umsgpack.py) into your project! +``` text +$ wget https://raw.github.com/vsergeev/u-msgpack-python/master/umsgpack.py +``` + ## Examples Basic Example: @@ -15,21 +32,32 @@ Basic Example: {u'compact': True, u'schema': 0} >>> ``` + A more complicated example: ``` python ->>> umsgpack.packb([1, True, False, 0xffffffff, {u"foo": b"\x80\x01\x02", u"bar": [1,2,3, {u"a": [1,2,3,{}]}]}, -1, 2.12345]) -'\x97\x01\xc3\xc2\xce\xff\xff\xff\xff\x82\xa3foo\xc4\x03\x80\x01\x02\xa3bar\x94\x01\x02\x03\x81\xa1a\x94\x01\x02\x03\x80\xff\xcb@\x00\xfc\xd3Z\x85\x87\x94' +>>> umsgpack.packb( \ + [1, True, False, 0xffffffff, {u"foo": b"\x80\x01\x02", \ + u"bar": [1,2,3, {u"a": [1,2,3,{}]}]}, -1, 2.12345] ) +'\x97\x01\xc3\xc2\xce\xff\xff\xff\xff\x82\xa3foo\xc4\x03\x80\x01 +\x02\xa3bar\x94\x01\x02\x03\x81\xa1a\x94\x01\x02\x03\x80\xff\xcb +@\x00\xfc\xd3Z\x85\x87\x94' >>> umsgpack.unpackb(_) -[1, True, False, 4294967295, {u'foo': '\x80\x01\x02', u'bar': [1, 2, 3, {u'a': [1, 2, 3, {}]}]}, -1, 2.12345] +[1, True, False, 4294967295, {u'foo': '\x80\x01\x02', \ + u'bar': [1, 2, 3, {u'a': [1, 2, 3, {}]}]}, -1, 2.12345] >>> ``` The more complicated example in Python 3: ``` python ->>> umsgpack.packb([1, True, False, 0xffffffff, {u"foo": b"\x80\x01\x02", u"bar": [1,2,3, {u"a": [1,2,3,{}]}]}, -1, 2.12345]) -b'\x97\x01\xc3\xc2\xce\xff\xff\xff\xff\x82\xa3foo\xc4\x03\x80\x01\x02\xa3bar\x94\x01\x02\x03\x81\xa1a\x94\x01\x02\x03\x80\xff\xcb@\x00\xfc\xd3Z\x85\x87\x94' +>>> umsgpack.packb( \ + [1, True, False, 0xffffffff, {u"foo": b"\x80\x01\x02", \ + u"bar": [1,2,3, {u"a": [1,2,3,{}]}]}, -1, 2.12345] ) +b'\x97\x01\xc3\xc2\xce\xff\xff\xff\xff\x82\xa3foo\xc4\x03\x80\x01 +\x02\xa3bar\x94\x01\x02\x03\x81\xa1a\x94\x01\x02\x03\x80\xff\xcb@ +\x00\xfc\xd3Z\x85\x87\x94' >>> umsgpack.unpackb(_) -[1, True, False, 4294967295, {'foo': b'\x80\x01\x02', 'bar': [1, 2, 3, {'a': [1, 2, 3, {}]}]}, -1, 2.12345] +[1, True, False, 4294967295, {'foo': b'\x80\x01\x02', \ + 'bar': [1, 2, 3, {'a': [1, 2, 3, {}]}]}, -1, 2.12345] >>> ``` @@ -50,6 +78,7 @@ Ext Object b'\x01\x02\x03' >>> ``` + ## Compatibility Mode u-msgpack-python offers a compatibility mode for the [old specification](https://github.com/msgpack/msgpack/blob/master/spec-old.md) "raw" bytes msgpack type. When the compatibility mode is enabled, u-msgpack-python will serialize both unicode strings and bytes into the "raw" msgpack type, and deserialize the "raw" msgpack type into bytes. To enable compatibility mode, simply set the `compatibility` boolean of the umsgpack module to `True`. diff --git a/msgpack.org.md b/msgpack.org.md index b5640ae..dee3141 100644 --- a/msgpack.org.md +++ b/msgpack.org.md @@ -2,7 +2,24 @@ u-msgpack-python is a lightweight [MessagePack](http://msgpack.org/) serializer and deserializer module, compatible with both Python 2 and Python 3. u-msgpack-python is fully compliant with the latest [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md). -u-msgpack-python is written in pure Python and is currently distributed as a single file: [umsgpack.py](https://github.com/vsergeev/u-msgpack-python/blob/master/umsgpack.py) +u-msgpack-python is written in pure Python and is currently distributed as a single file: [umsgpack.py](umsgpack.py) and on PyPI: https://pypi.python.org/pypi/u-msgpack-python + +## Installation + +With pip: +``` text +$ pip install u-msgpack-python +``` + +With easy_install: +``` text +$ easy_install u-msgpack-python +``` + +or simply drop [umsgpack.py](https://raw.github.com/vsergeev/u-msgpack-python/master/umsgpack.py) into your project! +``` text +$ wget https://raw.github.com/vsergeev/u-msgpack-python/master/umsgpack.py +``` ## Examples @@ -61,9 +78,9 @@ b'\x01\x02\x03' >>> ``` -## More Information +## More Information -See the [project page](https://github.com/vsergeev/u-msgpack-python) for more information on exceptions, behavior, and testing. +See the [project page](https://github.com/vsergeev/u-msgpack-python) for more information on old specification compatibility mode, exceptions, behavior, and testing. ## License