Canonical Hash
Deterministic hashing for arbitrary Python objects.
Provides utilities for creating stable, deterministic hashes of Python objects, essential for cache key computation, data versioning, and reproducibility.
Usage
from scicanonicalhash import canonical_hash, generate_record_id
# Hash any supported Python object
h = canonical_hash(42)
h = canonical_hash([1, 2, 3])
h = canonical_hash({"key": "value"})
# Generates a 16-character hex string (first 64 bits of SHA-256)
assert len(h) == 16
assert canonical_hash(42) == canonical_hash(42) # Deterministic
Supported Types
- JSON-serializable primitives (None, bool, int, float, str)
- numpy ndarrays (via shape + dtype + raw bytes)
- pandas DataFrames (via columns + index + array serialization)
- pandas Series (via name + array serialization)
- Dicts (sorted keys, recursive serialization)
- Lists/tuples (order-preserving, recursive serialization)
generate_record_id
Generate a unique record ID from type, schema version, content hash, and metadata:
rid = generate_record_id("MyData", 1, "abc123", {"subject": 1})
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scicanonicalhash-0.1.29.tar.gz.
File metadata
- Download URL: scicanonicalhash-0.1.29.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1abd811fad3cf3d2d38fec743ad9a93ad1d3b66f9cbcf245ca3663ed30886406
|
|
| MD5 |
454fb1bbe81897f97545c785a67da389
|
|
| BLAKE2b-256 |
d47bd8850ea4ed5e7f7ebf0009a7658004a8279c6373965538ff2e35605be669
|
Provenance
The following attestation bundles were made for scicanonicalhash-0.1.29.tar.gz:
Publisher:
publish.yml on mtillman14/scistack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scicanonicalhash-0.1.29.tar.gz -
Subject digest:
1abd811fad3cf3d2d38fec743ad9a93ad1d3b66f9cbcf245ca3663ed30886406 - Sigstore transparency entry: 2824335678
- Sigstore integration time:
-
Permalink:
mtillman14/scistack@9787b3b47c902d03cc6556ccdb5f86535d333680 -
Branch / Tag:
refs/tags/v0.1.29 - Owner: https://github.com/mtillman14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9787b3b47c902d03cc6556ccdb5f86535d333680 -
Trigger Event:
push
-
Statement type:
File details
Details for the file scicanonicalhash-0.1.29-py3-none-any.whl.
File metadata
- Download URL: scicanonicalhash-0.1.29-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4be0eee45957f708ed1cc34597054fcc79e9e5cbb48a2fd53e82e240a500375
|
|
| MD5 |
14ad9b6f5553cf3544dda69e6bdafe02
|
|
| BLAKE2b-256 |
ceefdfdfcc2434f1b82e99224d4a9dc92e17fd976eda8243531bfbc5466ddbf8
|
Provenance
The following attestation bundles were made for scicanonicalhash-0.1.29-py3-none-any.whl:
Publisher:
publish.yml on mtillman14/scistack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scicanonicalhash-0.1.29-py3-none-any.whl -
Subject digest:
c4be0eee45957f708ed1cc34597054fcc79e9e5cbb48a2fd53e82e240a500375 - Sigstore transparency entry: 2824335987
- Sigstore integration time:
-
Permalink:
mtillman14/scistack@9787b3b47c902d03cc6556ccdb5f86535d333680 -
Branch / Tag:
refs/tags/v0.1.29 - Owner: https://github.com/mtillman14
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9787b3b47c902d03cc6556ccdb5f86535d333680 -
Trigger Event:
push
-
Statement type: