corelibs-hash (1.0.0)
Installation
pip install --index-url https://git.gullevek.org/api/packages/PyPI/pypi/simple/ --extra-index-url https://pypi.org/simple corelibs-hashAbout this package
CoreLibs Hashing Utilities
CoreLibs Python Hash
This is part of the Python CoreLibs
Overview
Hashing and Fingerprinting support
Install
uv add --index opj-pypi=https://git.egplusww.jp/api/packages/PyPI/pypi/simple/ corelibs-hash
Usage
The following packages exist
- corelibs_hash.fingerprint
corelibs_hash.fingerprint usage
from corelibs_hash.fingerprint import hash_object, dict_hash_frozen, dict_hash_crc
hash_object
Build a sha256 hash over any object, recommended function
def hash_object(obj: Any) -> str:
dict_hash_crc
[!notice] This is a legacy function and not recommended to use, use hash_object
Build a sha256 hash over any object, will try to use json.dumps, if fails will use hash_object.
dict_hash_crc(data: dict[Any, Any] | list[Any]) -> str:
[!notice] Because this is used in production we cannot change or replace this or existing hash keys would need to be recalculated
dict_hash_frozen
[!warning] Deprecated, use hash_object
Development
UV setup
uv must be installed
Python venv setup
After clone, run the command below to install all dependenciss
uv sync
Build and Publish
uv build
uv publish --index opj-pypi --token <gitea token>
Python tests
All python tests are the tests/ folder. They are structured by the source folder layout
run them with
uv run pytest
Get a coverate report
uv run pytest --cov=<project>
uv run pytest --cov=<project> --cov-report=term-missing
Other tests
In the test-run folder usage and run tests are located, runt them below
uv run test-run/<script>