Development Setup
This page describes the supported local setup for working on AMMM3. The project is maintained with local verification scripts rather than a CI-first workflow, so your development environment needs to be able to run linting, pytest, and the packaging smoke checks directly.
Prerequisites
- Python 3.12
- A local environment manager such as Conda
- A writable temporary directory such as
/tmpfor PyTensor caches and package verification artefacts
Create the Development Environment
The simplest supported path is the repository environment file:
conda env create -f environment.yml
conda activate ammm3-dev
python3 -m pip install -e .
If you know you will be running linting and tests frequently, install the optional extras as well:
python3 -m pip install .[lint,test]
Local Runtime Defaults
Some parts of the stack need writable cache directories. In restricted or sandboxed environments, set the same defaults used by the repo’s local verification scripts:
export PYTENSOR_FLAGS="base_compiledir=/tmp/pytensor,linker=py"
export JAX_PLATFORMS=cpu
export XDG_CACHE_HOME=/tmp
The Makefile already applies these defaults for make test and
make smoke_mmm.
Common Commands
Lint and format
make check_lint
make lint
make check_format
make format
These targets cover src/, tests/, scripts/ and runme.py.
Tests
make test
pytest tests/<path>/test_*.py -v
Use targeted pytest first when you are working on a narrow area. Run the wider verification commands before closing substantial changes.
Local verification
make smoke_mmm
make verify_local
make verify_package
make verify_local_all
What these commands do:
make smoke_mmmruns the full configured timeseries pipeline. Its main fit uses four chains with 2,000 tuning and 3,000 retained draws each. The holdout fit uses four chains with 2,000 tuning and 2,000 retained draws each. This target is a substantial sampling run. Use the runner quickstart to reduce the fit workload, and separately reduce or disable holdout validation.make verify_localruns formatting, linting, typing, and the configured test suite in sequence.make verify_packagebuilds package artefacts and validates an installed package smoke path.make verify_local_allruns the local verification matrix and includes the packaging smoke step.
The package verifier builds the source distribution and wheel in a temporary directory, checks required package files, installs the wheel without resolving dependencies into an isolated virtual environment that can use the current Python environment’s dependencies, and imports the installed package from outside the checkout. It verifies packaging and import behaviour. It is not a fresh dependency-resolution test.
Important Working Files
| File | Why it matters |
|---|---|
Makefile | Primary local entry point for lint, test, smoke, and package verification |
environment.yml | Supported dev environment definition |
pyproject.toml | Packaging metadata, extras, Ruff, MyPy, and pytest configuration |
scripts/run_package_verification.py | Package build and installed-wheel smoke verification |
ARCHITECTURE.md | Contributor-facing module map and dependency rules |
Local-Only Areas
The repo contains some directories that are useful locally but are not part of the shipped library surface:
.archive/for archived planning and reference materialAGENTS.mdfor repository development and statistical boundariessandbox/for ignored local scratch work
Keep temporary scripts in sandbox/ rather than mixing them into the package.
Troubleshooting
PyTensor cache permission errors
If you see errors related to .pytensor lock files or compiledir creation,
export the runtime defaults shown above and rerun the command.
Package verification fails because build is missing
Run:
python3 -m pip install build
The make verify_package target does this automatically.
You are not sure which command to run
As a rule:
- run targeted
pytestandruffwhile iterating - run
make verify_localbefore finishing non-trivial code changes - run
make verify_packagewhen packaging, imports, or bundled assets changed