Update Makefile
Keep Makefile targets in sync with the tooling installed in pyproject.toml and the scripts under src/<module>/.
Canonical targets
These should always exist (the cookiecutter ships them):
| Target | Command |
|---|---|
install |
uv sync |
install-dev |
uv sync --all-extras |
format |
uv run ruff format src tests |
lint |
uv run ruff check src tests |
test |
uv run pytest |
train |
uv run python -m <module>.train |
clean |
remove caches and build artifacts |
help |
print the target list |
If any of these are missing, restore them.
Conditionally added targets
Inspect pyproject.toml [project.optional-dependencies] and propose additions when a tool is installed but no Makefile target exists:
| Tool present in deps | Target to add | Command |
|---|---|---|
mypy |
typecheck |
uv run mypy src |
bandit |
security |
uv run bandit -r src |
pre-commit |
pre-commit |
uv run pre-commit run --all-files |
mkdocs |
docs / docs-serve |
uv run mkdocs build / uv run mkdocs serve |
nbstripout |
nb-clean |
uv run nbstripout notebooks/*.ipynb |
For new training scripts: if src/<module>/eval.py or src/<module>/predict.py exists, propose make eval and make predict targets that invoke them with uv run python -m.
Procedure
- Read
Makefileandpyproject.toml. - Build the expected target set (canonical + conditional).
- For each missing target, propose the addition.
- For each existing target whose command is stale (e.g., references a tool not installed), propose the fix.
- Do not delete user-added targets without asking. Treat any unknown target as user-authored.
- Edit
Makefilein place. Update thehelptarget to list all.PHONYtargets. - Tell the user to review and
git add Makefile. Do not auto-stage.
Anti-patterns
- Replacing the entire Makefile — loses user customizations.
- Adding targets for tools that aren't installed —
make foowill fail withcommand not found. - Forgetting to update
.PHONYandhelpwhen adding a new target.