Shared guidance for coding agents working in this repository.
uv venv --python 3.12
uv pip install -e ".[dev]"Run validation commands through uv run; activating the virtual environment is
optional. See docs/contributing.md for the full development workflow and
pyproject.toml for the authoritative tool configuration.
Start with checks targeted to the files and behavior you changed, then broaden as appropriate:
uv run pytest tests/path_to_relevant_test.py
uv run pytest -n auto -m "not slow and not gpu"
uv run ruff check <changed Python paths>
uv run ruff format --check <changed Python paths>
uv run pyright sbi
uv run pre-commit run --files <changed files>Tests live in *_test.py files. Available markers include slow, gpu, mcmc, and
benchmark; their definitions are in pyproject.toml.
- Use Google-style docstrings.
- Put shared public type aliases in
sbi/sbi_types.py. - Keep string identifiers for estimators lowercase (for example,
"maf","nsf", and"mdn"). - Add or update tests when behavior changes.
- Preserve unrelated local changes. If a checkout is already in use, work in a separate Git worktree.
Inspect the current code rather than relying on a duplicated class inventory:
sbi/inference/__init__.py— public inference methodssbi/inference/trainers/— training workflowssbi/inference/posteriors/— posterior implementationssbi/inference/potentials/— estimator-to-sampler bridgessbi/neural_nets/estimators/— estimator contracts and implementationssbi/samplers/— sampling backends
The documentation is built from docs/. Its curated docs/llms.txt index is served
at https://sbi.readthedocs.io/en/latest/llms.txt for tools that support it.