{ "info": { "author": "Matt Giles", "author_email": "matt.s.giles@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# mujson\n\n`mujson` lets python libraries make use of the most performant JSON functions available at import time. It is small, and does not itself implement any encoding or decoding functionality.\n\n## installation\n\nInstall with:\n\n``` shell\n$ pip install --upgrade mujson\n```\n\n## rationale\n\nJSON decoding and encoding is a common application bottleneck, and a variety of \"fast\" substitutes for the standard library's `json` exist, typically implemented in C. This is great for projects which can fine tune their dependency trees, but third party libraries are often forced to rely on the standard library so as to avoid superfluous or expensive requirements.\n\nIt is common for libraries to use guarded imports (i.e. `try... except` logic), hoping to find some better JSON implementation available. But this approach is sub-optimal. There are many python JSON libraries, and the relative performance of these varies between encoding and decoding, as well as between Python 2 and 3.\n\n`mujson` just uses the most performant JSON functions available, with the option to specify what JSON implementations are best for your project. It may also be of use to developers who don't always want to worry about compiling C extensions, but still want performance in production.\n\n## usage\n\nFor simple usage:\n\n```python\nimport mujson as json\n\njson.loads(json.dumps({'hello': 'world!'}))\n```\n\nTo customize the ranked preference of JSON libraries, including libraries not contemplated by `mujson`:\n\n``` python\nfrom mujson import mujson_function\n\nFAST_JSON_LIBS = ['newjsonlib', 'orjson', 'ujson', 'rapidjson', 'yajl']\n\nfast_dumps = mujson_function('fast_dumps', ranking=FAST_JSON_LIBS)\n```\n\n`mujson` implements one additional set of custom mujson functions, called \"compliant\". These functions use a ranking that excludes JSON libraries that do not support the function signatures supported by corresponding functions in the standard library.\n\n```python\nimport logging\n\nfrom mujson import compliant_dumps\nfrom pythonjsonlogger import jsonlogger\n\nlogger = logging.getLogger()\n\nlogHandler = logging.StreamHandler()\n# NOTE: we use `compliant_dumps` because the `JsonFormmatter` makes use of\n# kwargs like `cls` and `default` which not all json libraries support. (This\n# would not strictly be a concern if this was the only use of mujson in a given\n# application, but better safe than sorry.)\nformatter = jsonlogger.JsonFormatter(json_serializer=compliant_dumps)\nlogHandler.setFormatter(formatter)\nlogger.addHandler(logHandler)\n```\n\n## default rankings\n\n`mujson`'s default rankings are scoped to function and python version. The default rankings are based on the benchmarked performance of common JSON libraries encoding and decoding the JSON data in [bench/json](bench/json). [`bench/json/tweet.json`](bench/json/tweet.json) was given the most weight, under the assumption that it most closely resembles common application data.\n\n### python 3\n\n| library | dumps | dump | loads | load | compliant |\n|:------------------------------------------------------------------|:-----:|:----:|:-----:|:----:|:---------:|\n| [orjson](https://github.com/ijl/orjson) | 1st | | 1st | | no |\n| [metamagic.json](https://github.com/sprymix/metamagic.json) | 2nd | | | | no |\n| [ujson](https://github.com/esnme/ultrajson) | 4th | 2nd | 2nd | 1st | no |\n| [rapidjson](https://github.com/python-rapidjson/python-rapidjson) | 3rd | 1st | 4th | 3rd | yes |\n| [simplejson](https://github.com/simplejson/simplejson) | 8th | 6th | 3rd | 2nd | yes |\n| [json](https://docs.python.org/3.6/library/json.html) | 6th | 4th | 5th | 4th | yes |\n| [yajl](https://github.com/rtyler/py-yajl) | 5th | 3rd | 7th | 6th | yes |\n| [nssjson](https://github.com/lelit/nssjson) | 7th | 5th | 6th | 5th | yes |\n\n### python 2\n\n| library | dumps | dump | loads | load | compliant |\n|:-------------------------------------------------------|:-----:|:----:|:-----:|:----:|:---------:|\n| [ujson](https://github.com/esnme/ultrajson) | 1st | 1st | 2nd | 1st | no |\n| [cjson](https://github.com/AGProjects/python-cjson) | 4th | | 1st | | no |\n| [yajl](https://github.com/rtyler/py-yajl) | 2nd | 2nd | 5th | 4th | yes |\n| [simplejson](https://github.com/simplejson/simplejson) | 6th | 5th | 3rd | 2nd | yes |\n| [nssjson](https://github.com/lelit/nssjson) | 5th | 4th | 4th | 3rd | yes |\n| [json](https://docs.python.org/2/library/json.html) | 3rd | 3rd | 6th | 5th | yes |\n\n### PyPy\n\nWhen [PyPy](https://pypy.org/) is used, `mujson` simply falls back to the standard library's `json`, as it currently outperforms all third party libaries.\n\n## running benchmarks\n\nYou can build the python 3 benchmarking environment from within the bench directory with something like:\n\n``` shell\n$ docker build -t mujson-bench:py3 -f py3.Dockerfile .\n```\n\nAnd you can run the benchmark against any of the provided json files:\n\n``` text\n$ docker run -it mujson-bench:py3 1000 apache.json\n\n***************************************************************************\n\nrapidjson decoded apache.json 1000 times in 1602.057653999509 milliseconds\nsimplejson decoded apache.json 1000 times in 1034.323225998378 milliseconds\nnssjson decoded apache.json 1000 times in 1100.1701329987554 milliseconds\njson decoded apache.json 1000 times in 1170.220017000247 milliseconds\nyajl decoded apache.json 1000 times in 1224.6836369995435 milliseconds\nujson decoded apache.json 1000 times in 971.0670500026026 milliseconds\nmujson decoded apache.json 1000 times in 966.8092329993669 milliseconds\n\n***************************************************************************\n\nsimplejson encoded apache.json 1000 times in 2175.9825850022025 milliseconds\nnssjson encoded apache.json 1000 times in 2175.597892000951 milliseconds\njson encoded apache.json 1000 times in 1711.0415339993779 milliseconds\nyajl encoded apache.json 1000 times in 1038.154541998665 milliseconds\nujson encoded apache.json 1000 times in 789.5985149989428 milliseconds\nrapidjson encoded apache.json 1000 times in 616.3629779985058 milliseconds\nmetamagic.json encoded apache.json 1000 times in 357.27883399886196 milliseconds\nmujson encoded apache.json 1000 times in 364.98578699684003 milliseconds\n\n***************************************************************************\n\nnssjson de/encoded apache.json 1000 times in 3245.4301819998363 milliseconds\nsimplejson de/encoded apache.json 1000 times in 3285.083388000203 milliseconds\njson de/encoded apache.json 1000 times in 2727.172070000961 milliseconds\nyajl de/encoded apache.json 1000 times in 2573.481614999764 milliseconds\nrapidjson de/encoded apache.json 1000 times in 2262.237699000252 milliseconds\nujson de/encoded apache.json 1000 times in 1749.4632090019877 milliseconds\nmujson de/encoded apache.json 1000 times in 1608.914870001172 milliseconds\n\n***************************************************************************\n```\n\n---\n\n_In computability theory, the **\u03bc** operator, minimization operator, or unbounded search operator searches for the least natural number with a given property._\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/mattgiles/mujson", "keywords": "json", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mujson", "package_url": "https://pypi.org/project/mujson/", "platform": "any", "project_url": "https://pypi.org/project/mujson/", "project_urls": { "Homepage": "https://github.com/mattgiles/mujson" }, "release_url": "https://pypi.org/project/mujson/1.4/", "requires_dist": null, "requires_python": "", "summary": "Use the fastest JSON functions available at import time.", "version": "1.4" }, "last_serial": 4690851, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2f266f31366b8724153cd5e4081b0313", "sha256": "8661f4a69ebce9dfd0929dec864ba47716670776b9cb1f79f361b3d1d8d8ebe6" }, "downloads": -1, "filename": "mujson-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2f266f31366b8724153cd5e4081b0313", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9728, "upload_time": "2018-02-15T17:18:00", "url": "https://files.pythonhosted.org/packages/b0/32/7fc23975b4d55749772b3c80b4d65c4cdd483d0bdc56cbe571c60d15a8a1/mujson-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b32840e789e7423e45fbbaa980eb3377", "sha256": "f0d5d1cc088d0ecf48d3649122dc332ec05214f2371b62494f32325ae9f2b4db" }, "downloads": -1, "filename": "mujson-0.1.tar.gz", "has_sig": false, "md5_digest": "b32840e789e7423e45fbbaa980eb3377", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6038, "upload_time": "2018-02-15T17:18:02", "url": "https://files.pythonhosted.org/packages/e2/ca/f1df47d71cd783bcb8be2205ed97d78bdf87f70c2a7b930246f061319fbb/mujson-0.1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "fc5a6652338f60e1e4f56ad16383532d", "sha256": "b72936cd10872f9d427422237cf99b2eaed10081ff70c0f3dc97a1b752ff5c6b" }, "downloads": -1, "filename": "mujson-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fc5a6652338f60e1e4f56ad16383532d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9934, "upload_time": "2018-07-22T18:20:09", "url": "https://files.pythonhosted.org/packages/95/69/0ee2dc1db6c66d83dfa71a4d7624eba4c88bf5727c28fd4de758688ce795/mujson-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c3bf8455d5f6354a6b09b41d1d31b9fc", "sha256": "65d2b7c38309e166ad4482c22960a78885320ede3de627b8fed9e61af6b8e962" }, "downloads": -1, "filename": "mujson-1.0.tar.gz", "has_sig": false, "md5_digest": "c3bf8455d5f6354a6b09b41d1d31b9fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6200, "upload_time": "2018-07-22T18:20:10", "url": "https://files.pythonhosted.org/packages/3f/16/3511b55001851484b84b9eef3a1c04943b99eec9763599a7011cbce419db/mujson-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "882018b146c87327b9ebd476cd65d298", "sha256": "a18844c7cde19da8e0a5bc24187bf90a1eb3c8893a97b0c2d8f5a0e8ce64f24c" }, "downloads": -1, "filename": "mujson-1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "882018b146c87327b9ebd476cd65d298", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10248, "upload_time": "2018-08-19T04:23:06", "url": "https://files.pythonhosted.org/packages/df/da/53306ce3572e31ad63248514f9f01c125aad425fdcf9d642e28b030007c0/mujson-1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0f868110de456f4768a066cb18c9ca99", "sha256": "e0e835aebb969cdfbf7d57dcac743ceea2b1e89dee001dfb67fea786e9a948fa" }, "downloads": -1, "filename": "mujson-1.1.tar.gz", "has_sig": false, "md5_digest": "0f868110de456f4768a066cb18c9ca99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6390, "upload_time": "2018-08-19T04:23:08", "url": "https://files.pythonhosted.org/packages/ce/06/f65640be02ba84daa1692fbfce76833ccd2deb7ac3bc4b9d8758dd0fbebc/mujson-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "4aab83ae7d5a14c8c9c47750f8707e60", "sha256": "186bbdda76dee082a4875dfd8fd15a7c5e2d35956ac64c5c807e80b73ef23fc4" }, "downloads": -1, "filename": "mujson-1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4aab83ae7d5a14c8c9c47750f8707e60", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10291, "upload_time": "2018-08-19T05:25:20", "url": "https://files.pythonhosted.org/packages/45/ba/42e7742b097fcff092531df9ac34fa1519033b269c5979e137245d5601e8/mujson-1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d7f4e2cd6a42293eb70965346588786b", "sha256": "2a37c9bbae3a6b8cff49c26e2d56d4aa0ef561c7eaafa3f56ceb147b1414585a" }, "downloads": -1, "filename": "mujson-1.2.tar.gz", "has_sig": false, "md5_digest": "d7f4e2cd6a42293eb70965346588786b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6434, "upload_time": "2018-08-19T05:25:21", "url": "https://files.pythonhosted.org/packages/c9/44/bd8cac4624e23123ce281ee936f1358a206ceaf9ef748fcc4cfcfd3f4b4b/mujson-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "5e0b7866e6ac5f6853b782c9dccc14f9", "sha256": "718f46dbd15f9bceaf1e84f4052eda58d90259b770ff47526c9fe2b6f852342e" }, "downloads": -1, "filename": "mujson-1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5e0b7866e6ac5f6853b782c9dccc14f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10292, "upload_time": "2018-08-19T06:04:12", "url": "https://files.pythonhosted.org/packages/44/84/ddc070e9b61a2ceecfeeb72994cb1275214aec3ddf80b4721337a0f73eba/mujson-1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "40e23d082da679e7254dde2bad39874d", "sha256": "12bffd80947322c44442db424583347a91b1806770fe021a0b8a6418ca2c1b9c" }, "downloads": -1, "filename": "mujson-1.3.tar.gz", "has_sig": false, "md5_digest": "40e23d082da679e7254dde2bad39874d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6445, "upload_time": "2018-08-19T06:04:14", "url": "https://files.pythonhosted.org/packages/17/15/3d4232898580165f1f879c4431d83ab1032960ddec504022f210351c9150/mujson-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "91494c201f5c6a15ee7725afc3d78a99", "sha256": "0afff92662370637d72101b7f23790d461eba5e76711b40a7f159252c7239f1f" }, "downloads": -1, "filename": "mujson-1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "91494c201f5c6a15ee7725afc3d78a99", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10531, "upload_time": "2019-01-13T14:25:14", "url": "https://files.pythonhosted.org/packages/27/07/7f7fd27c2dc17e7ef2cf9e19b606b03410c312b540ac9548f234f4a59516/mujson-1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9dcaa89fb1cefdb72f9e191c3be5319", "sha256": "27d9cf1b10e42d08dee8090bf5c7b036a990ed9fb4d135c112bde9ef51367271" }, "downloads": -1, "filename": "mujson-1.4.tar.gz", "has_sig": false, "md5_digest": "a9dcaa89fb1cefdb72f9e191c3be5319", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6572, "upload_time": "2019-01-13T14:25:16", "url": "https://files.pythonhosted.org/packages/05/70/02448a686b8e2e1b4a0beb7e4e14adc1d189c208f963719dae9043db9245/mujson-1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "91494c201f5c6a15ee7725afc3d78a99", "sha256": "0afff92662370637d72101b7f23790d461eba5e76711b40a7f159252c7239f1f" }, "downloads": -1, "filename": "mujson-1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "91494c201f5c6a15ee7725afc3d78a99", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10531, "upload_time": "2019-01-13T14:25:14", "url": "https://files.pythonhosted.org/packages/27/07/7f7fd27c2dc17e7ef2cf9e19b606b03410c312b540ac9548f234f4a59516/mujson-1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a9dcaa89fb1cefdb72f9e191c3be5319", "sha256": "27d9cf1b10e42d08dee8090bf5c7b036a990ed9fb4d135c112bde9ef51367271" }, "downloads": -1, "filename": "mujson-1.4.tar.gz", "has_sig": false, "md5_digest": "a9dcaa89fb1cefdb72f9e191c3be5319", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6572, "upload_time": "2019-01-13T14:25:16", "url": "https://files.pythonhosted.org/packages/05/70/02448a686b8e2e1b4a0beb7e4e14adc1d189c208f963719dae9043db9245/mujson-1.4.tar.gz" } ] }