Metadata-Version: 2.4
Name: scicanonicalhash
Version: 0.1.0
Summary: Deterministic hashing for arbitrary Python objects
Project-URL: Repository, https://github.com/example/scicanonicalhash
Project-URL: Issues, https://github.com/example/scicanonicalhash/issues
Author: SciStack Contributors
License-Expression: MIT
Keywords: cache-key,canonical,data-science,deterministic,hash,reproducibility
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Provides-Extra: all
Requires-Dist: numpy>=1.20; extra == 'all'
Requires-Dist: pandas>=1.3; extra == 'all'
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: numpy
Requires-Dist: numpy>=1.20; extra == 'numpy'
Provides-Extra: pandas
Requires-Dist: pandas>=1.3; extra == 'pandas'
Description-Content-Type: text/markdown

# 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

```python
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:

```python
rid = generate_record_id("MyData", 1, "abc123", {"subject": 1})
```
