Skip to content

Commit 9ec3d72

Browse files
committed
[chore] After the switch to uv, fix some minor issues and improve the Makefile
1 parent 80f1d74 commit 9ec3d72

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PYTHON_BINS ?= ./.venv/bin
22
PYTHON ?= ${PYTHON_BINS}/python
33
DJANGO_SETTINGS_MODULE ?= project.settings.development
44
SUB_MAKE = ${MAKE} --no-print-directory
5+
UV ?= bin/uv
56

67
.DEFAULT_GOAL := help
78

@@ -10,10 +11,8 @@ help:
1011
@grep -P '^[.a-zA-Z/_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1112

1213
.PHONY: install
13-
install: bin/uv .venv ./node_modules ## Install the Python and frontend dependencies
14-
bin/uv sync --all-extras
15-
${PYTHON_BINS}/pre-commit install
16-
${SUB_MAKE} .venv/bin/black
14+
install: backend/install frontend/install ## Install the Python and frontend dependencies
15+
1716

1817
.PHONY: dev
1918
dev: .env.local db.sqlite3
@@ -31,6 +30,13 @@ download_assets: download_assets_opts ?=
3130
download_assets:
3231
${PYTHON_BINS}/python scripts/download_assets.py ${download_assets_opts}
3332

33+
.PHONY: backend/install
34+
backend/install: uv_sync_opts ?= --all-extras --no-build
35+
backend/install: bin/uv .venv ## Install the Python dependencies (via uv) and install pre-commit
36+
${UV} sync ${uv_sync_opts}
37+
${PYTHON_BINS}/pre-commit install
38+
@${SUB_MAKE} .venv/bin/black
39+
3440
.PHONY: backend/watch
3541
backend/watch: address ?= localhost
3642
backend/watch: port ?= 8000
@@ -83,8 +89,12 @@ code-quality/mypy: ## Python's equivalent of TypeScript
8389

8490
# Here starts the frontend stuff
8591

92+
.PHONY: frontend/install
93+
frontend/install: ## Install the frontend dependencies (via npm)
94+
npm install
95+
8696
.PHONY: frontend/watch
87-
frontend/watch: ## Compile the CSS & JS assets of our various Django apps, in 'watch' mode
97+
frontend/watch: ./node_modules ## Compile the CSS & JS assets of our various Django apps, in 'watch' mode
8898
@./node_modules/.bin/concurrently --names "img,css,js" --prefix-colors "yellow,green" \
8999
"${SUB_MAKE} frontend/img" \
90100
"${SUB_MAKE} frontend/css/watch" \
@@ -150,7 +160,7 @@ bin/uv: # Install `uv` and `uvx` locally in the "bin/" folder
150160
@echo "We'll use 'bin/uv' to manage Python dependencies."
151161

152162
.venv: ## Initialises the Python virtual environment in a ".venv" folder, via uv
153-
bin/uv venv
163+
${UV} venv
154164

155165
.env.local:
156166
cp .env.dist .env.local
@@ -179,8 +189,6 @@ django/manage: .venv .env.local ## Run a Django management command
179189

180190
./node_modules: frontend/install
181191

182-
frontend/install:
183-
npm install
184192

185193
# Here starts the "Lichess database" stuff
186194

dev-start.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export DJANGO_SETTINGS_MODULE=project.settings.development
1616
alias run_in_dotenv='dotenv -f .env.local run -- '
1717

1818
alias uv='bin/uv'
19-
alias djm='run_in_dotenv python src/manage.py'
19+
alias djm='run_in_dotenv python manage.py'
2020
alias test='DJANGO_SETTINGS_MODULE=project.settings.test run_in_dotenv pytest -x --reuse-db'
2121
alias test-no-reuse='DJANGO_SETTINGS_MODULE=project.settings.test run_in_dotenv pytest -x'
2222

0 commit comments

Comments
 (0)