{"id":20916580,"url":"https://github.com/d1618033/listful","last_synced_at":"2026-05-05T19:31:28.282Z","repository":{"id":54990475,"uuid":"239827668","full_name":"d1618033/listful","owner":"d1618033","description":"Efficient filtering of lists of objects","archived":false,"fork":false,"pushed_at":"2021-01-17T15:48:39.000Z","size":66,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T10:38:22.044Z","etag":null,"topics":["database","dict","filter","list","pandas","python","python3","query","search"],"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/d1618033.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2020-02-11T17:53:33.000Z","updated_at":"2021-08-10T02:36:21.000Z","dependencies_parsed_at":"2022-08-14T08:20:41.567Z","dependency_job_id":null,"html_url":"https://github.com/d1618033/listful","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/d1618033/listful","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d1618033%2Flistful","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d1618033%2Flistful/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d1618033%2Flistful/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d1618033%2Flistful/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d1618033","download_url":"https://codeload.github.com/d1618033/listful/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d1618033%2Flistful/sbom","scorecard":{"id":315540,"data":{"date":"2025-08-11","repo":{"name":"github.com/d1618033/listful","commit":"a24615a4675fe2c2acbfbcc3a0ef7011c3edce8b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pythonpublish.yml:1","Info: no jobLevel write permissions found"],"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":"Code-Review","score":0,"reason":"Found 0/29 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":10,"reason":"no dangerous workflow patterns detected","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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpublish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/d1618033/listful/pythonpublish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpublish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/d1618033/listful/pythonpublish.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pythonpublish.yml:21","Warn: pipCommand not pinned by hash: .github/workflows/pythonpublish.yml:22","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"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":"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":"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":"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":"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":"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 2 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-18T00:06:55.135Z","repository_id":54990475,"created_at":"2025-08-18T00:06:55.135Z","updated_at":"2025-08-18T00:06:55.135Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32664769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","dict","filter","list","pandas","python","python3","query","search"],"created_at":"2024-11-18T16:24:18.564Z","updated_at":"2026-05-05T19:31:28.254Z","avatar_url":"https://github.com/d1618033.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# listful\n\n[![pypi](https://badge.fury.io/py/listful.svg)](https://pypi.org/project/listful)\n[![Python: 3.7+](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://pypi.org/project/listful)\n[![Downloads](https://img.shields.io/pypi/dm/listful.svg)](https://pypistats.org/packages/listful)\n[![Build Status](https://travis-ci.org/d1618033/listful.svg?branch=master)](https://travis-ci.org/d1618033/listful)\n[![Code coverage](https://codecov.io/gh/d1618033/listful/branch/master/graph/badge.svg)](https://codecov.io/gh/d1618033/listful)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n## Description\n\nEfficient filtering of lists of objects\n\n## Installation\n\n    pip install listful\n\n## Usage\n\n\nInitialize with the fields you want to filter by:\n\n        \u003e\u003e\u003e from listful import Listful\n        \u003e\u003e\u003e data = Listful(\n        ...    [{'x': 1, 'y': 10}, {'x': 2, 'y': 20}, {'x': 2, 'y': 30}], \n        ...    fields=['x', 'y']\n        ... )\n\n(If you don't specify the fields, all the fields whose corresponding values are hashable will be chosen)\n\n\n### Filtering:\n\n* By one field:\n\n        \u003e\u003e\u003e data.filter(x=1).one_or_none()\n        {'x': 1, 'y': 10}\n        \u003e\u003e\u003e data.filter(y=20).one_or_none()\n        {'x': 2, 'y': 20}\n\n* By one field, with more than one result:\n\n        \u003e\u003e\u003e data.filter(x=2).to_list()\n        [{'x': 2, 'y': 20}, {'x': 2, 'y': 30}]\n\n\n* By two fields:\n\n        \u003e\u003e\u003e data.filter(x=2, y=30).one_or_none()\n        {'x': 2, 'y': 30}\n\n\n* Raise exception if more than one found\n\n        \u003e\u003e\u003e data.filter(x=2).one_or_raise()\n        Traceback (most recent call last):\n        \u003c...\u003e\n        listful.exceptions.MoreThanOneResultException: Found more than one result for filter {'x': 2}: [{'x': 2, 'y': 20}, {'x': 2, 'y': 30}]\n\n\n* Get all values for a specific field\n\n\n        \u003e\u003e\u003e data.get_all_for_field('x')\n        [1, 2, 2]\n\n\n### Updating indexes:\n\n`Listful` has the same api as `list`, so you can get/set/delete items the same way \nand the indices will be updated automatically\n\n\n        \u003e\u003e\u003e data[0] = {'x': 17, 'y': 17}\n        \u003e\u003e\u003e data.filter(x=17).one_or_none()\n        {'x': 17, 'y': 17}\n        \u003e\u003e\u003e data[0]\n        {'x': 17, 'y': 17}\n        \u003e\u003e\u003e del data[0]\n        \u003e\u003e\u003e data.filter(x=17).one_or_none()\n\nIf you want to modify an element and update the indices you can do so explicitly:\n\n        \u003e\u003e\u003e data[0]['x'] = 1\n        \u003e\u003e\u003e data.rebuild_indexes_for_item(data[0])\n        \u003e\u003e\u003e data.filter(x=1).one_or_none()\n        {'x': 1, 'y': 20}\n\n\n\n### Objects:\n\nListful supports also lists of objects:\n\n\n        \u003e\u003e\u003e class Item:\n        ...     def __init__(self, x, y):\n        ...         self.x = x\n        ...         self.y = y\n        ...\n        ...     def __repr__(self):\n        ...         return f\"Item(x={self.x}, y={self.y})\"\n\n        \u003e\u003e\u003e items = Listful(\n        ...    [Item(x=1, y=10), Item(x=2, y=20), Item(x=2, y=30)], \n        ...    fields=['x', 'y']\n        ... )\n        \u003e\u003e\u003e items.filter(x=1).one_or_none()\n        Item(x=1, y=10)\n\n\nHere too, if you don't specify the fields, all fields with hashable values will be chosen:\n\n\n        \u003e\u003e\u003e items = Listful(\n        ...    [Item(x=1, y=10), Item(x=2, y=20), Item(x=2, y=30)], \n        ... )\n        \u003e\u003e\u003e items.fields\n        ['x', 'y']\n\n\n## Performance\n\nSee `scripts/timing.py`. \n\nA comparison of filtering with listful vs filtering with pandas (with/without index)\n\n|   | listful | pandas | pandas_with_index |\n| --- | --- | --- | --- |\n| init | 7.63e-02 | 3.03e-01 | 5.24e-02 |\n| filter:1 | 2.07e-05 | 1.46e-03 | 1.79e-03 |\n| filter:n | 2.02e-01 | 7.40e+01 | 1.54e+01 |\n\n70x faster than pandas with indexing, 360x faster than pandas without indexing.\n\n## For developers\n\n### Create venv and install deps\n\n    make init\n\n### Install git precommit hook\n\n    make precommit_install\n\n### Run linters, autoformat, tests etc.\n\n    make pretty lint test\n\n### Bump new version\n\n    make bump_major\n    make bump_minor\n    make bump_patch\n\n## License\n\nMIT\n\n## Change Log\n\nUnreleased\n-----\n\n* ...\n\n0.3.0 - 2021-01-17\n-----\n\n* ...\n\n0.2.1 - 2020-04-08\n-----\n\n* ...\n\n0.2.0 - 2020-04-08\n-----\n\n* Add support for default fields\n\n0.1.3 - 2020-02-14\n-----\n\n* ...\n\n0.1.1 - 2020-02-12\n-----\n\n* ...\n\n0.1.0 - 2020-02-12\n-----\n\n* initial\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd1618033%2Flistful","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd1618033%2Flistful","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd1618033%2Flistful/lists"}