{ "info": { "author": "Kevin Wurster", "author_email": "wursterk@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "===========\nNewlineJSON\n===========\n\nStreaming newline delimited JSON I/O.\n\n.. image:: https://travis-ci.org/geowurster/NewlineJSON.svg?branch=master\n :target: https://travis-ci.org/geowurster/NewlineJSON?branch=master\n\n.. image:: https://coveralls.io/repos/geowurster/NewlineJSON/badge.svg?branch=master\n :target: https://coveralls.io/r/geowurster/NewlineJSON?branch=master\n\n\nExample\n=======\n\nCalling ``newlinejson.open()`` returns a file-like object that behaves like\nPython's ``io.TextIOWrapper``:\n\n.. code-block:: python\n\n import newlinejson as nlj\n\n with nlj.open('sample-data/dictionaries.json') as src, \\\n with nlj.open('out.json', 'w') as dst:\n for line in src:\n dst.write(line)\n\n with open('out.json') as f:\n print(f.read()))\n {'field2': 'l1f2', 'field3': 'l1f3', 'field1': 'l1f1'}\n {'field2': 'l2f2', 'field3': 'l2f3', 'field1': 'l2f1'}\n {'field2': 'l3f2', 'field3': 'l3f3', 'field1': 'l3f1'}\n {'field2': 'l4f2', 'field3': 'l4f3', 'field1': 'l4f1'}\n {'field2': 'l5f2', 'field3': 'l5f3', 'field1': 'l5f1'}\n\n\nCommand Line Interface\n======================\n\nRather than provide another utility, the CLI is accessed from ``python -m newlinejson``:\n\n.. code-block:: console\n\n $ python -m newlinejson --help\n Usage: newlinejson [OPTIONS] COMMAND [ARGS]...\n\n NewlineJSON commandline interface.\n\n Common simple ETL commands for homogeneous data.\n\n Options:\n --version Show the version and exit.\n --help Show this message and exit.\n\n Commands:\n csv2nlj Convert a CSV to newline JSON dictionaries.\n insp Open a file and launch a Python interpreter.\n nlj2csv Convert newline JSON dictionaries to a CSV.\n\nThe included utilities are for working with homogeneous data, meaning that every\nline has the same fields. The goal is to provide simple data translation tools\nrather than a more comprehensive suite.\n\n\nCan't I do everything this module does with one function?\n=========================================================\n\nPretty much - this is the simplest newline delimited JSON API:\n\n.. code-block:: python\n\n import json\n\n def reader(stream):\n for line in stream:\n yield json.loads(line)\n\n with open('sample-data/lists.json') as src, open('outfile.json', 'w') as dst:\n for line in reader(src):\n dst.write(json.dumps(line))\n\nBut it doesn't handle failures and every time it needs to be used it has to be\nre-written, which means it needs to be packaged, which means it needs unittests,\nmay as well be a little more Pythonic, and now we're back to this module. It's\neasier and more Pythonic to just ``import newlinejson`` and know that it will\nwork rather than solve the exact same problem multiple times.\n\n\nWhy is this better than MsgPack, Protobuf, or any other packed-binary format?\n=============================================================================\n\nIt probably isn't. If you're looking for a module to incorporate into a high\ncapacity data pipeline or bandwidth limited environment you definitely want a\npacked-binary format. If you're working with a small amount of local data to\nproduce a one-off product, proofing a workflow, or want to provide additional\nI/O capabilities to a commandline application reading/writing from/to stdin/stdout,\nthis module is pretty easy to work with.\n\nThe goal of this module is to fill a gap in the Python ecosystem in an easy to\nuse and intuitive manner, not to provide highly optimized I/O. If Python's\nbuilt-in JSON library isn't fast enough but newline delimited JSON is the right\nanswer to your problem, one of many faster JSON libraries can be used globally with\n``newlinejson.core.JSON_LIB = module`` or by setting ``json_lib=module`` as a keyword\nargument in ``open()``, ``load()``, etc.\n\n\nInstalling\n==========\n\nVia pip:\n\n.. code-block:: console\n\n $ pip install NewlineJSON\n\n>From master:\n\n.. code-block:: console\n\n $ git clone https://github.com/geowurster/NewlineJSON.git\n $ cd NewlineJSON\n $ python setup.py install\n\n\nDeveloping\n==========\n\nInstall:\n\n.. code-block:: console\n\n $ pip install virtualenv\n $ git clone https://github.com/geowurster/NewlineJSON\n $ cd NewlineJSON\n $ virtualenv venv\n $ source venv/bin/activate\n $ pip install -e .[test]\n $ py.test tests --cov newlinejson --cov-report term-missing\n $ pep8 --max-line-length=95 newlinejson\n\n\nLicense\n=======\n\nSee ``LICENSE.txt``\n\n\nChangelog\n=========\n\nSee ``CHANGES.md``", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/geowurster/NewlineJSON", "keywords": "streaming newline delimited json", "license": "New BSD", "maintainer": "", "maintainer_email": "", "name": "NewlineJSON", "package_url": "https://pypi.org/project/NewlineJSON/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/NewlineJSON/", "project_urls": { "Homepage": "https://github.com/geowurster/NewlineJSON" }, "release_url": "https://pypi.org/project/NewlineJSON/1.0/", "requires_dist": [ "six", "click (>=3.0); extra == 'all'", "pytest; extra == 'all'", "pytest-cov; extra == 'all'", "wheel; extra == 'all'", "click (>=3.0); extra == 'cli'", "pytest; extra == 'dev'", "pytest-cov; extra == 'dev'", "wheel; extra == 'dev'" ], "requires_python": "", "summary": "Streaming newline delimited JSON I/O.", "version": "1.0" }, "last_serial": 1733715, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "39e6df5753b1234df32b15798ab2c27a", "sha256": "61d881bc1017cf69a7bfc34ebaafae3ee4a2810861135d093a8dfce5184bdca7" }, "downloads": -1, "filename": "NewlineJSON-0.1.0.tar.gz", "has_sig": false, "md5_digest": "39e6df5753b1234df32b15798ab2c27a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11681, "upload_time": "2015-01-08T05:10:40", "url": "https://files.pythonhosted.org/packages/d7/f3/e6b464b76f7c37711094378f45ab500f19f415091853c6217dbd9d58b8d2/NewlineJSON-0.1.0.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "9c39a48382bfc8854f18c716b16d026d", "sha256": "b4062a16d4340b63f8272d598e948334e4a13fb7a4f9300c2be6be2413aa626f" }, "downloads": -1, "filename": "NewlineJSON-0.2.tar.gz", "has_sig": false, "md5_digest": "9c39a48382bfc8854f18c716b16d026d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6847, "upload_time": "2015-03-08T00:19:48", "url": "https://files.pythonhosted.org/packages/86/68/4f36ef06ec843db0960d3fd3371af21504554a274b4759c122fb1f5d8f50/NewlineJSON-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "c434e9db650b0f1c37fdec7f882c52f6", "sha256": "03855d5df44fe081fcdb5b9c9185f9841fcfa6002f63de53c0e1bff2b648f4f9" }, "downloads": -1, "filename": "NewlineJSON-0.3.tar.gz", "has_sig": false, "md5_digest": "c434e9db650b0f1c37fdec7f882c52f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12509, "upload_time": "2015-05-18T20:12:18", "url": "https://files.pythonhosted.org/packages/48/4d/356267268a73ea306dc2764f06b04234e17919b874cfeeb32302daadd4cf/NewlineJSON-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "612da28de8fa122d3309c71addda8e30", "sha256": "f3ea37e2b446328827da6573b1abb0b8c61e675fad5295929b1d16aad638430d" }, "downloads": -1, "filename": "NewlineJSON-0.3.1.tar.gz", "has_sig": false, "md5_digest": "612da28de8fa122d3309c71addda8e30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12619, "upload_time": "2015-05-20T16:05:17", "url": "https://files.pythonhosted.org/packages/54/aa/d02c379d886f1ef6a7ec8ef7ef88ec14971769385814a61b3cf1d1c895fb/NewlineJSON-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "8a1079b7a12375b563b52680524dc52b", "sha256": "17261a7bda14066ecb27dc8e7153ac5458d811e723a1806581ab1c769b521a73" }, "downloads": -1, "filename": "NewlineJSON-0.3.2.tar.gz", "has_sig": false, "md5_digest": "8a1079b7a12375b563b52680524dc52b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12567, "upload_time": "2015-05-22T00:50:04", "url": "https://files.pythonhosted.org/packages/80/cb/9f5d46329e6be9d2b489d9a5bb65f5b3e92bffe3ee985d22cc62aa98f094/NewlineJSON-0.3.2.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "1c454f73cbf389135aeace8550e825a4", "sha256": "433498a1d5b4c4d28bca8153dd8ce77f7ac68cfde57fa58a7a8c80a930ebfd41" }, "downloads": -1, "filename": "NewlineJSON-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1c454f73cbf389135aeace8550e825a4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12816, "upload_time": "2015-09-22T18:44:03", "url": "https://files.pythonhosted.org/packages/33/69/44ed82ab29d71c0365fbf5982fdce552304741b0463fb4ddf89790abb257/NewlineJSON-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ce893d710a8e574d4ab7f5737103cd7", "sha256": "4e483a6398a1956d7735471664dcd05f8218ccadb4d969fbc49166a3ae1434ba" }, "downloads": -1, "filename": "NewlineJSON-1.0.tar.gz", "has_sig": false, "md5_digest": "9ce893d710a8e574d4ab7f5737103cd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12325, "upload_time": "2015-09-22T18:44:12", "url": "https://files.pythonhosted.org/packages/ec/4c/04f0e60c8cc22581b1362a40e7c1342288517f0583aee221a49a50a075ef/NewlineJSON-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1c454f73cbf389135aeace8550e825a4", "sha256": "433498a1d5b4c4d28bca8153dd8ce77f7ac68cfde57fa58a7a8c80a930ebfd41" }, "downloads": -1, "filename": "NewlineJSON-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1c454f73cbf389135aeace8550e825a4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12816, "upload_time": "2015-09-22T18:44:03", "url": "https://files.pythonhosted.org/packages/33/69/44ed82ab29d71c0365fbf5982fdce552304741b0463fb4ddf89790abb257/NewlineJSON-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9ce893d710a8e574d4ab7f5737103cd7", "sha256": "4e483a6398a1956d7735471664dcd05f8218ccadb4d969fbc49166a3ae1434ba" }, "downloads": -1, "filename": "NewlineJSON-1.0.tar.gz", "has_sig": false, "md5_digest": "9ce893d710a8e574d4ab7f5737103cd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12325, "upload_time": "2015-09-22T18:44:12", "url": "https://files.pythonhosted.org/packages/ec/4c/04f0e60c8cc22581b1362a40e7c1342288517f0583aee221a49a50a075ef/NewlineJSON-1.0.tar.gz" } ] }