11.DEFAULT_GOAL := all
22
3+ poetry_dev_bootstrap_file = .poetry_dev_up_to_date
4+ poetry_prod_bootstrap_file = .poetry_prod_up_to_date
35npm_bootstrap_file = .node_packages_up_to_date
46
7+
58# Default `make` will give everything's that helpful for local development.
69.PHONY : all
710all : install-python-dev install-js
@@ -11,13 +14,23 @@ all: install-python-dev install-js
1114build : install-python-prod build-frontend
1215
1316.PHONY : install-python-dev
14- install-python-dev :
15- uv sync --all-groups
16-
17- # Note this will actually *remove* any dev dependencies, if present.
17+ install-python-dev : $(poetry_dev_bootstrap_file )
18+ $(poetry_dev_bootstrap_file ) : poetry.lock
19+ touch $(poetry_dev_bootstrap_file ) .notyet
20+ poetry install --no-root --with=test,lint,mypy
21+ mv $(poetry_dev_bootstrap_file ) .notyet $(poetry_dev_bootstrap_file )
22+ @# Remove the prod bootstrap file, since we now have dev deps present.
23+ rm -f $(poetry_prod_bootstrap_file )
24+
25+ # Note this will actually *remove* any dev dependencies, if present
1826.PHONY : install-python-prod
19- install-python-prod :
20- uv sync --no-dev
27+ install-python-prod : $(poetry_prod_bootstrap_file )
28+ $(poetry_prod_bootstrap_file ) : poetry.lock
29+ touch $(poetry_prod_bootstrap_file ) .notyet
30+ poetry install --no-root --sync --only=prod
31+ mv $(poetry_prod_bootstrap_file ) .notyet $(poetry_prod_bootstrap_file )
32+ @# Remove the dev bootstrap file, since the `--no-dev` removed any present dev deps
33+ rm -f $(poetry_dev_bootstrap_file )
2134
2235.PHONY : install-js
2336install-js : $(npm_bootstrap_file )
@@ -35,18 +48,29 @@ build-frontend: install-js
3548.PHONY : check
3649check : lint test
3750
51+ # Run automatic code formatters/linters that don't require human input
52+ # (might fix a broken `make check`)
53+ .PHONY : fix
54+ fix : install-python-dev
55+ poetry run ruff format .
56+ poetry run ruff check --fix .
57+
3858.PHONY : lint
3959lint : lint-python typecheck-python lint-js
4060
4161.PHONY : lint-python
4262lint-python : install-python-dev
43- uv run ruff format --check .
44- uv run ruff check .
45- uv run pylint --jobs 0 ws # '0' tells pylint to auto-detect available processors
63+ poetry run ruff format --check .
64+ poetry run ruff check .
65+ poetry run pylint --jobs 0 ws # '0' tells pylint to auto-detect available processors
4666
4767.PHONY : typecheck-python
48- typecheck-python :
49- uv run mypy --config-file pyproject.toml ws
68+ typecheck-python : install-python-dev
69+ @# Annoying workaround for `Cannot find component WithAnnotations`
70+ if ! poetry run mypy --config-file pyproject.toml ws; then \
71+ rm -r .mypy_cache; \
72+ exit 1; \
73+ fi
5074
5175.PHONY : lint-js
5276lint-js : install-js
@@ -57,7 +81,7 @@ test: test-python test-js
5781
5882.PHONY : test-python
5983test-python : install-python-dev
60- WS_DJANGO_TEST=1 uv run coverage run -m pytest
84+ WS_DJANGO_TEST=1 poetry run coverage run -m pytest
6185
6286.PHONY : test-js
6387test-js : install-js
@@ -66,14 +90,16 @@ test-js: install-js
6690# Production webservers won't run this way, so install dev dependencies
6791.PHONY : run
6892run : install-python-dev
69- uv run python -Wd manage.py runserver
93+ poetry run python -Wd manage.py runserver
7094
7195.PHONY : run-js
7296run-js : install-js
7397 NODE_ENV=development npm --prefix=frontend/ run serve
7498
7599.PHONY : clean
76100clean :
101+ rm -f $(poetry_dev_bootstrap_file )
102+ rm -f $(poetry_prod_bootstrap_file )
77103 rm -f $(npm_bootstrap_file )
78104 rm -rf .mypy_cache
79105 find . -name ' *.pyc' -delete
0 commit comments