{ "info": { "author": "Simon Gomizelj", "author_email": "simon@vodik.xyz", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "======\ncerial\n======\n\n.. image:: https://travis-ci.org/vodik/cerial.svg?branch=master\n :target: https://travis-ci.org/vodik/cerial\n\nFast, simple, and more pythonic binary serializer library.\n\nCerial combines Python 3 features, Cython, and memory views to create\na fast and easy library for packing and unpacking binary structures.\n\nRemoves a lot of the boilerplate that sometimes ends up surrounding\nstruct when used for serialization.\n\n-------\nExample\n-------\n\nHere's a quick example of how to use cerial to handle a UDP packet.\nFirst we define the structure:\n\n.. code-block:: python\n\n >>> UDP = Struct('UDP',\n ... ('sport', 'uint16'),\n ... ('dport', 'uint16'),\n ... ('len', 'uint16'),\n ... ('csum', 'uint16'),\n ... endianness='!'\n ...)\n\nUnlike the builtin struct library, cerial needs the fields to be bound\nto a name. This is because we expose the binary structure with\ndictionary interface instead of as a tuple of values.\n\nNow that we have a structure defined, we can use to parse data:\n\n.. code-block:: python\n\n >>> data = bytearray(b'\\x08R\\x02\\x02\\x00w\\xa9k')\n >>> hdr = UDP.parse(data)\n >>> hdr\n \n\nWe can now inspect the binary structure:\n\n.. code-block:: python\n\n >>> hdr['csum']\n 43371\n >>> dict(hdr)\n {'csum': 43371, 'len': 119, 'sport': 2130, 'dport': 514}\n >>> bytes(hdr)\n b'\\x08R\\x02\\x02\\x00w\\xa9k'\n\nAnd we can also update individual fields, which will directly write to\nthe underlying memory view, no rendering step needed.\n\n.. code-block:: python\n\n >>> hdr['csum'] = 0xffff\n >>> data\n bytearray(b'\\x08R\\x02\\x02\\x00w\\xff\\xff')\n >>> bytes(hdr)\n b'\\x08R\\x02\\x02\\x00w\\xff\\xff'\n\n----\nTODO\n----\n\n- Feature parity with the various primitives the struct library\n supports\n- First class support for bit fields\n- Improve performance\n- Support readonly memoryviews (e.g. support bytes). An upstream\n Cython issue.\n\n-----------\nPerformance\n-----------\n\nCurrently slightly slower than the struct module, but as far as I can\ntell, significantly faster than other similar libraries like pypacker\nor scrapy at parsing packets.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vodik/cerial", "keywords": "", "license": "Apache 2", "maintainer": "", "maintainer_email": "", "name": "cerial", "package_url": "https://pypi.org/project/cerial/", "platform": "", "project_url": "https://pypi.org/project/cerial/", "project_urls": { "Homepage": "https://github.com/vodik/cerial" }, "release_url": "https://pypi.org/project/cerial/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Python3 serializer with memoryview support", "version": "0.0.1" }, "last_serial": 3130151, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1721baea5265e2ebd9ac743df8dc9bbc", "sha256": "e1ebf09b520c8d56c7a3b6079720ea3ee7101cdfccdf0257f590b3ba0a1702a4" }, "downloads": -1, "filename": "cerial-0.0.1.tar.gz", "has_sig": false, "md5_digest": "1721baea5265e2ebd9ac743df8dc9bbc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 471856, "upload_time": "2017-08-28T20:48:27", "url": "https://files.pythonhosted.org/packages/cb/05/80303e683fb34ab1161d46c32e2f446335c29d9abe7a5c1fe86072a510ab/cerial-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1721baea5265e2ebd9ac743df8dc9bbc", "sha256": "e1ebf09b520c8d56c7a3b6079720ea3ee7101cdfccdf0257f590b3ba0a1702a4" }, "downloads": -1, "filename": "cerial-0.0.1.tar.gz", "has_sig": false, "md5_digest": "1721baea5265e2ebd9ac743df8dc9bbc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 471856, "upload_time": "2017-08-28T20:48:27", "url": "https://files.pythonhosted.org/packages/cb/05/80303e683fb34ab1161d46c32e2f446335c29d9abe7a5c1fe86072a510ab/cerial-0.0.1.tar.gz" } ] }