{"id":37071163,"url":"https://github.com/neuml/py27hash","last_synced_at":"2026-01-14T08:19:01.476Z","repository":{"id":42714743,"uuid":"223510843","full_name":"neuml/py27hash","owner":"neuml","description":"Python 2.7 hashing and iteration in Python 3+","archived":true,"fork":false,"pushed_at":"2022-11-20T12:45:40.000Z","size":36,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-03T12:38:44.758Z","etag":null,"topics":["python","python3"],"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/neuml.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":"2019-11-23T00:57:33.000Z","updated_at":"2025-07-10T11:10:56.000Z","dependencies_parsed_at":"2023-01-21T16:16:57.143Z","dependency_job_id":null,"html_url":"https://github.com/neuml/py27hash","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/neuml/py27hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Fpy27hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Fpy27hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Fpy27hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Fpy27hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neuml","download_url":"https://codeload.github.com/neuml/py27hash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuml%2Fpy27hash/sbom","scorecard":{"id":681348,"data":{"date":"2025-08-11","repo":{"name":"github.com/neuml/py27hash","commit":"4d814de4ab616f33bb2d74c687e74fa57c399a56"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/27 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":0,"reason":"project is archived","details":["Warn: Repository is archived."],"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.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":"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/build.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/neuml/py27hash/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/neuml/py27hash/build.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:30","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:32","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 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-21T23:16:30.200Z","repository_id":42714743,"created_at":"2025-08-21T23:16:30.200Z","updated_at":"2025-08-21T23:16:30.200Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28413758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:16:59.381Z","status":"ssl_error","status_checked_at":"2026-01-14T08:13:45.490Z","response_time":107,"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":["python","python3"],"created_at":"2026-01-14T08:19:00.785Z","updated_at":"2026-01-14T08:19:01.470Z","avatar_url":"https://github.com/neuml.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"py27hash: Python 2.7 hashing and iteration in Python 3+\n======\n\n[![Version](https://img.shields.io/pypi/v/py27hash.svg?style=flat)](https://pypi.org/project/py27hash/)\n[![Build Status](https://github.com/neuml/py27hash/workflows/build/badge.svg)](https://github.com/neuml/py27hash/actions?query=workflow%3Abuild)\n[![Coverage Status](https://img.shields.io/coverallsCoverage/github/neuml/py27hash)](https://coveralls.io/github/neuml/py27hash)\n\nThis package helps ease the migration from Python 2 to 3 for applications that depend on the old hash/iteration order of sets/dicts. Even when setting PYTHONHASHSEED=0, the hash (and default iteration order) will still be different as the hashing algorithm changed in Python 3. This package allows Python 2.7 hashing and set/dict iteration.\n\n## Installation\nThe easiest way to install is via pip and PyPI\n\n    pip install py27hash\n\nYou can also use Git to clone the repository from GitHub and install it manually:\n\n    git clone https://github.com/neuml/py27hash.git\n    cd py27hash\n    pip install .\n\nPython 2.7 and 3+ are supported.\n\n## How to use\nYou only need to replace object instantiation to use this package. There are multiple ways to do this, with the best way to do it on a case by case basis.\n\n### Replace each instantiation\nThe first example replaces a single dict and set with a 2.7 dict.\n\n```python\nfrom py27hash.dict import Dict\n\n# Replace {} with Dict()\nd = Dict()\n\nd[\"a\"] = 1\n\n# Python 2.7 sets can be used in the same manner.\n\nfrom py27hash.set import Set\n\n# Replace set() with Set()\nd = Set()\n\nd.add(\"a\")\n```\n\n### Override function via import\n\nThe same example above can be changed to override the dict and set import statement. This will globally change an entire file which could cause issues but it is an option. If a dict or set was created with the {} syntax, it still needs to be changed to dict()/set().\n\n```python\nfrom py27hash.dict import Dict as dict\n\nd = dict()\n\nd[\"a\"] = 1\n\n# Python 2.7 sets can be used in the same manner.\nfrom py27hash.set import Set as set\n\nd = set()\n\nd.add(\"a\")\n```\n\n### Using other methods\n\nThe hashing and key iteration methods can be directly accessed via the hash and key packages as follows.\n\n```python\nfrom py27hash.hash import hash27\n\nprint(hash27(\"test1234\"))\n\n# As with the example above you could even override the hash function for a particular file.\n\nfrom p27hash.hash import hash27 as hash\n\nprint(hash(\"test1234\"))\n```\n\nBoth Dict and Set are backed by the keys class. As new values as added/modified, a Keys instance tracks each value to store the order via Python 2.7 hashing. This class can also be used directly.\n\n```python\nfrom p27hash.key import Keys\n\nkeys = Keys()\nkeys.add(\"1\")\nkeys.add(\"2\")\n```\n\n## Background\nPython 2 will reach end of life (EOL) on January 1st, 2020. This package helps ease the migration from Python 2 to 3 for applications that depend on the old hash/iteration order of sets/dicts. Even when setting PYTHONHASHSEED=0, the hash (and default iteration order) will still be different as the hashing algorithm changed in Python3. Python 3.6 changed the default iteration order to insertion order.\n\nOne target use case is with machine learning. Optimization of machine learning model hyperparameters can take a very long time and if a model was built under Python 2 and feature set/dicts used the default sort order, new parameters would need to be used. This library can be used to allow a full conversion to Python 3 while fixes are made to re-optimize large model parameters. There likely are other use cases, especially in the scientific/engineering space where non-random deterministic iteration in Python 2 was used to create reproducible results.\n\nThis package implements logic in cpython 2.7 C source, mainly the Objects/ folder in pure Python. Performance was not a goal of this package and it will perform worse than native collections. It should only be used when there is a clear use case to preserve Python 2.7 hashing/iteration to ease a transition to Python 3.\n\n## Development\nIf an issue is found in this library, it can be cloned and changed.\n\n    git clone https://github.com/neuml/py27hash.git\n    cd py27hash\n\nAfter changes are made to the source, unit tests should also be added and run via:\n    scripts/test.sh\n\nDuring development slower tests can be skipped via:\n    scripts/test.sh skipslow\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuml%2Fpy27hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuml%2Fpy27hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuml%2Fpy27hash/lists"}