{ "info": { "author": "Marc Shapiro", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# read-protobuf\n\nSmall library to read serialized protobuf(s) directly into Pandas Dataframe.\n\nThis is meant to be a simple shortcut to getting from serialized protobuf bytes / files directly to a dataframe.\n\n>Note: This currently only supports basic proto3 features for Python 3. I have not yet tested it with proto2, though I believe that should work. I plan to expand the utility of this library with time and need.\n\n## Install\n\nAvailable via pip:\n\n```bash\n$ pip install read-protobuf\n```\n\n## Usage\n\nRun the [demo-notebook](tests/demo.ipynb) for an interactive demo.\n\n```python\nimport demo_pb2 # compiled protobuf message module \nfrom read_protobuf import read_protobuf\n\nMessageType = demo_pb2.MessageType() # instantiate a new message type\ndf = read_protobuf(b'\\x00\\x00', MessageType) # create a dataframe from serialized protobuf bytes\ndf = read_protobuf([b'\\x00\\x00', b'x00\\x00'] MessageType) # read multiple protobuf bytes\n\ndf = read_protobuf('demo.pb', MessageType) # use file instead of bytes\ndf = read_protobuf(['demo.pb', 'demo2.pb'], MessageType) # read multiple files\n\n# options\ndf = read_protobuf('demo.pb', MessageType, flatten=False) # don't flatten pb messages\ndf = read_protobuf('demo.pb', MessageType, prefix_nested=True) # prefix nested messages with parent keys (like pandas.io.json.json_normalize)\n```\n\n\nTo compile a protobuf Message class from python, use:\n\n```bash\n$ protoc --python_out=\".\" demo.proto\n```\n\n## Alternatives\n\n#### protobuf-to-dict\n\nhttps://github.com/benhodgson/protobuf-to-dict\n\nThis library was developed earlier to convert protobufs to JSON via a dict.\n\n#### JSON\n\nThe google protobuf library comes with a utility to convert messages to JSON. Then the JSON objects could be loaded into pands via `pd.read_json()`. \n\n```python\nfrom google.protobuf.json_format import MessageToJson\n```\n\nIn my brief tests, the `read_protobuf` package is about twice as fast as converting a protobuf to a dataframe using `MessageToJson`. \n\n## Develop\n\nCurrently developed for Python 3 using the anaconda python distribution. To install a development version of the package, run from the root directory:\n\n```bash\n$ pip install -e .\n```\n\n- To install development dependencies, use pip on the `dev-requirements.txt` file:\n\n```bash\n$ pip install -r dev-requirements.txt\n```\n\n## Lint\n\nUses `pylint` to lint application.\n\n```\n$ pylint read_protobuf\n```\n\nConfiguration options are specified in `.pylintrc`\n\n## Test\n\nUses `pytest` to run unit tests. From the root of the repository, run:\n\n```\n$ pytest\n$ pytest -k \"TestRead::test_read_bytes\" # specify test\n```\n\nConfiguration options are specified in `setup.cfg`\n\n## Code Coverage\n\nWe use `coverage` to monitor code coverage during tests. To record coverage while running tests, run:\n\n```bash\n$ coverage run -m pytest # watch files while testing\n$ coverage report # will display coverage report\n```\n\n\n## UnLicense\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mlshapiro/read-protobuf.git", "keywords": "protobuf,pandas", "license": "Public Domain", "maintainer": "", "maintainer_email": "", "name": "read-protobuf", "package_url": "https://pypi.org/project/read-protobuf/", "platform": "", "project_url": "https://pypi.org/project/read-protobuf/", "project_urls": { "Homepage": "https://github.com/mlshapiro/read-protobuf.git" }, "release_url": "https://pypi.org/project/read-protobuf/0.1.1/", "requires_dist": [ "pandas (>=0.16)", "protobuf (>=3.5)" ], "requires_python": ">=2.7", "summary": "Small library to read serialized protobuf(s) directly into Pandas Dataframe", "version": "0.1.1" }, "last_serial": 3739666, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a5e8755e1220c4741fe4468d4d3e4670", "sha256": "40a907166c6b6c41da5098ff5289273006e76f860436bedabbe59e73f6f5c266" }, "downloads": -1, "filename": "read_protobuf-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a5e8755e1220c4741fe4468d4d3e4670", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 3500, "upload_time": "2018-04-05T22:51:59", "url": "https://files.pythonhosted.org/packages/67/7b/21c91efad5cd34eb1b9b3c69521b55a178a4db447bd20bd36dbb42650412/read_protobuf-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2d33196ca96d9224091fa76f10148cad", "sha256": "65ddcddb94d5bd9d53331fd286b083d1c293ae5e820bdfd8a18b53f9d34a1b76" }, "downloads": -1, "filename": "read-protobuf-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2d33196ca96d9224091fa76f10148cad", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 6193, "upload_time": "2018-04-05T22:52:00", "url": "https://files.pythonhosted.org/packages/a1/5f/74a935cd86f6fe23ebf42c74d02aebfc40dcbdbb30da39d3f7e13b2ea848/read-protobuf-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ff87868cb880bc96ea17231d20e21638", "sha256": "394b7d064fe377c2bef0b36f05584a56ed332ffdf4d4d187f28af8190a6382f9" }, "downloads": -1, "filename": "read_protobuf-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ff87868cb880bc96ea17231d20e21638", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 7311, "upload_time": "2018-04-06T02:25:43", "url": "https://files.pythonhosted.org/packages/3c/27/1f2995cf2f06251faa917f87ce642673f820fd0d89cde379523ab34a0af7/read_protobuf-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "305ec2d8334ec929e7af3e7ad39d2aec", "sha256": "67cceb7463c36b076cd9572d30feb395ff41ed2065e683f487c561f4a395b364" }, "downloads": -1, "filename": "read-protobuf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "305ec2d8334ec929e7af3e7ad39d2aec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 7262, "upload_time": "2018-04-06T02:25:44", "url": "https://files.pythonhosted.org/packages/df/4e/25d836d95376c33b311f633dffae5f78cb36c342195c85a469d3fe5b0104/read-protobuf-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff87868cb880bc96ea17231d20e21638", "sha256": "394b7d064fe377c2bef0b36f05584a56ed332ffdf4d4d187f28af8190a6382f9" }, "downloads": -1, "filename": "read_protobuf-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ff87868cb880bc96ea17231d20e21638", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 7311, "upload_time": "2018-04-06T02:25:43", "url": "https://files.pythonhosted.org/packages/3c/27/1f2995cf2f06251faa917f87ce642673f820fd0d89cde379523ab34a0af7/read_protobuf-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "305ec2d8334ec929e7af3e7ad39d2aec", "sha256": "67cceb7463c36b076cd9572d30feb395ff41ed2065e683f487c561f4a395b364" }, "downloads": -1, "filename": "read-protobuf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "305ec2d8334ec929e7af3e7ad39d2aec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 7262, "upload_time": "2018-04-06T02:25:44", "url": "https://files.pythonhosted.org/packages/df/4e/25d836d95376c33b311f633dffae5f78cb36c342195c85a469d3fe5b0104/read-protobuf-0.1.1.tar.gz" } ] }