Skip to content

Commit 34a0378

Browse files
committed
[chore] Update uv, update Django version, some TLC for the GH Actions
1 parent 0ca4188 commit 34a0378

File tree

5 files changed

+66
-91
lines changed

5 files changed

+66
-91
lines changed

.github/workflows/test-suite.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,36 @@ jobs:
1919
runs-on: "ubuntu-latest"
2020

2121
steps:
22+
# Setup
2223
- uses: "actions/checkout@v4"
2324
- name: Install uv
24-
uses: astral-sh/setup-uv@v2
25+
uses: astral-sh/setup-uv@v4
2526
with:
26-
version: "0.4.9"
27+
version: "0.5.7"
2728
enable-cache: true
2829
cache-dependency-glob: "uv.lock"
29-
- name: Set up Python
30+
- name: Install Python, via uv
3031
run: uv python install
3132
- name: "Install dependencies via uv"
3233
run: uv sync --all-extras
3334
- name: "Install the project in 'editable' mode"
3435
run: uv pip install -e .
36+
37+
# Code quality checks
3538
- name: "Run linting checks: Ruff checker"
3639
run: uv run --no-sync ruff format --check --quiet src/
3740
- name: "Run linting checks: Ruff linter"
3841
run: uv run --no-sync ruff check --quiet src/
3942
- name: "Run linting checks: Mypy"
4043
run: uv run --no-sync mypy src/
44+
- name: "Run linting checks: fix-future-annotations"
45+
run: uv run --no-sync fix-future-annotations src/
4146
- name: "Check that Django DB migrations are up to date"
42-
run: uv run --no-sync python manage.py makemigrations | grep "No changes detected"
47+
run: uv run --no-sync python manage.py makemigrations --check
48+
49+
# Test suite & code coverage
4350
- name: "Run tests"
44-
# TODO: progressively increase minimum coverage to something closer to 80%
51+
# TODO: progressively increase minimum coverage to something closer to 80%
4552
run: uv run --no-sync pytest --cov=src --cov-report xml:coverage.xml
4653
# --cov-fail-under=60 --> we'll actually do that with the "Report coverage" step
4754
- name: "Report coverage"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ EOT
7575

7676
# Install uv.
7777
# https://docs.astral.sh/uv/guides/integration/docker/
78-
COPY --from=ghcr.io/astral-sh/uv:0.4.9 /uv /usr/local/bin/uv
78+
COPY --from=ghcr.io/astral-sh/uv:0.5.7 /uv /usr/local/bin/uv
7979

8080
RUN mkdir -p /app
8181
WORKDIR /app

Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +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_PYTHON ?= ${PYTHON}
65
UV ?= bin/uv
7-
UVX ?= bin/uvx
86

97
.DEFAULT_GOAL := help
108

@@ -116,8 +114,7 @@ code-quality/mypy: ## Python's equivalent of TypeScript
116114
code-quality/fix-future-annotations: fix_future_annotations_opts ?=
117115
code-quality/fix-future-annotations: ## Make sure we're using PEP 585 and PEP 604
118116
# @link https://github.com/frostming/fix-future-annotations
119-
@UV_PYTHON=${UV_PYTHON} \
120-
${UVX} fix-future-annotations ${fix_future_annotations_opts} src/
117+
@${PYTHON_BINS}/fix-future-annotations ${fix_future_annotations_opts} src/
121118

122119
# Here starts the frontend stuff
123120

@@ -185,10 +182,10 @@ frontend/img/copy_assets:
185182

186183
# Here starts the "misc util targets" stuff
187184

188-
bin/uv: uv_version ?= 0.4.9
185+
bin/uv: uv_version ?= 0.5.7
189186
bin/uv: # Install `uv` and `uvx` locally in the "bin/" folder
190187
curl -LsSf "https://astral.sh/uv/${uv_version}/install.sh" | \
191-
CARGO_DIST_FORCE_INSTALL_DIR="$$(pwd)" INSTALLER_NO_MODIFY_PATH=1 sh
188+
UV_INSTALL_DIR="$$(pwd)/bin" UV_NO_MODIFY_PATH=1 sh
192189
@echo "We'll use 'bin/uv' to manage Python dependencies."
193190

194191
.venv: ## Initialises the Python virtual environment in a ".venv" folder, via uv

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ requires-python = ">=3.11"
1212

1313
dependencies= [
1414
# Django doesn't follow SemVer, so we need to specify the minor version:
15-
"Django==5.1.*",
15+
"django==5.1.*",
1616
"gunicorn==22.*",
1717
"uvicorn[standard]==0.30.*",
1818
"uvicorn-worker==0.2.*",
@@ -43,11 +43,7 @@ dev = [
4343
"types-requests==2.*",
4444
"django-extensions==3.*",
4545
"sqlite-utils==3.*",
46-
# N.B. As it turns out that Lichess' "Berserk" package misses some features we need,
47-
# such as the creation of correspondence Seeks...
48-
# And as we had to wrap evey call in an `sync_to_async` anyway, which was not great...
49-
# We only use for its `types` module at the momemt.
50-
"berserk==0.13.*",
46+
"fix-future-annotations>=0.5.0",
5147
]
5248
test = [
5349
"pytest==8.3.*",

0 commit comments

Comments
 (0)