{ "info": { "author": "James Liu", "author_email": "contact@jamessliu.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "# py-coders\n\nA simple set of symmetric strongly-typed encoder/decoder classes for serializing\nto and from byte-like objects. The intended use case for these is to allow for\ncomposable encoding of raw byte arrays, operations that may be common to systems\nworking with low level key-value stores (memcached/Redis/LMDB/etc) or passing\nbinary messages in message queues (e.g. Protocol Buffers as messages in RabbitMQ).\n\n## Usage\n\nCoders are meant to have a simple interface:\n\n * `Coder.encocde(obj)` to serialize objects to a bytes-like object.\n * `Coder.decode(buf)` to deserialize objects from a byte-like object.\n\n## Supported Base Coders\n\n * `IdentityCoder` - passes bytes through unchanged.\n * `StringCoder` - string objects, supports `ascii`, `utf8`, `utf16`, etc.\n encodings.\n * `IntCoder`, `UInt16Coder`, `UInt32Coder`, `UInt64Coder` - general or unsigned\n 16/32/64 bit integers. (Big-endian)\n * `JSONCoder` - JSON serializable python object\n * `PickleCoder` - Any picklable Python object.\n * `ProtobufCoder` - Google Protobuf objects. Requires `protobuf` to be\n installed.\n\n## Chaining Coders\n\nCoders can be chained sequentially to create sequences of encoding/decoding. For\nexample, to make a Coder that can encode and decode encrypted compressed JSON\nblobs, the following code can be used:\n\n```python\ncompressed_json_coder = ChainCoder([\n JSONCoder(),\n ZlibCoder(level=5),\n EncryptedCoder(AES.new(...))\n ])\n```\n\nThis chaining is pretty common in creating composite Coders so all Coders have a\n`then` function that can be used in a fluent API.\n\n```python\ncompressed_json_coder = JSONCoder().then(ZlibCoder(level=5)) \\\n .then(EncryptedCoder(AES.new(...)))\n```\n\nThree special use cases, prefixing, compression, and encryption have further\nshortcuts to reduce repitition.:\n\n```python\nprefixed_int_coder = IntCoder().prefixed(prefix=b'users:')\ncompressed_json_coder = JSONCoder().compressed(level=5).encrypted(AES.new(...))\n```\n\nNote: what is shown here as an example may not be entirely seucre. It's meant as\nan example of what can be done with the API, not what should be done. Compressing\nthen encrypting data may weaken security depending on the context in which it's\nused.\n\n## Sequence / Stream Processing\n\nCoders support encoding/decoding arbitrary streams of data via `Coder.encode_all`\nand `Coder.decode_all`. These operations use generator expressions, so they can\noperate on arbitrarily long, possilby infinite streams of data.\n\n```python\njson_coder = JSONCoder().compressed(level=5)\n\n# Works with normal iterables\njson_blobs = json_coder.encode_all([{\"name\": \"object_1\"}, {\"name\": \"object_2\"}])\n\n# Can run over infinite streams of inputs.\nfor messages in json_coder.decode_all(input_stream()):\n // Handle messages\n```\n\nAsync iterators are also supported via the `Coder.encode_all_async` and\n`Coder.decode_all_async` alternatives.\n\n```python\njson_coder = JSONCoder().compressed(level=5)\n\n# Can run over infinite streams of inputs.\nasync for messages in json_coder.decode_all(async_input_stream()):\n // Handle messages\n```\n\nError handling can be done without terminating the stream by providing a\n`on_error` parameter.\n\n```python\njson_coder = JSONCoder().compressed(level=5)\n\ndef json_on_error(msg, exc, exc_type, traceback):\n // handle decoding errors here\n\n# Can run over infinite streams of inputs.\nasync for messages in json_coder.decode_all(async_input_stream(),\n on_error=json_on_error):\n // Handle messages\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/james7132/py-coders", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "py-coders", "package_url": "https://pypi.org/project/py-coders/", "platform": "", "project_url": "https://pypi.org/project/py-coders/", "project_urls": { "Homepage": "https://github.com/james7132/py-coders" }, "release_url": "https://pypi.org/project/py-coders/1.1.5/", "requires_dist": null, "requires_python": "", "summary": "A simple set of symmetric encoder/decoder classes for serializing to and from bytearrays.", "version": "1.1.5" }, "last_serial": 5911599, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "074f13c928586e65bfeb987cc2f8a6fc", "sha256": "6b19a45094d5cb31d22a6aba76acba480c70123082c2ac06314823d018e01b48" }, "downloads": -1, "filename": "py_coders-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "074f13c928586e65bfeb987cc2f8a6fc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4839, "upload_time": "2018-11-01T09:59:31", "url": "https://files.pythonhosted.org/packages/66/9b/4eab4d2ca902d266d044d58b4db43703dcb5cfb68493bbcaf6e07f365c64/py_coders-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cabc44b2b069c98e92b87c0b941d1e97", "sha256": "0f71707ccba6492c6270651ad2478a93ff65e990b7be34a5ad0a41d2280b4aa0" }, "downloads": -1, "filename": "py-coders-1.0.0.tar.gz", "has_sig": false, "md5_digest": "cabc44b2b069c98e92b87c0b941d1e97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3376, "upload_time": "2018-11-01T09:59:32", "url": "https://files.pythonhosted.org/packages/98/71/053b90b5c6f1ab4ea9125229bccbd4c437a55b88feca6a6936392e0b5960/py-coders-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "94adb794fb838fb90fc98bb174355e57", "sha256": "05174602b1cbd2df981f8c7b522dba1ffc3a741f6fa080db5a8d6682af3e5c6a" }, "downloads": -1, "filename": "py_coders-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "94adb794fb838fb90fc98bb174355e57", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7490, "upload_time": "2019-09-25T01:05:40", "url": "https://files.pythonhosted.org/packages/70/8f/a391cb67f0389629f1148088d46b3df0642ae0023fe830718be74e10bd58/py_coders-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a2a06e4fdfad365fdbffd5379df2527c", "sha256": "3670900d09166c3b4fab38fd633efe6d9dacea3973dcdb2e75030796ac07859f" }, "downloads": -1, "filename": "py-coders-1.1.0.tar.gz", "has_sig": false, "md5_digest": "a2a06e4fdfad365fdbffd5379df2527c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6165, "upload_time": "2019-09-25T01:05:42", "url": "https://files.pythonhosted.org/packages/b8/26/bc4218c1c4d47ea4b5bd98206496ad2fb6a1bd41b1a08b48bd2e4887e5f3/py-coders-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "1048891ec709f7e7e1133aca32839134", "sha256": "548a7a2db956ebcc243b01065099d085b5b6fa2c3cab638786fe9617eb8e1749" }, "downloads": -1, "filename": "py_coders-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1048891ec709f7e7e1133aca32839134", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7492, "upload_time": "2019-09-25T09:37:26", "url": "https://files.pythonhosted.org/packages/fc/d5/45d12c27936d0ebce2374e27687e3442dcd6fa3f796a6a6ae6e6705fb413/py_coders-1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e8c6b7cd568cd79ed2d60632ae7fd7a2", "sha256": "a5792c826ef013f0f43a7905ecf1fe4ea92e713f01e2e57497bb48f1df43deec" }, "downloads": -1, "filename": "py-coders-1.1.1.tar.gz", "has_sig": false, "md5_digest": "e8c6b7cd568cd79ed2d60632ae7fd7a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6148, "upload_time": "2019-09-25T09:37:27", "url": "https://files.pythonhosted.org/packages/79/67/d1ae5fe8275132372f38bf021e67d7d27b1da5001f3271a6ce6cbc6d27ae/py-coders-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "7b806b4a826232bfd92e9dd6b986a60c", "sha256": "f9e205f09206505c853a1c0d69cedc99345cbe85b8505793a5e6ddf3279f2b83" }, "downloads": -1, "filename": "py_coders-1.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7b806b4a826232bfd92e9dd6b986a60c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7495, "upload_time": "2019-09-25T09:44:02", "url": "https://files.pythonhosted.org/packages/73/bd/b71fd98f2332bea83087a77703600b3f47b306dd8c4a3c39df023b0cc4f0/py_coders-1.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd32a38a168e68feb58a80cddf780f2c", "sha256": "48524e18d5a4a234051898282a779dcb41176668007f7bf1981ab4620c8df862" }, "downloads": -1, "filename": "py-coders-1.1.2.tar.gz", "has_sig": false, "md5_digest": "fd32a38a168e68feb58a80cddf780f2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6150, "upload_time": "2019-09-25T09:44:04", "url": "https://files.pythonhosted.org/packages/25/eb/0470124f059537990ebcfe1bbae5f2d4f2e6b80ed72b267c5e0a10ba4d67/py-coders-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "9812677e356c4b2c670a751846eacf55", "sha256": "94b3f296ec88cdde24db1f2b0cd1d724f1c7b6b56dc74593a9fb0a0d9ce47608" }, "downloads": -1, "filename": "py_coders-1.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9812677e356c4b2c670a751846eacf55", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7495, "upload_time": "2019-09-25T09:49:12", "url": "https://files.pythonhosted.org/packages/15/89/7b0ae1714a4c30fcb876558c10c08508e8d55a5f31b6b825419cba2de32d/py_coders-1.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "74f6f7457e1bbcffc337ad3569e7742c", "sha256": "121ea8da93d47298f3932bc97393ba3fc0c985fc45018525c56e477be49ed569" }, "downloads": -1, "filename": "py-coders-1.1.3.tar.gz", "has_sig": false, "md5_digest": "74f6f7457e1bbcffc337ad3569e7742c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6153, "upload_time": "2019-09-25T09:49:13", "url": "https://files.pythonhosted.org/packages/5c/a1/ddd72fde88b5b80ebc540a2e2670bd5912d7fda7655b117ce1c6703e6077/py-coders-1.1.3.tar.gz" } ], "1.1.4": [ { "comment_text": "", "digests": { "md5": "fe3d3fd812c418471c4b71d765cda5c3", "sha256": "06a365ceda656a825b5167f58826733039694f82159ea92ed76e58c71f475eb8" }, "downloads": -1, "filename": "py_coders-1.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "fe3d3fd812c418471c4b71d765cda5c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7504, "upload_time": "2019-09-25T09:56:06", "url": "https://files.pythonhosted.org/packages/3e/3d/f651f59366e6e2edd619e53d577d85285e65367060af112632a8bdfe5e0d/py_coders-1.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6470f3bc74397b998639ce991968ad89", "sha256": "c4f6e05969f83be160f9104c94230b4c073da9d56d81f2c20db6c37d64cdcc00" }, "downloads": -1, "filename": "py-coders-1.1.4.tar.gz", "has_sig": false, "md5_digest": "6470f3bc74397b998639ce991968ad89", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6165, "upload_time": "2019-09-25T09:56:08", "url": "https://files.pythonhosted.org/packages/a7/07/92c2262411c16f9073680f18ba0b16c6a34794b9022e4a98b20021fd2156/py-coders-1.1.4.tar.gz" } ], "1.1.5": [ { "comment_text": "", "digests": { "md5": "92594937e1f87e8fb46381818566b7e7", "sha256": "c5039369db66b4debea397a52835608e3f530c44a7a08674bda6e34938c6d916" }, "downloads": -1, "filename": "py_coders-1.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "92594937e1f87e8fb46381818566b7e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7514, "upload_time": "2019-10-01T10:52:47", "url": "https://files.pythonhosted.org/packages/e7/95/45fca645800132138385fc19bc8d88223d5a50246e0a29ab16b894936f0c/py_coders-1.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc5ef4575842d23581e43e613966a5d8", "sha256": "c3411195be43b7743ac990dabe07354154c962003f8c27b7df7c5e8fa617b238" }, "downloads": -1, "filename": "py-coders-1.1.5.tar.gz", "has_sig": false, "md5_digest": "dc5ef4575842d23581e43e613966a5d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6169, "upload_time": "2019-10-01T10:52:49", "url": "https://files.pythonhosted.org/packages/8a/20/a6d89a92c086b94604273b4a3ae541d38c208f1937a47e6505a534801ae2/py-coders-1.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "92594937e1f87e8fb46381818566b7e7", "sha256": "c5039369db66b4debea397a52835608e3f530c44a7a08674bda6e34938c6d916" }, "downloads": -1, "filename": "py_coders-1.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "92594937e1f87e8fb46381818566b7e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7514, "upload_time": "2019-10-01T10:52:47", "url": "https://files.pythonhosted.org/packages/e7/95/45fca645800132138385fc19bc8d88223d5a50246e0a29ab16b894936f0c/py_coders-1.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dc5ef4575842d23581e43e613966a5d8", "sha256": "c3411195be43b7743ac990dabe07354154c962003f8c27b7df7c5e8fa617b238" }, "downloads": -1, "filename": "py-coders-1.1.5.tar.gz", "has_sig": false, "md5_digest": "dc5ef4575842d23581e43e613966a5d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6169, "upload_time": "2019-10-01T10:52:49", "url": "https://files.pythonhosted.org/packages/8a/20/a6d89a92c086b94604273b4a3ae541d38c208f1937a47e6505a534801ae2/py-coders-1.1.5.tar.gz" } ] }