{"id":30855687,"url":"https://github.com/podhmo/jqfpy","last_synced_at":"2025-09-07T11:10:03.269Z","repository":{"id":62572719,"uuid":"101467162","full_name":"podhmo/jqfpy","owner":"podhmo","description":"jq for pythonista","archived":false,"fork":false,"pushed_at":"2025-05-21T08:13:06.000Z","size":109,"stargazers_count":13,"open_issues_count":9,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-26T00:50:51.182Z","etag":null,"topics":["jq","json","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/podhmo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-26T06:20:44.000Z","updated_at":"2021-10-05T01:42:16.000Z","dependencies_parsed_at":"2022-11-03T18:30:23.257Z","dependency_job_id":null,"html_url":"https://github.com/podhmo/jqfpy","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/podhmo/jqfpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podhmo%2Fjqfpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podhmo%2Fjqfpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podhmo%2Fjqfpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podhmo%2Fjqfpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/podhmo","download_url":"https://codeload.github.com/podhmo/jqfpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podhmo%2Fjqfpy/sbom","scorecard":{"id":739460,"data":{"date":"2025-08-11","repo":{"name":"github.com/podhmo/jqfpy","commit":"c733084751fbc700f642f23092e24da5b56afb98"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T17:00:19.004Z","repository_id":62572719,"created_at":"2025-08-22T17:00:19.004Z","updated_at":"2025-08-22T17:00:19.004Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274026718,"owners_count":25209740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jq","json","python"],"created_at":"2025-09-07T11:09:34.040Z","updated_at":"2025-09-07T11:10:03.235Z","avatar_url":"https://github.com/podhmo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jqfpy\n\n[![Build Status](https://travis-ci.org/podhmo/jqfpy.svg?branch=master)](https://travis-ci.org/podhmo/jqfpy)\n\n## jq is too difficult\n\njq is too difficult, at least for me.\n\nFor example, extracting key-name when use is true only, from below JSON data.\n\n```json\n{\n  \"apps\": {\n    \"foo\": {\n      \"use\": true\n    },\n    \"bar\": {\n      \"use\": true\n    },\n    \"boo\": {\n      \"use\": true\n    },\n    \"bee\": {\n      \"use\": false\n    }\n  }\n}\n```\n\nWhat is jq's answer? (taking over 30 minutes, my past challenges).\n\n```console\n$ cat data.json | jq '.apps | . as $$o | keys | map(select($$o[.].use))'\n[\n  \"bar\",\n  \"boo\",\n  \"foo\"\n]\n```\n\nIf you have python's knowledge, this is tiny oneliner, isn't it?\n\n```console\n$ cat data.json | jqfpy '[k for k, opts in get(\"apps\").items() if opts[\"use\"]]'\n[\n  \"foo\",\n  \"bar\",\n  \"boo\"\n]\n```\n\n(`get()` is special function, like a `json.load(sys.stdin).get`.)\n\n## install\n\n```console\n$ pip install jqfpy\n```\n\n## how to use\n\n### describe syntax\n\ntodo.\n\n### tutorial\n\nthis is jqfpy version of [jq's Tutorial](https://stedolan.github.io/jq/tutorial/)\n\n```console\n$ alias jsonDATA=\"curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5'\"\n# jq.\n$ jsonDATA | jq '.'\n# jqfpy.\n$ jsonDATA | jqfpy 'get()'\n```\n\n```console\n# jq.\n$ jsonDATA | jq '.[0]'\n# jqfpy.\n$ jsonDATA | jqfpy 'get()[0]'\n```\n\n```console\n# jq.\n$ jsonDATA | jq '.[0] | {message: .commit.message, name: .commit.committer.name}'\n# jqfpy.\n$ jsonDATA | jqfpy 'd = get()[0]; {\"message\": get(\"commit/message\", d), \"name\": get(\"commit/committer/name\", d)}'\n# or\n$ jsonDATA | jqfpy '{\"message\": get(\"0/commit/message\"), \"name\": get(\"0/commit/committer/name\")}'\n```\n\n```console\n# jq.\n$ jsonDATA | jq '.[] | {message: .commit.message, name: .commit.committer.name}'\n# jqfpy.\n$ jsonDATA | jqfpy --squash 'L = get(); [{\"message\": get(\"commit/message\", d), \"name\": get(\"commit/committer/name\", d)} for d in L]'\n```\n\n```console\n# jq.\n$ jsonDATA | jq '[.[] | {message: .commit.message, name: .commit.committer.name, parents: [.parents[].html_url]}]'\n# jqfpy.\n$ jsonDATA | 'L = get(); [{\"message\": get(\"commit/message\", d), \"name\": get(\"commit/committer/name\", d), \"parents\": [p[\"html_url\"] for p in d[\"parents\"]]} for d in L]'\n# or (using h.pick)\n$ jsonDATA | 'L = get(); [h.pick(\"commit/message@message\", \"commit/committer/name@name\", \"parents[]/html_url@parents\", d=d) for d in L]'\n```\n\n## additionals\n\n### other formats support\n\njqfpy is supporting other formats(but this is experimental feature)\n\n- yaml\n- ltsv\n\nif you want to use yaml supported version. install via below command.\n\n```console\n$ pip install jqfpy[yaml]\n```\n\nand calling jqfpy with `--input-format,-i` option and `--output-format,-o` option.\n\n02data.yaml\n\n```yaml\nperson:\n  name: foo\n  age: 20\n  nickname: fool\n```\n\n```console\n$ cat 02data.yaml | jqfpy -i yaml 'get(\"person\")'\n{\n  \"name\": \"foo\",\n  \"age\": 20,\n  \"nickname\": \"fool\"\n}\n\n$ cat 02data.yaml | jqfpy -i yaml -o ltsv 'get(\"person\")'\nname:foo\tage:20\tnickname:fool\n```\n\n### helper functions\n\nhelper functions are included.\n\n- pick()\n- omit()\n- flatten()\n- chunk()\n- loadfile()\n- dumpfile()\n\npick()\n\n```console\n$ cat 02data.yaml | jqfpy -i yaml 'h.pick(\"person/name\", \"person/age\")'\n{\n  \"person\": {\n    \"name\": \"foo\",\n    \"age\": 20\n  }\n}\n\n$ cat 02data.yaml | jqfpy -i yaml 'h.pick(\"person/name@name\", \"person/age@age\")'\n{\n  \"name\": \"foo\",\n  \"age\": 20\n}\n```\n\nomit()\n\n```console\n$ cat 02data.yaml | jqfpy -i yaml 'h.omit(\"person/nickname\")'\n{\n  \"person\": {\n    \"name\": \"foo\",\n    \"age\": 20\n  }\n}\n```\n\nflatten()\n\n```console\n$ seq 1 5 | jqfpy --slurp -c 'L = get(); [L, L]'\n[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]\n$ seq 1 5 | jqfpy --slurp -c 'L = get(); h.flatten([L, L], n=1)'\n[1, 2, 3, 4, 5, 1, 2, 3, 4, 5]\n```\n\nchunk()\n\n```console\n$ seq 1 10 | jqfpy --slurp -c 'h.chunk(get(), n=3)'\n[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]\n```\n\nloadfile()\n\n```console\n$ ls *.json\na.json b.json\n$ echo '[\"a\", \"b\"]' | jqfpy '{name: h.loadfile(f\"{name}.json\") for name in get()}'\n```\n\n`--here` and `--relative-path` options.\n\n```console\n# see ./x.json\n$ jqfpy 'h.loadfile(\"x.json\")' a/b/main.json\n\n# see ./a/b/x.json\n$ jqfpy --here a/b/ 'h.loadfile(\"x.json\")' a/b/main.json\n\n# see ./a/b/x.json\n$ jqfpy --relative-path 'h.loadfile(\"x.json\")' a/b/main.json\n```\n\ndumpfile()\n\n```\n$ echo {\"person0.json\": {\"name\": \"foo\", \"age\": 20}, \"person1.json\": {\"name\": \"bar}} | jqfpy '[h.dumpfile(v, fname) for fname, v in get().item()]' \u003e /dev/null\n```\n\n\n### individual helper module with --additionals\n\nmatch.py\n\n```python\nimport re\n\n\ndef match(rx, text):\n    if text is None:\n        return False\n    return re.search(rx, text)\n```\n\n```console\n$ cat examples/additionals/00data.json | jqfpy --additionals=./match.py '[d for d in get(\"constraint\") if h.match(\"^1\\..+\", d.get(\"version\"))]'\n[\n  {\n    \"name\": \"github.com/Masterminds/vcs\",\n    \"version\": \"1.11.0\"\n  },\n  {\n    \"name\": \"github.com/boltdb/bolt\",\n    \"version\": \"1.0.0\"\n  }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodhmo%2Fjqfpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpodhmo%2Fjqfpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodhmo%2Fjqfpy/lists"}