Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR 0013: Python only for figures and test oracles

  • Status: Accepted (2026-11-10)
  • Date: 2026-11-10
  • Deciders: Vincent Mader
  • Related: Global stack rule (Python only where its ecosystem is the reason); ADR 0008

Context

Paper figures are expected in matplotlib quality, and scipy plus the thesis and coag_py code are the oracles for parity tests. Neither justifies Python in the simulation loop.

Decision

A thin PyO3 crate coag-py exposes run, kernel, and estimator entry points to Python. Python (managed with uv, linted per the python skill) is used for: fixture generation from the thesis and coag_py code, scipy Radau parity checks, DustPy runs as an external oracle, and figure scripts for the paper. The simulation itself never depends on Python.

Alternatives considered

  • Matplotlib-free figures in Rust (plotters): possible, but slower to iterate to publication quality.
  • Calling Python from Rust tests: fragile in CI; fixtures are generated once and committed instead.

Consequences

  • Two toolchains in the repo (cargo, uv), both driven from the justfile.
  • Fixtures pin the oracle behavior at a known commit of the thesis code.