Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (53 loc) · 3.17 KB
/
Copy pathMakefile
File metadata and controls
73 lines (53 loc) · 3.17 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.DEFAULT_GOAL := help
PYTEST = python -m pytest
# installer for make setup; CI passes PIP="uv pip" because it installs much faster
PIP ?= pip
# pytorch wheel channel: cpu (default, CI parity) or a CUDA build such as cu118/cu126/cu128
TORCH_CHANNEL ?= cpu
# suite for test-local: all | map | integration
SUITE ?= all
# --- Setup -------------------------------------------------------------------
setup: ## pinned deps from requirements.txt (make setup TORCH_CHANNEL=cu118 for CUDA)
$(PIP) install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/$(TORCH_CHANNEL)
setup-map: ## extra deps for the map_rendering tests (not installed in CI)
pip install matplotlib osmnx
setup-local: setup setup-map ## full dev setup
# --- Checks ------------------------------------------------------------------
# run setup first if deps are missing (presence check only, versions not verified)
deps:
@{ python -c "import torch, timm, pytest" && command -v ruff mypy; } >/dev/null 2>&1 || $(MAKE) setup
deps-map:
@python -c "import matplotlib, osmnx" >/dev/null 2>&1 || $(MAKE) setup-map
lint: deps ## ruff over the whole repo (same as CI)
ruff check
# Static type-checking over the whole project (see pyproject.toml for the
# lenient/strict policy). Run from Model/ so module paths resolve cleanly.
typecheck: deps ## mypy over the project (same as CI)
cd Model && mypy .
test: deps ## unit tests (same selection as CI)
$(PYTEST) Model/tests Platform/tests -v
# map suite runs from Model/ so `data_parsing.*` imports resolve (no __init__.py).
# The integration suite is slow and downloads pretrained backbone weights on first run.
test-local-map: deps deps-map
cd Model && $(PYTEST) data_parsing/map_rendering -v
test-local-integration: deps
$(PYTEST) Model/tests -m integration -v
test-local-all: test test-local-map test-local-integration
test-local: test-local-$(SUITE) ## local tests (make test-local SUITE=all|map|integration)
ci: lint typecheck test ## exactly what CI runs
# --- Run ---------------------------------------------------------------------
benchmark: ## speed benchmark
cd Model/speed_benchmark && python speed_benchmark.py
help: ## list available targets
@echo "Getting started (activate your virtualenv first — targets use the active python/pip):"
@echo " make setup-local install everything for local dev (CPU torch wheels)"
@echo " make setup TORCH_CHANNEL=cu126 pinned deps with CUDA 12.6 torch wheels instead"
@echo " make test-local run all local tests (unit + map + integration)"
@echo " make test-local SUITE=map run a single suite (all | map | integration)"
@echo " make ci run exactly what CI runs (lint + typecheck + unit tests)"
@echo ""
@echo "Targets:"
@grep -hE '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "Defaults: TORCH_CHANNEL=$(TORCH_CHANNEL) (cpu | cu118 | cu126 | cu128 | ...), SUITE=$(SUITE) (all | map | integration), PYTEST='$(PYTEST)'"
.PHONY: setup setup-map setup-local deps deps-map lint typecheck test test-local test-local-all test-local-map test-local-integration ci benchmark help