{"id":15014046,"url":"https://github.com/explosion/preshed","last_synced_at":"2026-04-02T18:45:43.535Z","repository":{"id":21196288,"uuid":"24506683","full_name":"explosion/preshed","owner":"explosion","description":"💥 Cython hash tables that assume keys are pre-hashed","archived":false,"fork":false,"pushed_at":"2026-03-23T08:45:19.000Z","size":198,"stargazers_count":87,"open_issues_count":1,"forks_count":24,"subscribers_count":9,"default_branch":"v3.0.x","last_synced_at":"2026-03-24T05:59:55.612Z","etag":null,"topics":["cython","hash-table","hash-tables","hashing","python"],"latest_commit_sha":null,"homepage":"","language":"Cython","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/explosion.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-09-26T16:25:02.000Z","updated_at":"2026-03-23T08:45:08.000Z","dependencies_parsed_at":"2023-01-13T21:20:25.658Z","dependency_job_id":"95ef1366-47c8-49d0-9589-a8c00a8a7fac","html_url":"https://github.com/explosion/preshed","commit_stats":{"total_commits":265,"total_committers":12,"mean_commits":"22.083333333333332","dds":0.6226415094339622,"last_synced_commit":"0d6f005eb884697c0718b3807234a9632361b3be"},"previous_names":["spacy-io/preshed"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/explosion/preshed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fpreshed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fpreshed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fpreshed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fpreshed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/explosion","download_url":"https://codeload.github.com/explosion/preshed/tar.gz/refs/heads/v3.0.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/explosion%2Fpreshed/sbom","scorecard":{"id":388297,"data":{"date":"2025-08-11","repo":{"name":"github.com/explosion/preshed","commit":"7bd9d00a9b9460020ad9f9d7f06499efd6a08b58"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"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":"Code-Review","score":0,"reason":"Found 1/16 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":"Maintained","score":1,"reason":"1 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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/cibuildwheel.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/cibuildwheel.yml/v3.0.x?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish_pypi.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/publish_pypi.yml/v3.0.x?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish_pypi.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/publish_pypi.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/tests.yml/v3.0.x?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/explosion/preshed/tests.yml/v3.0.x?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:39","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:40","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:63","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:72","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned","Info:   0 out of   4 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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'checks' permission set to 'write': .github/workflows/cibuildwheel.yml:51","Info: jobLevel 'actions' permission set to 'read': .github/workflows/cibuildwheel.yml:52","Info: jobLevel 'issues' permission set to 'read': .github/workflows/cibuildwheel.yml:53","Warn: jobLevel 'packages' permission set to 'write': .github/workflows/cibuildwheel.yml:54","Info: jobLevel 'pull-requests' permission set to 'read': .github/workflows/cibuildwheel.yml:55","Info: jobLevel 'repository-projects' permission set to 'read': .github/workflows/cibuildwheel.yml:56","Info: jobLevel 'statuses' permission set to 'read': .github/workflows/cibuildwheel.yml:57","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/cibuildwheel.yml:50","Info: jobLevel 'contents' permission set to 'read': .github/workflows/publish_pypi.yml:19","Warn: no topLevel permission defined: .github/workflows/cibuildwheel.yml:1","Warn: no topLevel permission defined: .github/workflows/publish_pypi.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1"],"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":"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":"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":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish_pypi.yml:12"],"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact release-v3.0.10 not signed: https://api.github.com/repos/explosion/preshed/releases/221033774","Warn: release artifact release-v3.0.10 does not have provenance: https://api.github.com/repos/explosion/preshed/releases/221033774"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'v3.0.x'","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 25 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-18T17:12:26.133Z","repository_id":21196288,"created_at":"2025-08-18T17:12:26.133Z","updated_at":"2025-08-18T17:12:26.133Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"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":["cython","hash-table","hash-tables","hashing","python"],"created_at":"2024-09-24T19:45:06.886Z","updated_at":"2026-04-02T18:45:43.530Z","avatar_url":"https://github.com/explosion.png","language":"Cython","readme":"\u003ca href=\"https://explosion.ai\"\u003e\u003cimg src=\"https://explosion.ai/assets/img/logo.svg\" width=\"125\" height=\"125\" align=\"right\" /\u003e\u003c/a\u003e\n\n# preshed: Cython Hash Table for Pre-Hashed Keys\n\nSimple but high performance Cython hash table mapping pre-randomized keys to\n`void*` values. Inspired by\n[Jeff Preshing](http://preshing.com/20130107/this-hash-table-is-faster-than-a-judy-array/).\n\nAll Python APIs provded by the `BloomFilter` and `PreshMap` classes are\nthread-safe on both the GIL-enabled build and the free-threaded build of Python\n3.14 and newer. If you use the C API or the `PreshCounter` class, you must\nprovide external synchronization if you use the data structures by this library\nin a multithreaded environment.\n\n[![tests](https://github.com/explosion/preshed/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/preshed/actions/workflows/tests.yml)\n[![pypi Version](https://img.shields.io/pypi/v/preshed.svg?style=flat-square\u0026logo=pypi\u0026logoColor=white)](https://pypi.python.org/pypi/preshed)\n[![conda Version](https://img.shields.io/conda/vn/conda-forge/preshed.svg?style=flat-square\u0026logo=conda-forge\u0026logoColor=white)](https://anaconda.org/conda-forge/preshed)\n[![Python wheels](https://img.shields.io/badge/wheels-%E2%9C%93-4c1.svg?longCache=true\u0026style=flat-square\u0026logo=python\u0026logoColor=white)](https://github.com/explosion/wheelwright/releases)\n\n## Installation\n\n```bash\npip install preshed --only-binary preshed\n```\n\nOr with conda:\n\n```bash\nconda install -c conda-forge preshed\n```\n\n## Usage\n\n### PreshMap\n\nA hash map for pre-hashed keys, mapping `uint64` to `uint64` values.\n\n```python\nfrom preshed.maps import PreshMap\n\nmap = PreshMap()                  # create with default size\nmap = PreshMap(initial_size=1024) # create with initial capacity (must be power of 2)\n\nmap[key] = value        # set a value\nvalue = map[key]        # get a value (returns None if missing)\nvalue = map.pop(key)    # remove and return a value\ndel map[key]            # delete a key\nkey in map              # membership test\nlen(map)                # number of entries\n\nfor key in map:                    # iterate over keys\n    pass\nfor key, value in map.items():     # iterate over key-value pairs\n    pass\nfor value in map.values():         # iterate over values\n    pass\n```\n\n### BloomFilter\n\nA probabilistic set for fast membership testing of integer keys.\n\n```python\nfrom preshed.bloom import BloomFilter\n\nbloom = BloomFilter(size=1024, hash_funcs=23)  # explicit parameters\nbloom = BloomFilter.from_error_rate(10000, error_rate=1e-4)  # auto-sized\n\nbloom.add(42)          # add a key\n42 in bloom            # membership test (may have false positives)\n\ndata = bloom.to_bytes()            # serialize\nbloom.from_bytes(data)             # deserialize in-place\n```\n\n### PreshCounter\n\nA counter backed by a hash map, for counting occurrences of `uint64` keys.\n\n```python\nfrom preshed.counter import PreshCounter\n\ncounter = PreshCounter()\n\ncounter.inc(key, 1)       # increment key by 1\ncount = counter[key]      # get current count\nlen(counter)              # number of buckets\n\nfor key, count in counter: # iterate over entries\n    pass\n\ncounter.smooth()           # apply Good-Turing smoothing\nprob = counter.prob(key)   # get smoothed probability\n```\n\n### Cython API\n\nAll classes expose a C-level API via `.pxd` files for use in Cython\nextensions. The low-level `MapStruct` and `BloomStruct` functions operate\non raw structs and can be called without the GIL:\n\n```cython\nfrom preshed.maps cimport PreshMap, map_get, map_set, map_iter, key_t\nfrom preshed.bloom cimport BloomFilter, bloom_add, bloom_contains\n\ncdef PreshMap table = PreshMap()\n\n# Low-level nogil access (requires external synchronization)\ncdef void* value\nwith nogil:\n    value = map_get(table.c_map, some_key)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplosion%2Fpreshed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexplosion%2Fpreshed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexplosion%2Fpreshed/lists"}