Templates

Companion to a tutorial on computationally reproducible research. Each template is shown inline and downloadable; together they implement the interventions for a typical analysis project. Or grab all of them as one zip file.


The templates below fill the slots of this reproducible project skeleton:

rt-study/
├── README.md            ← README-template.md
├── .gitignore           ← gitignore-research.txt
├── pyproject.toml       ← pyproject.toml   (+ uv.lock, generated)
├── Makefile             ← Makefile         (or run.sh)
├── Dockerfile           ← Dockerfile       (when you need the robust tier)
├── AUDIT.md             ← AUDIT.md
├── analysis/
│   ├── 01_clean.py  02_model.py  03_figures.py
│   └── 04_check.py      ← check.py
├── data/                (raw inputs, or fetch instructions + checksums)
├── results/             (regenerated; never committed)
└── figures/             (regenerated; never committed)

Environment

pyproject.toml is a uv-managed Python project. uv lock turns it into uv.lock; commit both.

[project]
name = "rt-study"
version = "1.0.0"
requires-python = "==3.12.*"        # pin the interpreter line too
dependencies = [
    "numpy==2.3.*",
    "pandas==2.3.*",
    "matplotlib==3.10.*",
]

environment.yml is the conda-ecosystem equivalent (conda-forge only; prefer pixi for a true lockfile).

renv-lock-excerpt.json shows what an R renv.lock records, annotated. renv::init() and renv::snapshot() write the real one; remember it pins packages without pinning R itself.

Dockerfile is the robust tier: everything pinned, build once, archive the image tarball with the release.

Workflow

Makefile encodes the dependency graph as executable documentation; make all regenerates everything, make check verifies the paper. (Recipe lines are tab-indented, the classic gotcha.)

run.sh is the minimal alternative: steps in order under set -euo pipefail, so nothing fails silently.

Verification

check.py states the paper’s claims as an executable test, one line per headline number, each with an explicit tolerance:

CLAIMS = [
    ("mean RT difference (ms)", results["rt_diff_ms"], 65.9, 0.05),
    ("bootstrap CI lower",      results["ci_low"],     48.0, 0.05),
    ("bootstrap CI upper",      results["ci_high"],    84.0, 0.05),
]

Documentation

README-template.md is the reader-facing contract: what’s here, the one command that reproduces everything, expected runtime, data access and checksums, seeds and tolerances, license and citation.

gitignore-research.txt follows one principle: commit inputs and code; regenerate the rest. Rename it to .gitignore.

AUDIT.md is the Part 4 rubric as a checklist that lives in the repository, so the project keeps its own reproducibility ledger.


Back to the tutorial · onward to resources.