FrankenNumPy

Docs/Guarantees and recipes

Reproducibility Recipe

A concrete checklist for "make my numerical pipeline bit-reproducible from a fresh checkout, on any compatible machine, today and three years from now."

  1. Pin the toolchain. Add rust-toolchain.toml with a specific nightly. We use nightly-2026-08-31.
  2. Pin every dependency. Use exact =x.y.z constraints in Cargo.toml, not caret/tilde. Commit Cargo.lock.
  3. Use an explicit RNG seed for reproducibility. Generator::from_pcg64_dxsm(seed) for new code; SeedMaterial::None intentionally sources OS entropy like NumPy.
  4. Spawn child streams for parallelism, not OS entropy. let mut parent = SeedSequence::new(&[seed])?; let children = parent.spawn(n_workers)?; gives each worker a child stream. The full lineage is captured in the spawn counter, so child indices reproduce.
  5. Capture the full generator state. Before any non-deterministic side-effect, call generator.to_pickle_payload() to obtain a typed snapshot struct; from_pickle_payload reconstructs the exact state in-process. For cross-process persistence you currently need to layer your own transport over the payload's public fields.
  6. Use errstate rather than global seterr for short-lived overrides. Global seterr is process-wide; errstate is RAII-scoped and restores prior state on drop.
  7. Round-trip via save / load for canonical output. The NPY format is byte-stable across runs; pickle and JSON formats are not.
  8. Hash your inputs and outputs. SHA-256 every fixture and every artifact. The fnp-conformance artifact-durability stack does this for you, but the pattern is portable.
  9. Record the environment fingerprint (Rust toolchain, NumPy version if relevant, CPU model). Two reproducibility runs are only comparable when their fingerprints match.

Following all nine steps gives you a pipeline whose output is bit-identical between any two runs on compatible hardware, including across the project's 0.x → 1.0 evolution: the RNG, dtype, and shape contracts are stable even when the API surface moves.


This section in the README on GitHub