From f7d0dfabcc0674de38207c0a4d0e6d19e5ddda4c Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 08:41:50 +0000 Subject: [PATCH] build(tox): migrate from pip to uv via tox-uv Replace pip-backed virtualenv environments with uv using the tox-uv plugin. - [tox] requires: swap virtualenv<20.26.3 pin for tox-uv; the virtualenv pin existed solely to prevent pip 24.1 being seeded into envs, which is irrelevant once uv manages all installs - setenv: remove py3.14t VIRTUALENV_PIP=24.1 (virtualenv-specific, no-op with tox-uv's uv venv) - commands: remove bare 'pip install' workaround lines; tox-uv does not seed pip into venvs so these would fail - deps: add flask v1 compat packages (itsdangerous, markupsafe, jinja2) as factor-conditional deps to replace the removed pip install commands; the urllib3<2.0.0 boto3 pin was already present in the auto-generated deps - CI templates updated (test_group.jinja); run scripts/generate-test-files.sh to regenerate the .github/workflows/test-integrations-*.yml files Test matrix (envlist, Python versions, deps) is unchanged. Note: Python 3.6 container handling is deferred; see plan canvas for the recommended approach of running tox under a modern Python host. Co-authored-by: Neel Shah --- [View Session in Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC02T4BB83AS%3A1779437966.628249%22) --- scripts/populate_tox/tox.jinja | 20 +++++++++---------- .../templates/test_group.jinja | 2 +- tox.ini | 20 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) mode change 100755 => 100644 scripts/populate_tox/tox.jinja diff --git a/scripts/populate_tox/tox.jinja b/scripts/populate_tox/tox.jinja old mode 100755 new mode 100644 index e386d87f1c..32b92ea054 --- a/scripts/populate_tox/tox.jinja +++ b/scripts/populate_tox/tox.jinja @@ -14,8 +14,7 @@ [tox] requires = - # This version introduced using pip 24.1 which does not work with older Celery and HTTPX versions. - virtualenv<20.26.3 + tox-uv envlist = # === Common === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14,py3.14t}-common @@ -167,14 +166,20 @@ deps = {% endfor %} + # === Compatibility overrides === + # These replace the old `pip install` workaround commands that pip-backed tox used. + # tox-uv does not seed pip into venvs, so all installs must go through deps. + + ; https://github.com/pallets/flask/issues/4455 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: itsdangerous>=0.24,<2.0 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: markupsafe<2.0.0 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: jinja2<3.1.1 + setenv = PYTHONDONTWRITEBYTECODE=1 OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES COVERAGE_FILE=.coverage-sentry-{envname} py3.6: COVERAGE_RCFILE=.coveragerc36 - # Lowest version to support free-threading - # https://discuss.python.org/t/announcement-pip-24-1-release/56281 - py3.14t: VIRTUALENV_PIP=24.1 django: DJANGO_SETTINGS_MODULE=tests.integrations.django.myapp.settings spark-v{3.0.3,3.5.6}: JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64 @@ -237,11 +242,6 @@ basepython = ruff: python3.14 commands = - {py3.7,py3.8}-boto3: pip install urllib3<2.0.0 - - ; https://github.com/pallets/flask/issues/4455 - {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: pip install "itsdangerous>=0.24,<2.0" "markupsafe<2.0.0" "jinja2<3.1.1" - ; Running `pytest` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. diff --git a/scripts/split_tox_gh_actions/templates/test_group.jinja b/scripts/split_tox_gh_actions/templates/test_group.jinja index 4b8f981789..82dc088b0b 100644 --- a/scripts/split_tox_gh_actions/templates/test_group.jinja +++ b/scripts/split_tox_gh_actions/templates/test_group.jinja @@ -69,7 +69,7 @@ - name: Setup Test Env run: | - pip install "coverage[toml]" tox + python -m pip install "coverage[toml]" tox tox-uv - name: Erase coverage run: | coverage erase diff --git a/tox.ini b/tox.ini index c11dc8e578..8114d3585c 100644 --- a/tox.ini +++ b/tox.ini @@ -14,8 +14,7 @@ [tox] requires = - # This version introduced using pip 24.1 which does not work with older Celery and HTTPX versions. - virtualenv<20.26.3 + tox-uv envlist = # === Common === {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13,py3.14,py3.14t}-common @@ -942,6 +941,15 @@ deps = typer-v0.25.1: typer==0.25.1 typer-latest: typer==0.25.1 + # === Compatibility overrides === + # These replace the old `pip install` workaround commands that pip-backed tox used. + # tox-uv does not seed pip into venvs, so all installs must go through deps. + + ; https://github.com/pallets/flask/issues/4455 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: itsdangerous>=0.24,<2.0 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: markupsafe<2.0.0 + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: jinja2<3.1.1 + setenv = @@ -949,9 +957,6 @@ setenv = OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES COVERAGE_FILE=.coverage-sentry-{envname} py3.6: COVERAGE_RCFILE=.coveragerc36 - # Lowest version to support free-threading - # https://discuss.python.org/t/announcement-pip-24-1-release/56281 - py3.14t: VIRTUALENV_PIP=24.1 django: DJANGO_SETTINGS_MODULE=tests.integrations.django.myapp.settings spark-v{3.0.3,3.5.6}: JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64 @@ -1070,11 +1075,6 @@ basepython = ruff: python3.14 commands = - {py3.7,py3.8}-boto3: pip install urllib3<2.0.0 - - ; https://github.com/pallets/flask/issues/4455 - {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: pip install "itsdangerous>=0.24,<2.0" "markupsafe<2.0.0" "jinja2<3.1.1" - ; Running `pytest` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module.