This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
uv sync # install deps (dev, test, typing groups by default)
uv run just prepare # one-time: install pre-commit hooks
uv run pytest # run all tests (includes doctests via --doctest-modules)
uv run pytest -k test_name # run a single test by name
uv run pytest -x # stop on first failure
uv run ruff format . # format
uv run ruff check . # lint
uv run mypy # type check (strict mode)If you changed package metadata or entry points, use uv run just test instead of uv run pytest — it forces a fresh hatchling rebuild via --reinstall-package.
Python >=3.10 required. Build backend is hatchling. Version is derived from git tags via hatch-vcs (_version.py is auto-generated — don't edit it).
Ruff is configured with select = ["ALL"] — nearly all lint rules are enabled. Pytest runs with --reverse ordering, coverage enabled, and filterwarnings = ["error"] so new warnings fail tests.
Four modules under src/lite_runner/:
params.py— Data classes and type system:Param,Output,Metric, type constants,UNSETsentinel.backends.py—LogBackendprotocol,WandbBackend,JsonBackend,DryRunBackend. Collect/prepare functions for metrics, files, code snapshots.runner.py—Runnerorchestrator,RunFlags, and module-level helpers.__init__.py— Re-exports the public API.
Four core abstractions:
Param— Declares a CLI parameter. Type string encodes both parsing and W&B upload intent (e.g."path-video"means file path that gets uploaded as video). Multi-value viatype=[...].Output— Declares output files not tied to a Param (glob patterns, directories, zips). Processed after subprocess completes.Metric— Regex pattern applied to stdout; last match wins. Stored inwandb.run.summary.Runner— Orchestrator with an immutable pipeline API. Each pipeline method returns a new Runner viacopy.deepcopy:parse_cli()→override()→resolve_defaults()→ask_user().run()auto-calls any steps not yet applied. Values are tracked inparam_valueswith source tags inparam_sources("cli","override","default","fixed","prompt"). Post-run steps are individually try-excepted so W&B always finishes.
$output is a placeholder interpolated to ~/lite_runs/<project>/<timestamp>_<run_name>/ at runtime.
The UNSET sentinel marks params the user explicitly skipped (typed - at prompt) — these are omitted from the built command.
- Decoupled from models: User writes a
run.pyper model that configures aRunner. The runner only knows about CLI wrapping, not model internals. - Interactive-first: Missing params trigger TUI prompts by default;
--no-interactiveorrun(no_interactive=True)for CI/sweeps. - Never-fail post-run: Each post-run step catches exceptions and warns, ensuring W&B run always completes.
Tests are split across tests/test_runner.py, tests/test_params.py, tests/test_backends.py, tests/test_.py, and tests/conftest.py. W&B is mocked in integration tests.
Tests cover: param validation, CLI parsing, value resolution, interactive prompts, command building, metric extraction, subprocess execution, output logging, and full run lifecycle.
When changing the public API (Param fields, Runner methods, CLI flags), update:
- This file (
CLAUDE.md) — Architecture section above README.md— Quick start, Param docs, Pipeline API, CLI flags table, Sweeps exampleexamples/—run_example.py,run_sweep.py,run_ltx2.pyuse the public API- Docstrings —
Runnerclass docstring,Paramclass docstring, public method docstrings