@@ -2,7 +2,6 @@ SHELL:=bash
22
33PYTHON_MODULE =lizmap
44
5- QGIS_VERSION ?= 3.40
65
76-include .localconfig.mk
87
@@ -17,7 +16,7 @@ ifdef VIRTUAL_ENV
1716# Always prefer active environment
1817ACTIVE_VENV =--active
1918endif
20- UV_RUN =uv run $(ACTIVE_VENV )
19+ UV =uv run $(ACTIVE_VENV )
2120endif
2221
2322
@@ -32,13 +31,6 @@ REQUIREMENTS_GROUPS= \
3231
3332REQUIREMENTS =$(patsubst % , requirements/% .txt, $(REQUIREMENTS_GROUPS ) )
3433
35- # Update only packaging dependencies
36- # Waiting for https://github.com/astral-sh/uv/issues/13705
37- update-packaging-dependencies ::
38- uv lock -P qgis-plugin-package-ci -P qgis-plugin-transifex-ci
39-
40- update-packaging-dependencies :: update-requirements
41-
4234update-requirements : $(REQUIREMENTS )
4335
4436# Require uv (https://docs.astral.sh/uv/) for extracting
@@ -56,53 +48,92 @@ requirements/%.txt: uv.lock
5648# Static analysis
5749#
5850
59- LINT_TARGETS =$(PYTHON_MODULE ) tests $(EXTRA_LINT_TARGETS )
51+ LINT_TARGETS =$(PYTHON_MODULE ) $(EXTRA_LINT_TARGETS )
6052
6153lint :
62- @ $(UV_RUN ) ruff check --output-format=concise $(LINT_TARGETS )
54+ @ $(UV ) ruff check --output-format=concise $(LINT_TARGETS )
55+ @ $(UV ) ruff check --output-format=concise --target-version=py310 tests
6356
6457lint-fix :
65- @ $(UV_RUN ) ruff check --fix $(LINT_TARGETS )
58+ @ $(UV ) ruff check --fix $(LINT_TARGETS )
59+ @ $(UV ) ruff check --fix --target-version=py310 tests
60+
61+ lint-preview :
62+ @ $(UV ) ruff check --preview --output-format=concise $(LINT_TARGETS )
6663
6764format :
68- @ $(UV_RUN ) ruff format $(LINT_TARGETS )
65+ @ $(UV ) ruff format $(LINT_TARGETS )
6966
7067typecheck :
71- $(UV_RUN ) mypy $(PYTHON_MODULE )
68+ $(UV ) mypy $(PYTHON_MODULE )
69+ $(UV ) mypy tests --python-version 3.10
7270
7371scan :
74- @ $(UV_RUN ) bandit -r $(PYTHON_MODULE ) $(SCAN_OPTS )
72+ @ $(UV ) bandit -r $(PYTHON_MODULE ) $(SCAN_OPTS )
7573
7674
77- check-uv-install :
78- @which uv > /dev/null || { \
79- echo " You must install uv (https://docs.astral.sh/uv/)" ; \
80- exit 1; \
81- }
82-
8375#
8476# Tests
8577#
8678
8779test :
88- $(UV_RUN ) pytest -v tests/
80+ $(UV ) pytest -v tests/
8981
9082#
9183# Test using docker image
9284#
93- QGIS_IMAGE_REPOSITORY ?= qgis/qgis
85+
86+ ifdef REGISTRY_URL
87+ REGISTRY_PREFIX =$(REGISTRY_URL ) /
88+ else
89+ REGISTRY_PREFIX =3liz
90+ endif
91+
92+ QGIS_VERSION ?= 3.44
93+ QGIS_IMAGE_REPOSITORY ?= ${REGISTRY_PREFIX}qgis-platform
9494QGIS_IMAGE_TAG ?= $(QGIS_IMAGE_REPOSITORY ) :$(QGIS_VERSION )
9595
9696export QGIS_VERSION
9797export QGIS_IMAGE_TAG
9898export UID =$(shell id -u)
9999export GID =$(shell id -g)
100+
100101docker-test :
101- cd .docker && docker compose up \
102+ set -e; \
103+ cd .docker;
104+ docker compose up \
102105 --quiet-pull \
103106 --abort-on-container-exit \
104- --exit-code-from qgis
105- cd .docker && docker compose down -v
107+ --exit-code-from qgis; \
108+ docker compose down -v;
109+
110+ #
111+ # Install/sync
112+ #
113+
114+ sync :
115+ @echo " Synchronizing python's environment with frozen dependencies"
116+ uv sync --all-groups --frozen --all-extras
117+
118+ install-dev ::
119+ @echo " Creating virtual python environment"
120+ uv venv --system-site-packages --no-managed-python
121+
122+ install-dev :: sync
123+
124+ #
125+ # Coverage
126+ #
127+
128+ # Run tests coverage
129+ covtests :
130+ @echo " Running coverage tests"
131+ @ $(UV ) coverage run -m pytest tests/
132+
133+ coverage : covtests
134+ @echo " Building coverage html"
135+ @ $(UV ) coverage html
136+
106137
107138#
108139# Code managment
0 commit comments