Skip to main content

Reproducibility utilities (random state, timestamps, hashing)

Project description

scitex-repro

SciTeX

Reproducibility utilities — RNG seeding, ID generation, timestamps, array hashing.

Full Documentation · uv pip install scitex-repro[all]

pypi python docs

tests install-check cov


Problem and Solution

# Problem Solution
1 "Seed everything" requires 5+ lines of boilerplaterandom.seed() + np.random.seed() + torch.manual_seed() + torch.cuda.manual_seed_all() + tf.random.set_seed() + os.environ[PYTHONHASHSEED] RandomStateManager(seed=42) — one call seeds every framework detected in the env; .reset() rewinds mid-experiment
2 Experiment run directories collide — two parallel runs overwrite each other gen_ID() + hash_array() — unique directory names like 20260423_2155_abc12345; deterministic array fingerprints for integrity checks

Installation

pip install scitex-repro

Architecture

src/scitex_repro/
├── __init__.py              # public re-exports
├── _RandomStateManager.py   # cross-framework RNG seeding (random / numpy / torch / tf)
├── _gen_ID.py               # 20260423_2155_<hash> directory IDs
├── _gen_timestamp.py        # filesystem-safe timestamps
├── _hash_array.py           # deterministic NumPy / pandas fingerprints
└── _config.py               # env-var + config defaults

1 Interfaces

Python API
from scitex_repro import RandomStateManager, gen_ID, hash_array

# Cross-framework RNG seeding
rng = RandomStateManager(seed=42)
data = rng("data").random(100)
rng.verify(data, "my_data")
rng.reset()

# Deterministic IDs and array fingerprints
exp_id = gen_ID()                         # "20260423_2155_abc12345"
fingerprint = hash_array(data)

Demo

flowchart LR
    seed["seed=42"] --> rsm["RandomStateManager"]
    rsm --> py["random"]
    rsm --> np["numpy"]
    rsm --> torch["torch (cpu+cuda)"]
    rsm --> tf["tensorflow"]
    rsm --> hashenv["PYTHONHASHSEED"]
    rsm --> data["rng('data').random(100)"]
    data --> fp["hash_array(data)"]
    rsm --> id["gen_ID()"]
    id --> dir[("20260423_2155_abc12345/")]
    fp --> integrity[("array fingerprint")]

Quick Start

from scitex_repro import RandomStateManager, gen_ID, hash_array

rng = RandomStateManager(seed=42)
data = rng("data").random(100)
print(gen_ID(), hash_array(data))

Part of SciTeX

scitex-repro is part of SciTeX. Install via the umbrella with pip install scitex[repro] to use as scitex.repro (Python) or scitex repro ... (CLI).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only (see LICENSE).


SciTeX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scitex_repro-0.1.6.tar.gz (8.6 MB view details)

Uploaded Source

Built Distribution

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

scitex_repro-0.1.6-py3-none-any.whl (8.3 MB view details)

Uploaded Python 3

File details

Details for the file scitex_repro-0.1.6.tar.gz.

File metadata

  • Download URL: scitex_repro-0.1.6.tar.gz
  • Upload date:
  • Size: 8.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_repro-0.1.6.tar.gz
Algorithm Hash digest
SHA256 b1f0576dbb3e55ff31552a9f4b13b9eb3dba49fdb0393381b9fcb95d45426f31
MD5 26fe85a3888cbb7b506a6909fd46b7a2
BLAKE2b-256 497cb64e2edcf44dae8c1ee9c161366f2dfd10ec8495aaedaddec5841060af38

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_repro-0.1.6.tar.gz:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-repro

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

File details

Details for the file scitex_repro-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: scitex_repro-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_repro-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7de95af83625d9d39b1848cf2e8daf3cac860f3dde4de6cbf656d1fb37fce629
MD5 7384b2cf77e50da323405fb873f17881
BLAKE2b-256 fe5c08d0abd92543e0029c1bba9748c25ae41ffa9dfeced74663e56b31c651e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_repro-0.1.6-py3-none-any.whl:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-repro

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page