Metadata-Version: 2.4
Name: repro-manifest
Version: 0.2.0
Summary: Capture a reproducibility manifest for a run and diff two manifests.
Project-URL: Homepage, https://github.com/jmweb-org/repro-manifest
Project-URL: Repository, https://github.com/jmweb-org/repro-manifest
Project-URL: Issues, https://github.com/jmweb-org/repro-manifest/issues
Author: José del Río
License: MIT License
        
        Copyright (c) 2026 José del Río
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: cli,experiments,git,mlops,provenance,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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

# repro-manifest

[![CI](https://github.com/jmweb-org/repro-manifest/actions/workflows/ci.yml/badge.svg)](https://github.com/jmweb-org/repro-manifest/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/repro-manifest.svg)](https://pypi.org/project/repro-manifest/)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Wrap a run to capture a portable manifest of its environment, code, config and
seeds, then diff two manifests to explain why two runs differed.

Most ad-hoc runs leave no reproducibility receipt, and they are routinely
launched from a dirty working tree, so the commit hash alone does not
reproduce them. Reconstructing why two runs disagree by hand wastes an
afternoon. `repro-manifest` writes one JSON file per run and gives you a diff
built to answer exactly that question.

```console
$ repro-manifest run -o run.json -- python train.py --lr 0.1
# ... train.py runs; run.json now describes the launch

$ repro-manifest diff good.json run.json
risk  section  key                change
high  git      commit             a1b2c3d -> e4f5a6b
high  git      uncommitted_patch  none -> 38 lines
high  seeds    PYTHONHASHSEED     0 -> 1
medium  command  argv             ... --lr 0.05 -> ... --lr 0.1
```

## Install

```console
$ pip install repro-manifest                 # from PyPI, once released
$ pip install git+https://github.com/jmweb-org/repro-manifest   # latest, available now
```

No services, no account, no SDK to weave into your training loop. One command,
one JSON file.

## What a manifest records

| Section | Contents |
| --- | --- |
| `runtime` | Python version, implementation, platform, interpreter path |
| `git` | Commit, branch, dirty flag, changed-file count, and a patch of uncommitted changes |
| `command` | The exact argv and working directory |
| `config` | SHA-256 of each config file you point it at |
| `seeds` | `PYTHONHASHSEED`, any `*_SEED` variable, and seeds you pass in |
| `packages` | Installed distributions and versions, read from the live environment |

Capturing from the live environment catches drift a lockfile missed, and the
patch makes a dirty-tree run reproducible when the commit hash is not enough.

## Commands

```console
$ repro-manifest run -o run.json -- python train.py   # capture, then run
$ repro-manifest capture -o run.json                  # capture without running
$ repro-manifest capture --config configs/train.yaml  # hash a config file
$ repro-manifest show                                  # pretty-print the current manifest
$ repro-manifest diff a.json b.json                    # explain the difference
$ repro-manifest diff a.json b.json --json             # machine-readable
$ repro-manifest diff a.json b.json --check            # exit non-zero on a high-risk change
```

## Risk levels

A change is **high** risk when it routinely breaks reproducibility: a different
commit, a dirty or differing uncommitted patch, a changed seed, a changed
config hash, a different interpreter, or a Python minor-version bump. A
major-version package bump is high; other package and command changes are
**medium**. Only high-risk changes trip `--check`.

This tool owns per-run provenance and seeds. For comparing the full software
and hardware stack on its own, see its sibling
[mlenv](https://github.com/jmweb-org/mlenv).

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | Ran; no high-risk change (or `--check` not set). For `run`, the command's own code |
| 1 | `--check` found a high-risk change |
| 2 | A manifest file was missing or invalid |

## License

MIT. See [LICENSE](LICENSE).
