Makefile Guide¶
Projects created with pywatson init --project-type full include a Makefile
with pre-configured targets for all common development tasks.
Run make help at any time to see a summary of available targets.
Note: The
Makefileis only generated for--project-type full.defaultandminimalprojects do not include one.
Quick reference¶
| Target | What it does |
|---|---|
make help |
List all targets with descriptions |
make setup |
Install all dependencies (runs uv sync) |
make test |
Run the test suite |
make test-cov |
Run tests and show a coverage report |
make lint |
Check code with ruff |
make lint-fix |
Auto-fix ruff lint issues |
make format |
Format code with ruff |
make format-check |
Check formatting without modifying files |
make typecheck |
Run the configured type checker |
make check |
Run all quality gates (lint + format + typecheck + test) |
make data |
Execute scripts/generate_data.py |
make analyze |
Execute scripts/analyze_data.py |
make docs |
Build documentation (configure as needed) |
make build |
Build the distribution package |
make clean |
Remove build artefacts |
Type checker integration¶
The typecheck target adapts to whichever type checker you chose when
creating the project:
# If you chose --type-checker ty (default):
make typecheck # runs: uv run ty check src/<package>/
# If you chose --type-checker mypy:
make typecheck # runs: uv run mypy src/<package>/
# If you chose --type-checker none:
make typecheck # prints a notice and exits successfully
Similarly, make check omits the typecheck step when no type checker was
configured.
Common workflows¶
First-time setup¶
Before committing¶
Run only tests¶
Fix formatting / lint issues¶
Run data pipeline¶
Customising targets¶
The Makefile is plain GNU Make — edit it freely. Add project-specific
targets at the end:
# Example: run a specific simulation
sim-long: ## Run the long simulation (high resolution)
uv run python scripts/generate_data.py --resolution high
.PHONY: sim-long
The make help output is generated automatically from ## comment markers,
so any target with a ## description will appear there.
Troubleshooting¶
make: command not found
Install GNU Make via your package manager:
uv: command not found
Install uv first:
Error: No module named pytest
Run make setup to install dependencies before running tests.