-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 1.88 KB
/
Copy pathMakefile
File metadata and controls
47 lines (36 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
DOCKER := docker compose run --rm dev
UV := $(DOCKER) uv run
PYTHON := $(UV) python
# ── Tests ────────────────────────────────────────────────────────────
.PHONY: test
test: ## Run all tests
$(UV) pytest
.PHONY: lint
lint: ## Run ruff linter
$(UV) ruff check --fix .
$(UV) ruff format .
typecheck:
$(UV) mypy .
.PHONY: docs
docs: ## Build docs locally (catches docstring issues before CI)
$(UV) --with mkdocs-material --with "mkdocstrings[python]" --with mkdocs-gen-files --with mkdocs-literate-nav mkdocs build --strict
# ── Scripts ──────────────────────────────────────────────────────────
# Auto-generates a `run-<stem>` target for every scripts/*.py file.
# Example: `make run-run_cifar_reproduction` runs scripts/run_cifar_reproduction.py
SCRIPTS := $(wildcard scripts/*.py)
SCRIPT_TARGETS := $(patsubst scripts/%.py,run-%,$(filter-out scripts/__init__.py,$(SCRIPTS)))
.PHONY: $(SCRIPT_TARGETS)
$(SCRIPT_TARGETS): run-%: scripts/%.py
$(UV) python $< $(ARGS)
.PHONY: list-scripts
list-scripts: ## List available run-* targets
@echo "Available script targets (pass args with ARGS=\"...\"):"
@for t in $(sort $(SCRIPT_TARGETS)); do echo " make $$t"; done
# ── Help ─────────────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " %-24s %s\n", $$1, $$2}'
@echo ""
@echo "Script targets: run 'make list-scripts' to see all."
@echo "Pass arguments: make run-run_landscape ARGS=\"--smoke\""