{
"info": {
"author": "Omoto Kenji",
"author_email": "",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: JavaScript",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7"
],
"description": "pyjq: Binding for jq JSON Processor\n===================================\n\n[](https://circleci.com/gh/doloopwhile/pyjq)\n\npyjq is a Python bindings for jq ().\n\n> jq is like sed for JSON data \u2013 you can use it to slice and filter and\n> map and transform structured data with the same ease that sed, awk,\n> grep and friends let you play with text.\n>\n> \n\nYou can seamlessly call jq script (like regular expression) and process\nplain python data structure.\n\nFor your information, is a also jq\nbindings but different and incompatible with pyjq.\n\nExample\n-------\n\n```python\n>>> data = dict(\n... parameters= [\n... dict(name=\"PKG_TAG_NAME\", value=\"trunk\"),\n... dict(name=\"GIT_COMMIT\", value=\"master\"),\n... dict(name=\"TRIGGERED_JOB\", value=\"trunk-buildall\")\n... ],\n... id=\"2013-12-27_00-09-37\",\n... changeSet=dict(items=[], kind=\"git\"),\n... )\n>>> import pyjq\n>>> pyjq.first('.parameters[] | {\"param_name\": .name, \"param_type\":.type}', data)\n{'param_type': None, 'param_name': 'PKG_TAG_NAME'}\n```\n\nInstall\n-------\n\nIt requires build tools such as make, automake, libtool, etc...\n\nYou can install from PyPI by usual way.\n\n pip install pyjq\n\nAPI\n---\n\nFor jq script, [see its manual](http://stedolan.github.io/jq/manual/).\n\nOnly four APIs are provided:\n\n- `all`\n- `first`\n- `one`\n- `compile`\n\n`all` transforms a value by JSON script and returns all results as a list.\n\n```python\n>>> value = {\"user\":\"stedolan\",\"titles\":[\"JQ Primer\", \"More JQ\"]}\n>>> pyjq.all('{user, title: .titles[]}', value)\n[{'user': 'stedolan', 'title': 'JQ Primer'}, {'user': 'stedolan', 'title': 'More JQ'}]\n```\n\n`all` takes an optional argument `vars`.\n`vars` is a dictonary of predefined variables for `script`.\nThe values in `vars` are avaiable in the `script` as a `$key`.\nThat is, `vars` works like `--arg` option and `--argjson` option of jq command.\n```python\n>>> pyjq.all('{user, title: .titles[]} | select(.title == $title)', value, vars={\"title\": \"More JQ\"})\n[{'user': 'stedolan', 'title': 'More JQ'}]\n```\n\n`all` takes an optional argument `url`.\nIf `url` is given, the subject of transformation is got from the `url`.\n\n```python\n>> pyjq.all(\".[] | .login\", url=\"https://api.github.com/repos/stedolan/jq/contributors\") # get all contributors of jq\n['nicowilliams', 'stedolan', 'dtolnay', ... ]\n```\n\nAdditionally, `all` takes an optional argument `opener`.\nThe default `opener` will simply download contents by `urllib.request.urlopen` and decode by `json.decode`.\nHowever, you can customize this behavior using custom `opener`.\n\n`first` is almost some to `all` but it `first` returns the first result of transformation.\n\n```python\n>>> value = {\"user\":\"stedolan\",\"titles\":[\"JQ Primer\", \"More JQ\"]}\n>>> pyjq.all('{user, title: .titles[]}', value)\n[{'user': 'stedolan', 'title': 'JQ Primer'}, {'user': 'stedolan', 'title': 'More JQ'}]\n```\n\n`first` returns `default` when there are no results.\n\n```python\n>>> value = {\"user\":\"stedolan\",\"titles\":[\"JQ Primer\", \"More JQ\"]}\n>>> pyjq.first('.titles[] | select(test(\"e\"))', value) # The first title which is contains \"e\"\n'JQ Primer'\n```\n\n`first` returns the first result of transformation. It returns `default` when there are no results.\n\n```python\n>>> value = {\"user\":\"stedolan\",\"titles\":[\"JQ Primer\", \"More JQ\"]}\n>>> pyjq.first('.titles[] | select(test(\"T\"))', value, \"Third JS\") # The first title which is contains \"T\"\n'Third JS'\n```\n\n`one` do also returns the first result of transformation but raise Exception if there are no results.\n\n```python\n>>> value = {\"user\":\"stedolan\",\"titles\":[\"JQ Primer\", \"More JQ\"]}\n>>> pyjq.one('.titles[] | select(test(\"T\"))', value)\nIndexError: Result of jq is empty\n```\n\nLimitation\n----------\n\njq is a JSON Processor. Therefore pyjq is able to process only\n\"JSON compatible\" data (object made only from str, int, float, list, dict).\n\nQ&A\n---\n\n### How can I process json string got from API by pyjq?\n\nYou should apply `json.loads` in the standard library before pass to pyjq.\n\nAuthor\n------\n[OMOTO Kenji](https://github.com/doloopwhile)\n\nLicense\n-------\n\nReleased under the MIT license. See LICENSE for details.\n\nDevelopment\n-----------\n\n## Pipenv\n\nThis project uses [Pipenv](https://docs.pipenv.org/en/latest/) to manage dependencies.\n\nPlease install development tools with folloing command:\n\n```python\npipenv install --dev -e\n```\n\n## We DO commit `_pyjq.c`\n\nWhen you edit `_pyjq.pyx`, you need to run `pipenv run cython _pyjq.pyx` before to run `pipenv run python setup.py develop`.\nIt is because `setup.py` in this project does not compile .pyx to .c.\n\nOf course, we can use `Cython.Build.cythonize` in setup.py to automatically compile .pyx to .c .\nBut, it cause bootstrap problem in ``pip install``.\n\nSo, we DO commit both of `_pyjq.pyx` and `_pyjq.c`.\n\nLicense\n-------\nMIT License. See [LICENSE](./LICENSE).\n\nThis package includes [jq](https://github.com/stedolan/jq) and [oniguruma](https://github.com/kkos/oniguruma). Their license files are included in archive files.\n\n- jq: `dependencies/jq-1.5.tar.gz`\n- oniguruma: `dependencies/onig-6.9.0.tar.gz`\n\nChangelog\n---------\n\n### 2.4.0\n\n- Dropped support for Python 2.7, 3.4, 3.5 (Supports only 3.6+).\n\n### 2.3.0\n\n- Supported WindowsPE(msys)\n\n### 2.2.0\n\n- Added `library_paths=` option.\n\n### 2.1.0\n\n- API's translate JS object not to `dict` but to `collections.OrderedDict`.\n\n### 2.0.0\n\n- Semantic versioning.\n- Bundle source codes of jq and oniguruma.\n- Supported Python 3.5.\n- Dropped support for Python 3.2.\n- Aeded `all` method.\n\n### 1.0\n\n- First release.\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": "http://github.com/doloopwhile/pyjq",
"keywords": "jq",
"license": "MIT License",
"maintainer": "",
"maintainer_email": "",
"name": "pyjq",
"package_url": "https://pypi.org/project/pyjq/",
"platform": "",
"project_url": "https://pypi.org/project/pyjq/",
"project_urls": {
"Homepage": "http://github.com/doloopwhile/pyjq"
},
"release_url": "https://pypi.org/project/pyjq/2.4.0/",
"requires_dist": null,
"requires_python": "",
"summary": "Binding for jq JSON processor.",
"version": "2.4.0"
},
"last_serial": 5848300,
"releases": {
"1.0": [
{
"comment_text": "",
"digests": {
"md5": "9fa52399691d3989f262d36c4e5b66da",
"sha256": "fc06f90a351ebb05e7ab6c12bb769d7771a0d76df6eb07ea00de137e67c348b5"
},
"downloads": -1,
"filename": "pyjq-1.0.tar.gz",
"has_sig": false,
"md5_digest": "9fa52399691d3989f262d36c4e5b66da",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 60081,
"upload_time": "2014-01-08T16:55:48",
"url": "https://files.pythonhosted.org/packages/14/c8/03bc4f41abe4b1e900d9bc1f1cebdb79f998a5563364e6ea1533f7b228f8/pyjq-1.0.tar.gz"
}
],
"2.0.0": [
{
"comment_text": "",
"digests": {
"md5": "1372aeaf5bab821eb7522c2c53d1bfb5",
"sha256": "c34e69b0bcad21877e82c146d6e13e15f999d429d33b36dac2a18899fda2abc4"
},
"downloads": -1,
"filename": "pyjq-2.0.0.zip",
"has_sig": false,
"md5_digest": "1372aeaf5bab821eb7522c2c53d1bfb5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1744963,
"upload_time": "2016-02-13T15:45:45",
"url": "https://files.pythonhosted.org/packages/3d/ce/a67e6a4ad12e766f01f67caff3313e876bcfcf4360512194db9af55b80c0/pyjq-2.0.0.zip"
}
],
"2.1.0": [
{
"comment_text": "",
"digests": {
"md5": "2d75ad2f2f063b381378e17f1f2a7518",
"sha256": "f6f89c851ad90bc29c8570982343ca9ccf626ba9424c276d7fe37bbdc1d60fe2"
},
"downloads": -1,
"filename": "pyjq-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2d75ad2f2f063b381378e17f1f2a7518",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1783597,
"upload_time": "2017-06-28T04:40:08",
"url": "https://files.pythonhosted.org/packages/ec/c1/b5fcba48cb715b88b5ad619d1769204411383e2a275dfddda2d2fa8f99dd/pyjq-2.1.0.tar.gz"
}
],
"2.2.0": [
{
"comment_text": "",
"digests": {
"md5": "3032b66926a4248ebd52ea36d3b3922a",
"sha256": "1150e9362fcfcb8a53e7dafba1eae8e99931ca990c3f3c922ea8c0028e31db13"
},
"downloads": -1,
"filename": "pyjq-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "3032b66926a4248ebd52ea36d3b3922a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1743159,
"upload_time": "2018-07-28T07:59:30",
"url": "https://files.pythonhosted.org/packages/9d/af/311eef77dddb0cd2e65f01778b0cae9a769b6129edf4cb8be1982589bec6/pyjq-2.2.0.tar.gz"
}
],
"2.3.0": [
{
"comment_text": "",
"digests": {
"md5": "64c14e7a98370876815ee056b34e2a84",
"sha256": "40aa57815b8e5b9781f0e1fe017721f671c9033b776535506f4ee103cf8fa2c0"
},
"downloads": -1,
"filename": "pyjq-2.3.0.tar.gz",
"has_sig": false,
"md5_digest": "64c14e7a98370876815ee056b34e2a84",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2059081,
"upload_time": "2018-12-07T09:08:24",
"url": "https://files.pythonhosted.org/packages/ab/e5/975a4a393c9376f183556b66796b7b8d6589bc49e7db6a2f555b967499dd/pyjq-2.3.0.tar.gz"
}
],
"2.3.1": [
{
"comment_text": "",
"digests": {
"md5": "cdc117d755cba30bf5a76a290ce0f5c5",
"sha256": "45f7688d8191a4043e7c4839d6cabff8f16abc98fe48c3a4a0cc2da05c62096d"
},
"downloads": -1,
"filename": "pyjq-2.3.1-cp37-cp37m-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "cdc117d755cba30bf5a76a290ce0f5c5",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 571403,
"upload_time": "2019-02-08T04:31:42",
"url": "https://files.pythonhosted.org/packages/54/c4/80f1af2d33b787ee3c92f0083d0cc3b81fed8a5c313c1927008f50562bb3/pyjq-2.3.1-cp37-cp37m-macosx_10_12_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "71759c6e1a67a74f2df8027cb9d8861b",
"sha256": "5f3cd45b856ae4b42a1058d2e91e13d84df5ea188aedc3ae397dc0e01c270db9"
},
"downloads": -1,
"filename": "pyjq-2.3.1.tar.gz",
"has_sig": false,
"md5_digest": "71759c6e1a67a74f2df8027cb9d8861b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2059176,
"upload_time": "2018-12-07T09:12:33",
"url": "https://files.pythonhosted.org/packages/66/74/7f5c7789c894a943088040a0c148f7ac5daddf4096cf820e3ff15ae75ea0/pyjq-2.3.1.tar.gz"
}
],
"2.4.0": [
{
"comment_text": "",
"digests": {
"md5": "95cac58f2c79bbf3c5224629096c1839",
"sha256": "562e62a18d306d4fefe691d2ced951b34e44f0d300da505727cd66e2aa70aa0c"
},
"downloads": -1,
"filename": "pyjq-2.4.0-cp37-cp37m-macosx_10_14_x86_64.whl",
"has_sig": false,
"md5_digest": "95cac58f2c79bbf3c5224629096c1839",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 329356,
"upload_time": "2019-09-18T07:22:28",
"url": "https://files.pythonhosted.org/packages/c7/95/8d179833f58bd07e11570fd9e51e432a4e000e801554c6fc6ebf6d4e49b6/pyjq-2.4.0-cp37-cp37m-macosx_10_14_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "d3d0c4284aae94445754ccd6331ef5e5",
"sha256": "651f7a3ab2087e7c69cf00f1ba5433d7afe7b72f4ff499dcaf9c86cb1c2ae3c1"
},
"downloads": -1,
"filename": "pyjq-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "d3d0c4284aae94445754ccd6331ef5e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2033014,
"upload_time": "2019-09-18T07:22:47",
"url": "https://files.pythonhosted.org/packages/a5/7c/b7fdc7b9653d5f05552cb08b6e9883db13db21ca0c8b0cd100e5a5ed3a35/pyjq-2.4.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "95cac58f2c79bbf3c5224629096c1839",
"sha256": "562e62a18d306d4fefe691d2ced951b34e44f0d300da505727cd66e2aa70aa0c"
},
"downloads": -1,
"filename": "pyjq-2.4.0-cp37-cp37m-macosx_10_14_x86_64.whl",
"has_sig": false,
"md5_digest": "95cac58f2c79bbf3c5224629096c1839",
"packagetype": "bdist_wheel",
"python_version": "cp37",
"requires_python": null,
"size": 329356,
"upload_time": "2019-09-18T07:22:28",
"url": "https://files.pythonhosted.org/packages/c7/95/8d179833f58bd07e11570fd9e51e432a4e000e801554c6fc6ebf6d4e49b6/pyjq-2.4.0-cp37-cp37m-macosx_10_14_x86_64.whl"
},
{
"comment_text": "",
"digests": {
"md5": "d3d0c4284aae94445754ccd6331ef5e5",
"sha256": "651f7a3ab2087e7c69cf00f1ba5433d7afe7b72f4ff499dcaf9c86cb1c2ae3c1"
},
"downloads": -1,
"filename": "pyjq-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "d3d0c4284aae94445754ccd6331ef5e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2033014,
"upload_time": "2019-09-18T07:22:47",
"url": "https://files.pythonhosted.org/packages/a5/7c/b7fdc7b9653d5f05552cb08b6e9883db13db21ca0c8b0cd100e5a5ed3a35/pyjq-2.4.0.tar.gz"
}
]
}