From a73707ecc94cac8eeee3018d0d46adb3165ce1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Link?= Date: Fri, 16 Oct 2026 17:29:13 -0300 Subject: [PATCH] Compile only the test group into requirements-test.txt requirements-test.txt was compiled from the project plus its test group, so it repeated every production pin. Those are compiled for the Docker image's Python version, and some aren't installable on the next one: in pipe-encounters, grpcio 1.65.5 (pinned by Beam for 3.12) has no 3.13 wheel, so the CI job on 3.13 failed in make install-test while building it from source. make reqs now compiles only the group (--group pyproject.toml:test), still constrained by requirements.txt so the shared packages match production. The test image installs the same test dependencies on top of the production image; the 3.13 job resolves the package's own dependencies with pip install. --- CONTRIBUTING.md | 8 +++++--- Makefile | 4 ++-- requirements-test.txt | 39 +-------------------------------------- 3 files changed, 8 insertions(+), 43 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e5e7e3..ce5a1c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,9 +122,11 @@ is automatically generated with `uv pip compile`, based on the dependencies spec consistently across different environments. `requirements-test.txt` does the same for the test dependencies, declared in the `test` -[dependency group] of `pyproject.toml`. It is compiled against the pins in `requirements.txt`, -so the test image can install just the test dependencies on top of the production image -and test the package exactly as it is deployed. +[dependency group] of `pyproject.toml`. It contains only the test dependencies, kept compatible +with the pins in `requirements.txt`, so the test image can install just them on top of the +production image and test the package exactly as it is deployed. +It doesn't repeat the production pins: those are compiled for the Docker image's Python version, +and the CI job on the next Python version installs the package with its own resolution. Use `pyproject.toml` to define high-level dependencies with flexible version constraints (e.g., `~=1.2`, `>=1.0`, `<2.0`, ...). diff --git a/Makefile b/Makefile index de7bf2a..964550a 100644 --- a/Makefile +++ b/Makefile @@ -56,13 +56,13 @@ docker-shell: docker-volume reqs: docker compose run --rm ${DOCKER_AS_USER} ${DOCKER_DEV_NO_GCP_SERVICE} -c \ '${PIP_COMPILE} -o ${REQS_PROD} ${SETUP_FILE} -v && \ - ${PIP_COMPILE} --group test -c ${REQS_PROD} -o ${REQS_TEST} ${SETUP_FILE} -v' + ${PIP_COMPILE} --group ${SETUP_FILE}:test -c ${REQS_PROD} -o ${REQS_TEST} -v' .PHONY: reqs-upgrade ## Upgrades requirements.txt and requirements-test.txt with uv. reqs-upgrade: docker compose run --rm ${DOCKER_AS_USER} ${DOCKER_DEV_NO_GCP_SERVICE} -c \ '${PIP_COMPILE} -o ${REQS_PROD} ${SETUP_FILE} -U -v && \ - ${PIP_COMPILE} --group test -c ${REQS_PROD} -o ${REQS_TEST} ${SETUP_FILE} -U -v' + ${PIP_COMPILE} --group ${SETUP_FILE}:test -c ${REQS_PROD} -o ${REQS_TEST} -U -v' # --------------------- # VIRTUAL ENVIRONMENT diff --git a/requirements-test.txt b/requirements-test.txt index e823b44..959346d 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,29 +1,9 @@ # This file was autogenerated by uv via the following command: -# uv pip compile --group test -c requirements.txt -o requirements-test.txt pyproject.toml +# uv pip compile --group pyproject.toml:test -c requirements.txt -o requirements-test.txt coverage==7.16.2 # via pytest-cov -gfw-common==0.20.3 - # via - # -c requirements.txt - # python-app-template (pyproject.toml) iniconfig==2.3.1 # via pytest -jinja2==3.1.6 - # via - # -c requirements.txt - # gfw-common -markdown-it-py==4.2.0 - # via - # -c requirements.txt - # rich -markupsafe==3.0.4 - # via - # -c requirements.txt - # jinja2 -mdurl==0.1.2 - # via - # -c requirements.txt - # markdown-it-py packaging==26.3 # via pytest pluggy==1.7.0 @@ -34,7 +14,6 @@ pygments==2.21.0 # via # -c requirements.txt # pytest - # rich pytest==9.1.1 # via # python-app-template (pyproject.toml:test) @@ -44,19 +23,3 @@ pytest-cov==7.1.0 # via python-app-template (pyproject.toml:test) pytest-mock==3.16.0 # via python-app-template (pyproject.toml:test) -python-dateutil==2.9.0.post0 - # via - # -c requirements.txt - # gfw-common -pyyaml==6.0.3 - # via - # -c requirements.txt - # gfw-common -rich==14.3.4 - # via - # -c requirements.txt - # gfw-common -six==1.17.0 - # via - # -c requirements.txt - # python-dateutil