-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 3.08 KB
/
Copy pathMakefile
File metadata and controls
79 lines (63 loc) · 3.08 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
74
75
76
77
78
79
.PHONY: test test-parallel test-verbose test-cov test-fast test-serial lint-check lint-format help
# Python interpreter — prefers project venv, otherwise system python3
PYTHON ?= $(shell [ -x .venv/bin/python ] && echo .venv/bin/python || echo python3)
# When `uv` is available, run pytest/ruff with the matching dependency groups so
# `make test` works without a pre-synced venv (use: uv sync --group test --group dev).
UV := $(shell command -v uv 2>/dev/null)
ifneq ($(UV),)
PYTEST = $(UV) run --group test python -m pytest
RUFF = $(UV) run --group dev python -m ruff
else
PYTEST = $(PYTHON) -m pytest
RUFF = $(PYTHON) -m ruff
endif
# Number of parallel workers (auto = number of CPUs)
WORKERS ?= auto
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
test: ## Run all tests in parallel (default)
$(PYTEST) tests/ -x -n $(WORKERS) --ignore=tests/test_spans.py --dist worksteal -q $(test_args)
test-cov: ## Run all tests with coverage report (sorted by coverage %)
$(PYTEST) tests/ -n $(WORKERS) --ignore=tests/test_spans.py --dist worksteal --cov=overmind --cov-report=term-missing -q $(test_args)
test-serial: ## Run all tests serially (for debugging)
$(PYTEST) tests/ -x --ignore=tests/test_spans.py -v $(test_args)
lint-check: ## Check lint + format (CI — no changes)
$(RUFF) check
$(RUFF) format --check
lint-format: ## Run ruff linter + formatter (auto-fix)
$(RUFF) check --fix
$(RUFF) format
.PHONY: generate_api_client generate_python_client schema backend dev
backend:
cd bae && python manage.py runserver 8000
dev:
cd frontend && bun run dev
schema:
cd bae && python manage.py spectacular --file ../openapi.yaml --validate
generate_api_client: schema
docker run --rm -v $(PWD):/workspace openapitools/openapi-generator-cli:v7.19.0 generate \
-i /workspace/openapi.yaml \
-g typescript-fetch \
-o /workspace/frontend/src/api/generated \
--additional-properties=typescriptThreePlus=true,supportsES6=true,enumPropertyNaming=original
# Generate the Python client and embed it at overmind/openapi_client/.
#
# The generator creates an `openapi_client` package with bare `from openapi_client.*`
# imports. After copying the package into the overmind namespace we rewrite every
# import so they resolve as `from overmind.openapi_client.*` — consistent with
# how the rest of the codebase (client.py, etc.) references them.
generate_python_client: schema
@echo "==> Generating Python API client (generator output → .tmp_python_client)"
docker run --rm -v $(PWD):/workspace openapitools/openapi-generator-cli:v7.19.0 generate \
-i /workspace/openapi.yaml \
-g python \
-o /workspace/.tmp_python_client \
--additional-properties=packageName=overmind.openapi_client,library=httpx,generateSourceCodeOnly=true
@echo "==> Installing into overmind/openapi_client/"
rm -rf overmind/openapi_client
mv .tmp_python_client/overmind/openapi_client overmind/openapi_client
rm -rf .tmp_python_client
rm -rf overmind/openapi_client/test
rm -rf overmind/openapi_client/docs
@echo "==> Done."