Metadata-Version: 2.4
Name: rerunnable
Version: 1.0.0
Summary: Reproducibility auditor for scientific Python projects.
Keywords: reproducibility,research software,scientific computing,audit
Author: Shivam Maheshwari
Author-email: Shivam Maheshwari <shiva101fb@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Environment :: Console
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Dist: packaging>=26.3
Requires-Dist: pydantic>=2.14.3
Requires-Dist: rich>=15.0.0
Requires-Dist: typer>=0.29.1
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/FadeHack/rerunnable
Project-URL: Documentation, https://github.com/FadeHack/rerunnable/tree/main/docs
Project-URL: Issues, https://github.com/FadeHack/rerunnable/issues
Project-URL: Changelog, https://github.com/FadeHack/rerunnable/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# rerunnable

Can someone else rerun this and get the same results?

`rerunnable` audits a scientific Python project from a git URL or a local path. It installs the project in a locked-down container, compares the declared dependencies with the imports, runs the tests and the commands the README documents, and runs them again to see whether the outputs change. Every finding cites the logged commands, exit codes and file hashes behind it, so you can check the evidence yourself.

![A rerunnable run on a small project whose script draws random numbers without a seed. Each stage prints one line. The verdict is FAIL with one critical finding, output differs across runs, and one medium finding, unseeded random draws.](https://raw.githubusercontent.com/FadeHack/rerunnable/main/docs/img/run.svg)

## How it works

![The audit runs six stages in a container: intake, environment, dependencies, tests, documented commands and determinism. Each stage logs its commands as evidence. Findings cite the evidence and decide the verdict. An optional model reads the docs for commands and tries repairs on a copy, but never sets the verdict.](https://raw.githubusercontent.com/FadeHack/rerunnable/main/docs/img/how-it-works.svg)

The verdict comes from fixed rules over the findings:

| verdict | when |
|---|---|
| FAIL | at least one critical finding |
| INCONCLUSIVE | no critical finding, but something could not be checked (no tests, data that is not in the repo, a download the sandbox blocks) |
| PASS_WITH_WARNINGS | findings, none critical |
| PASS | no findings above info |

A model is optional. Without one, the audit runs in baseline mode. With one, the model also finds commands described in prose, suggests causes for failures the rules cannot explain, and tries repairs on a throwaway copy. The model never decides the verdict: a command it finds still has to fail in the sandbox to count, and the report shows the baseline verdict next to the model run's. Details are in [docs/how-it-works.md](https://github.com/FadeHack/rerunnable/blob/main/docs/how-it-works.md).

## Install

You need Python 3.11 or newer and a running Docker (Docker Desktop, or Docker Engine on Linux).

```
pipx install rerunnable
```

or, with [uv](https://docs.astral.sh/uv/), `uv tool install rerunnable`. From source:

```
git clone https://github.com/FadeHack/rerunnable
cd rerunnable
uv tool install .
```

If the shell then cannot find `rerunnable`, run `pipx ensurepath` or `uv tool update-shell` and open a new terminal. To work on the code instead, see [CONTRIBUTING.md](https://github.com/FadeHack/rerunnable/blob/main/CONTRIBUTING.md).

Then check that everything is ready:

```
rerunnable doctor
```

`doctor` checks that Docker answers, that there is enough disk space, that the package index can be reached, and that the model endpoint answers if you configured one.

## Audit a project

```
rerunnable run https://github.com/owner/project --ref v1.2.0
```

`--ref` takes a commit, tag or branch. Without it, the audit uses the default branch. A local path works too: `rerunnable run ./my-project`.

To try it, audit one of the small projects in `fixtures/` from a clone of this repo. `rerunnable run fixtures/rand-unseeded` should end in FAIL with exit code 3, because its script draws random numbers without a seed. `rerunnable run fixtures/clean` should PASS.

The run writes a directory under `runs/` with `report.html`, `report.md` and `report.json`, the evidence log, and every command's output. The terminal shows the verdict and the worst findings. The exit code tells scripts the result:

| code | meaning |
|---|---|
| 0 | PASS or PASS_WITH_WARNINGS |
| 1 | tool error, for example Docker not found |
| 2 | usage error |
| 3 | FAIL |
| 4 | INCONCLUSIVE |

Other commands:

- `rerunnable report <run dir>` writes the Markdown and HTML reports again from `report.json`.
- `rerunnable compare <run dir> [<other run dir>]` shows what the model changed in one run, or the differences between two runs.
- `rerunnable run --help` lists the limits you can change: memory, CPUs, time per command, the platform, and runs per command.

In the benchmark, the median audit took about 30 seconds without a model and under 4 minutes with one. A project's own test suite sets the upper end.

## Use a model (optional)

Any endpoint that speaks the OpenAI chat completions API works, hosted or local. Bring your own key:

```
export RERUNNABLE_LLM_BASE_URL=https://your-provider/v1
export RERUNNABLE_LLM_API_KEY=...
export RERUNNABLE_LLM_MODEL=...
```

The same settings can go in a `.env` file in the directory you run from. The key is never logged, cached or written to a report. `--no-llm` turns the model off for one run.

Every model reply is cached, and the replies a run used are copied into `llm/` in its run directory. `--llm-cache runs/<run id>/llm --llm-offline` replays the run from those replies without any endpoint; only `RERUNNABLE_LLM_MODEL` is needed. The model we use and its settings are in [docs/llm.md](https://github.com/FadeHack/rerunnable/blob/main/docs/llm.md).

## What it finds

21 finding categories, from `install_failed` and `undeclared_dependency` to `tests_fail_as_is`, `dependency_drift` and `nondeterministic_output`. Each has a default severity and, for all but one, a small fixture project in `fixtures/` that shows it. See [docs/findings.md](https://github.com/FadeHack/rerunnable/blob/main/docs/findings.md).

## Benchmark

We audited 60 Python projects from papers in the Journal of Open Source Software, each at the release the paper reviewed. 36 failed, 11 passed with warnings, and 13 could not be fully checked. None passed without a warning. The most common reasons for FAIL were tests that fail as published (21) and installs that fail (8). The method, the full results and their limits are in [docs/benchmark.md](https://github.com/FadeHack/rerunnable/blob/main/docs/benchmark.md). `rerunnable bench` runs the same kind of study on your own list ([benchmark/README.md](https://github.com/FadeHack/rerunnable/blob/main/benchmark/README.md)).

The dataset, with every report and the model replies needed to rerun it offline, is on Zenodo: [doi:10.5281/zenodo.24728197](https://doi.org/10.5281/zenodo.24728197).

## Docs

- [How it works](https://github.com/FadeHack/rerunnable/blob/main/docs/how-it-works.md): stages, verdict rules, evidence, the model's role
- [Findings](https://github.com/FadeHack/rerunnable/blob/main/docs/findings.md): every category, its severity and its fixture
- [Report format](https://github.com/FadeHack/rerunnable/blob/main/docs/report.md): the fields of `report.json`
- [Adding a check](https://github.com/FadeHack/rerunnable/blob/main/docs/adding-a-check.md): a worked example
- [Known limits](https://github.com/FadeHack/rerunnable/blob/main/docs/limits.md)
- [Models](https://github.com/FadeHack/rerunnable/blob/main/docs/llm.md) and [benchmark](https://github.com/FadeHack/rerunnable/blob/main/docs/benchmark.md)
- [Security](https://github.com/FadeHack/rerunnable/blob/main/SECURITY.md): what the sandbox does and does not protect
- [Contributing](https://github.com/FadeHack/rerunnable/blob/main/CONTRIBUTING.md) and [changes](https://github.com/FadeHack/rerunnable/blob/main/CHANGELOG.md)

## Citing

If you use rerunnable in research, please cite it. [CITATION.cff](https://github.com/FadeHack/rerunnable/blob/main/CITATION.cff) has the details, and GitHub's "Cite this repository" button formats them. If you use the benchmark results, also cite the dataset ([doi:10.5281/zenodo.24728197](https://doi.org/10.5281/zenodo.24728197)).

## License

Apache-2.0. See [LICENSE](https://github.com/FadeHack/rerunnable/blob/main/LICENSE).
