Skip to content

Environments

An environment is part of the calculation. A notebook that depends on a hidden Python version, a local package, or a machine-specific path is not reproducible in the reference sense, even if its physics is correct.

Every reproducible notebook or script should record:

  • Python version,
  • operating system when it affects results,
  • package names and versions,
  • random seeds and random-number libraries,
  • hardware-sensitive assumptions when relevant,
  • the command or workflow used to run the notebook,
  • the date and commit identifier for the validated run when available.

The environment record should be visible in the notebook or in a nearby environment file, not only in a contributor’s memory.

Prefer the smallest dependency set that can honestly do the job:

  • NumPy for array operations and direct validation cells,
  • SciPy when sparse linear algebra, special functions, integration, optimization, or signal processing are needed,
  • SymPy for symbolic checks that are genuinely symbolic,
  • Matplotlib for static figures,
  • QuTiP for open-system and quantum-optics models when its abstractions reduce error,
  • circuit libraries only for circuit-model quantum information tasks.

Avoid adding a package only to save a few lines of code if it makes the environment harder to reproduce.

Use version pins or lockfiles for notebooks that support published figures, benchmark outputs, or claims about numerical agreement. Exploratory notebooks may use looser constraints, but they should not be cited as evidence.

A good dependency record answers:

  • what was installed,
  • where it came from,
  • which versions were used,
  • whether optional plotting or acceleration packages were required,
  • whether the result was rerun after dependency changes.

Notebook paths should be relative to the repository root. Avoid absolute local paths, user-profile directories, and hidden downloads. If a notebook needs data, the data source, license, checksum, and preprocessing step should be documented.

Generated output should not silently overwrite tracked source files. Exported figures should go through the Data and Figure Index once that section is populated.

Stochastic simulations should record seeds, sample counts, estimators, and uncertainty estimates. A fixed seed helps reproduce a run; it does not replace statistical error analysis.

Floating-point comparisons should use tolerances justified by the problem scale. Do not compare computed real numbers with exact equality unless the result is an integer, a shape, a label, or a deliberately exact symbolic value.