Skip to main content

Step by step in a terminal

The script examples/walkthrough.sh runs every step of the tutorial spotregen step by step as a terminal session, without Quarto or Jupyter. It builds the package mathregen in a temporary git repository, in the stages of the tutorial, and runs the real spotregen, pytest and git commands there. The section titles are those of the tutorial, so the two can be read side by side. The exercise sheet has the same commands for typing them yourself.

Run it

You need uv and git. uv installs Python 3.13 or later, spotregen and pytest from PyPI into the temporary repository; nothing outside it is changed.

git clone https://git-ce.rwth-aachen.de/thomas.bartz-beielstein/spotregen.git
cd spotregen
examples/walkthrough.sh

The script pauses after every section; Enter continues. A full run takes about a minute.

option effect
--no-pause run through without pauses (also when the input is not a terminal)
--keep keep the temporary repository at the end and print its path, to look around in it
--help print the description in the head of the script
SPOTREGEN_SRC=<path> an environment variable: test this checkout of spotregen instead of the release on PyPI

The exit status is 0 if every command ended with the exit code that the tutorial shows, 1 if one did not, and 2 for an unknown option.

What it prints

Every command is printed after a $, followed by its output. The commands of spotregen, pytest and the script of the package also print their exit code as [exit N]. If that code differs from the one in the tutorial, a line !!! the tutorial shows exit N here follows. A line that starts with # is a note of the script, for example an edit that plants a fault.

This excerpt is the section “A unit record, drafted by the tool” of a run with spotregen 0.15.0 on 2026-11-27, without the 45 lines of the drafted record:

========== A unit record, drafted by the tool ==========

$ spotregen new-unit fibonacci --pace fast
wrote regen/units/fibonacci.toml
regen/units/fibonacci.toml:5: error INTENT01 declares no intent item (a unit without intent cannot be regenerated)
next: write the intent items and evaluations, then run spotregen check
[exit 0]
$ cat regen/units/fibonacci.toml
...
$ spotregen check
regen/units/fibonacci.toml:5: error INTENT01 declares no intent item (a unit without intent cannot be regenerated)
regen check: 1 units, 1 errors, 0 warnings
[exit 1]

The run ends with a summary:

========== Summary ==========

Every command ended with the exit code that the tutorial shows.

The sections

section of the script main commands
The package skeleton uv sync, spotregen --version
Two functions and their unit tests python scripts/table.py, pytest -q
The architecture spotregen check
A unit record, drafted by the tool spotregen new-unit, spotregen check
Evaluations and intent spotregen check
Decisions spotregen check, pytest -q -m regen, git commit
What the check catches spotregen check with two planted faults, then with the fix
The deletion test spotregen deletion-test, spotregen context
How good are the evaluations? spotregen measures, spotregen mutate
Regeneration: a candidate written by hand spotregen score on three candidates
Regeneration: a candidate written by a model none: the archive of the model run is read
Compaction and the guard spotregen compact, spotregen check --strict
A third function spotregen check on a module without a record

The section “The idea” of the tutorial runs no command and has no counterpart.

How it differs from the tutorial

The files of each stage are copied from examples/mathregen/. The tutorial creates the package with uv init --lib mathregen and uv add --dev pytest ruff spotregen; the script prints these commands as a note and runs uv sync instead. Files are shown with cat and sed, and the output is not shortened, so spotregen score prints the whole run record. The paths are those of the temporary repository, where the tutorial writes <repo> and <tmp>.

The model run is not repeated. It needs a local model server such as LM Studio, and a language model is not deterministic. The script prints the commands that were run once, on 2026-11-27, and shows the archive in examples/mathregen/regen/runs/.

As a smoke test

examples/walkthrough.sh --no-pause exits with 1 if a command of the tutorial ended with another exit code. It runs to the end in any case, so every difference is marked. Run in the root of a spotregen checkout,

SPOTREGEN_SRC=$PWD examples/walkthrough.sh --no-pause

tests that checkout against the tutorial before a release.