Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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

  1. JSON-serializable primitives (None, bool, int, float, str)
  2. numpy ndarrays (via shape + dtype + raw bytes)
  3. pandas DataFrames (via columns + index + array serialization)
  4. pandas Series (via name + array serialization)
  5. Dicts (sorted keys, recursive serialization)
  6. 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

scicanonicalhash-0.1.9.dev0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scicanonicalhash-0.1.9.dev0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file scicanonicalhash-0.1.9.dev0.tar.gz.

File metadata

  • Download URL: scicanonicalhash-0.1.9.dev0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for scicanonicalhash-0.1.9.dev0.tar.gz
Algorithm Hash digest
SHA256 831943377df63241a923836bb2a7405a3897b2718f4d27947cde74bb973c86bf
MD5 caff8f545bad3af5037058c89739a89d
BLAKE2b-256 64af129cd5d80694c0a7bd8b564222d2b39ce890fa1e2afa25e0adc3bad34269

See more details on using hashes here.

Provenance

The following attestation bundles were made for scicanonicalhash-0.1.9.dev0.tar.gz:

Publisher: publish.yml on mtillman14/scistack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scicanonicalhash-0.1.9.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for scicanonicalhash-0.1.9.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a592c3aca8611228a2574d9d6509d06f98e1ef0926a689ab38bd01d91a5d94
MD5 b576e9664e4492c656cf50015d6d1e2a
BLAKE2b-256 b72c7facb7179c7ba0841da8ff54457640a1723ebdd67063fb8bc8dd5afacf7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for scicanonicalhash-0.1.9.dev0-py3-none-any.whl:

Publisher: publish.yml on mtillman14/scistack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.29

2 files

0.1.28

2 files

0.1.26

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.14

2 files

0.1.13

2 files

0.1.11

2 files

0.1.10

2 files

This release

0.1.9.dev0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page