Development
This page covers contributor setup, tests, formatting, linting, type checking, CI workflows, documentation builds, and model-integration contributor guidance.
Runtime rule
Use uv for Python and tool commands. Do not run python, pytest, ruff, mypy,
or similar tools directly.
uv run pytest -m "not slow"
uv run ruff check .
uv run mypy scoutbot
Python support
Scoutbot currently supports Python 3.11, 3.12, and 3.13. The package metadata declares
>=3.11,<3.14. Python 3.10 was dropped in 0.5.0: it reached end-of-life in October 2026, and
the fixed releases of pillow (13.0) and filelock (4.2.1+) needed to keep uv audit
clean require 3.11+.
Local setup
For a full maintainer environment (tests, docs, and Core ML on macOS):
uv sync --extra all
For the test/quality tools only (the CI-equivalent path):
uv sync --extra test
--extra test installs pytest, pytest-cov, pytest-random-order, Ruff, mypy, and Bandit.
--extra all is a shorthand for test + docs + coreml combined.
Testing
Fast/offline tests are the default local and CI path:
uv run pytest -m "not slow"
Slow tests download models or run real inference:
uv run pytest -m "slow"
Run coverage on the fast suite:
uv run pytest -m "not slow" --cov=scoutbot --cov-report=html
Internal test corpus
tools/build_test_corpus.py builds a density-tiered, GPS-stripped scoutbot test corpus from the
internal Matetsi survey (maintainer-only; requires local Matetsi and a locally-present model — it
performs no network I/O). It freezes CPU inference baselines a regression test replays.
uv run python tools/build_test_corpus.py \
--matetsi-jsonl <scoutbot_results.jsonl> \
--jsonl-source-root /home/brandon/matetsi_images \
--matetsi-root <local>/matetsi/images \
-o <corpus-dir> [--per-tier 5] [--config v3]
The regression test is slow and opt-in — it is skipped unless SCOUTBOT_TEST_CORPUS points at a
corpus directory, so public CI is unaffected:
SCOUTBOT_TEST_CORPUS=<corpus-dir> uv run pytest tests/test_corpus_regression.py
It asserts exact CPU parity to the frozen baselines only when the model, uv.lock, key library
versions, and platform match the manifest; otherwise it skips (re-run the builder to re-freeze).
Testing philosophy
New tests must cover meaningful branches — exception handlers, guard clauses, and
behavioral forks — not just add lines to a coverage metric. Branches that exist only
to satisfy a metric (e.g. if __name__ == '__main__':) are explicitly excluded.
The mock pattern used throughout: unittest.mock.patch for network and model
dependencies, tmp_path for filesystem, CliRunner for CLI commands. Only add
@pytest.mark.slow when a test actually hits the network or loads a real model
file from disk.
Quality checks
Ruff handles formatting, linting, and import ordering:
uv run ruff format --check .
uv run ruff check .
Scoped mypy checks library code and tools:
uv run mypy scoutbot tools/visualise.py
Dependency vulnerability scanning audits the locked project graph:
uv audit --locked --preview-features audit-command
Source-code security scanning checks the scoutbot/, benchmarks/, and tools/
trees for common Python security mistakes (tests/ is excluded — pytest assertions are
expected there):
uv run bandit -c pyproject.toml -r scoutbot/ benchmarks/ tools/
uv audit and Bandit cover different surfaces: uv audit checks installed packages
against the vulnerability database; Bandit checks your source code for insecure patterns.
Both run in CI and both should pass locally before opening a pull request.
Run all configured pre-commit hooks:
uv run pre-commit run --all-files
CI workflows
.github/workflows/testing.ymlRuns on pull requests and pushes to
main. It tests Python 3.11, 3.12, and 3.13, installs withuv sync --extra test, and runsuv run pytest -m "not slow"with coverage. Awindows-smokejob also runs the fast/offline suite on Windows with Python 3.13 only, providing smoke coverage for non-Core ML code without claiming full Windows parity..github/workflows/quality.ymlRuns on pull requests and pushes to
main. It installs withuv sync --extra testand runs Ruff format check, Ruff lint,uv run mypy scoutbot tools/visualise.py, a locked-graph dependency audit (uv audit --locked), and a Bandit source-code security scan (scoutbot/,benchmarks/,tools/)..github/workflows/cuda.ymlReal-GPU validation that GitHub-hosted runners cannot provide. It targets a self-hosted runner labelled
self-hosted, linux, gpuand runs on demand (workflow_dispatch) and weekly (Monday 06:00 UTC) rather than on every push/PR, to keep GPU time bounded. The job asserts a CUDA device is visible (failing fast otherwise), then runs theslowsuite withSCOUTBOT_DEVICE=cuda:0(realcuda:0inference), a multiprocessscoutbot batch-resumable --processes 2smoke, andbenchmarks/benchmark_concurrency.py, publishing the run summaries to the job summary. It is inert until a matching GPU runner is registered..github/workflows/publish.ymlRelease publishing via PyPI Trusted Publishing (see Releasing). A manual run (
workflow_dispatch) publishes to TestPyPI; pushing a version tag publishes to PyPI after a reviewer approves thepypienvironment. Both paths build once withuv build, fail if a pushed tag does not equaluv version --short, runtwine check --strict, and smoke-test the built wheel in clean venvs on Python 3.11 and 3.13 before uploading those same files.
GPU and CUDA
The default GitHub-hosted CI (testing.yml / quality.yml) has no GPU, so CUDA is not
exercised there; the package runs correctly on CPU without any GPU present. Real-GPU coverage is
provided separately by cuda.yml on a self-hosted GPU runner (see above), which is opt-in and
runs on demand / weekly. For local contributors with NVIDIA hardware, CUDA support is best-effort.
If you are testing on a GPU-enabled Windows machine, run the verification command in
Installation (Windows NVIDIA section) to confirm PyTorch detects the GPU before filing
bug reports related to GPU behavior.
Documentation builds
Install docs dependencies and build Sphinx:
uv sync --extra docs
uv run sphinx-build -M html docs docs/build
GitHub Pages is the canonical hosted docs site. Route readers to rendered HTML and keep local Sphinx builds as a maintainer path.
Releasing
Scoutbot is published to PyPI as scoutbot (owned by the OSW PyPI organization) by
.github/workflows/publish.yml using Trusted Publishing — there is no API token to manage.
Conventions
Tags are the bare version,
X.Y.Z(novprefix), and must equal theversioninpyproject.toml; the workflow refuses a mismatched tag before building anything.Do not rename
publish.ymlor thepypi/testpypiGitHub environments: those exact names are registered as the trusted publisher on PyPI and TestPyPI.A version can be uploaded to an index only once — PyPI and TestPyPI both permanently reject a reused filename, even after deletion.
Steps
Merge the release changes to
mainwith CI green, and update theCHANGELOG.rstentry (including its date) for the version inpyproject.toml.Dry run: Actions → Publish → Run workflow on
mainuploads to TestPyPI. Verify it without letting TestPyPI supply dependencies (TestPyPI carries unvetted uploads of common package names):# in an empty temporary directory uvx pip download scoutbot==X.Y.Z --no-deps -i https://test.pypi.org/simple/ -d dl/ uv venv && uv pip install dl/scoutbot-X.Y.Z-py3-none-any.whl uv run scoutbot --version && uv run scoutbot fetch --config v3
If a fix is needed after the TestPyPI upload, dry-run again from a throwaway branch with
uv version X.Y.ZrcNset, sinceX.Y.Zis already taken on TestPyPI; useX.Y.ZrcNin place ofX.Y.Zin the verify commands above. If TestPyPI has no trusted publisher for this repository yet,publish-testpypifails with an invalid-publisher error afterbuildandsmokepass; that run still counts as a reduced dry run (build and wheel smoke only).Alternative: a release candidate on PyPI. When TestPyPI is unavailable, or to exercise the real index and publisher, publish
X.Y.ZrcNto PyPI itself.pip install scoutbotignores pre-releases, so default installs are unaffected (0.5.0 used0.5.0rc1this way). The tag does not need to be onmain; pushing the tag carries the commit:git fetch origin git switch -c release/X.Y.ZrcN origin/main git branch --unset-upstream # keep a bare `git push` from targeting main uv version X.Y.ZrcN # updates pyproject.toml and uv.lock git commit -am "Release candidate X.Y.ZrcN" git tag -a X.Y.ZrcN -m "scoutbot X.Y.ZrcN" git push origin X.Y.ZrcN
Approve the
pypideployment, then verify in an empty temporary directory:uv venv && uv pip install --refresh-package scoutbot --pre scoutbot==X.Y.ZrcN uv run scoutbot --version && uv run scoutbot fetch --config v3
--refresh-package scoutbotmatters right after any upload: uv caches the package’s version list and otherwise reports that a just-published version does not exist (uv cache clean scoutbotclears it permanently). ThercNversion stays on PyPI; delete the local branch once done.Tag and push:
git fetch origin git tag -a X.Y.Z -m "scoutbot X.Y.Z" origin/main git push origin X.Y.Z
This fails if the tag already exists. That is the case only for
0.5.0, whose tag predatespublish.ymland is moved once (delete the remote tag, re-create it onorigin/main, push again) as part of that first release.Approve the
pypideployment oncebuildandsmokepass, then confirm the release in a clean environment:pip install scoutbot==X.Y.Z && scoutbot --versionshould printscoutbot X.Y.Z(with uv:uv pip install --refresh-package scoutbot scoutbot==X.Y.Z).
If the PyPI upload fails partway, re-run only the failed job in the same workflow run so it re-uses the same artifacts. Never rebuild or re-tag a version that has reached PyPI; release the next patch version instead.
Documentation pass
Every implementation plan must include a final documentation pass before completion. Review whether the work changes user behavior, commands, configuration, models, outputs, dependencies, quality checks, security posture, performance characteristics, or roadmap status. Update the affected docs in the same change set, or explicitly record why no doc update is needed.
This section mirrors the agent-facing rule in CLAUDE.md. Keep both copies aligned until a
public contributor guide becomes the shared source for contributor documentation requirements.
Use these documentation roles to decide what may be impacted:
README.mdRoutes readers and should change when quick-start commands, badges, supported workflows, or top-level project positioning changes.
docs/installation.rstOwns install commands, extras, platform setup, CUDA/Core ML setup, and model cache prerequisites.
docs/usage.rstOwns CLI/API examples, output schemas, batch/resume behavior, and QA/review interpretation notes.
docs/configuration.rstOwns environment variables, config names, devices, thresholds, cache behavior, and runtime controls.
docs/models.rstOwns model artifacts, source URLs, MD5 verification, provenance, and model availability.
docs/coreml.rstOwns Core ML backend mechanics, export behavior, parity caveats, and Apple-specific backend constraints.
docs/performance.rstOwns benchmark interpretation, bottlenecks, observability needs, and hardware comparison caveats.
docs/api.rstanddocs/cli.rstOwn generated API/CLI reference surfaces.
docs/development.rstOwns contributor setup, tests, lint/type checks, CI workflows, and model-integration contributor guidance.
docs/security.rstOwns model download policy, integrity verification, dependency/security scanning posture, CI scanning rationale, and data/privacy assumptions.
docs/roadmap.rstOwns planned/deferred work and investigation status.
CHANGELOG.rstOwns user-visible changes, compatibility changes, workflow changes, and release-note-worthy internal changes.
Model contributors and integrators
The current public model-extension API is not mature. Model configs live in
scoutbot.model_store today, and future registry work is tracked in
docs/plans/2026-05-09-scoutbot-registry.md and Roadmap.
New model integration work should include:
artifact provenance
integrity verification
config schema tests
CLI choice tests
output compatibility checks