Skip to content

build(tox): migrate from pip to uv via tox-uv#6390

Draft
sentry-junior[bot] wants to merge 1 commit into
masterfrom
chore/migrate-to-tox-uv
Draft

build(tox): migrate from pip to uv via tox-uv#6390
sentry-junior[bot] wants to merge 1 commit into
masterfrom
chore/migrate-to-tox-uv

Conversation

@sentry-junior
Copy link
Copy Markdown

@sentry-junior sentry-junior Bot commented May 22, 2026

What

Replaces pip-backed tox virtualenv environments with uv using the tox-uv plugin. The test matrix (envlist, Python versions, all deps) is unchanged — only the install backend changes.

Changes

scripts/populate_tox/tox.jinja + tox.ini

  • [tox] requires: swap virtualenv<20.26.3 for tox-uv. The virtualenv pin existed only to prevent pip 24.1 being seeded into envs — irrelevant once uv manages all installs.
  • setenv: remove py3.14t: VIRTUALENV_PIP=24.1 (virtualenv-specific env var, 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 section.

scripts/split_tox_gh_actions/templates/test_group.jinja

  • CI setup step: pip install "coverage[toml]" toxpython -m pip install "coverage[toml]" tox tox-uv

⚠️ Follow-up needed after merge

The GitHub App doesn't have workflows permission, so the 15 generated test-integrations-*.yml files couldn't be included. After merging, run:

scripts/generate-test-files.sh

And commit the result. The only change in each CI file will be the one-liner:

-          pip install "coverage[toml]" tox
+          python -m pip install "coverage[toml]" tox tox-uv

Deferred

Python 3.6 CI container handling (the python:3.6 Docker container currently runs tox, but tox+tox-uv require Python ≥3.10). See the migration plan canvas for the recommended fix.

Verification

# Verify plugin loaded
pip install tox tox-uv && tox --version

# Smoke test env creation (no actual test runs)
tox -e py3.11-flask-v1.1.4 --notest -r
tox -e py3.8-boto3-v1.33.13 --notest -r
tox -e py3.14t-common --notest -r

Action taken on behalf of Neel Shah.

View Session in Sentry

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 <neel.shah@sentry.io>

---
[View Session in Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC02T4BB83AS%3A1779437966.628249%22)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Codecov Results 📊

2205 passed | ⏭️ 154 skipped | Total: 2359 | Pass Rate: 93.47% | Execution Time: 8m 29s

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 13162 uncovered lines.


Generated by Codecov Action

Comment on lines +174 to +176
{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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flask v1 compat deps use wrong factor selector and will never be installed

The condition flask-v{1} expands to the factor flask-v1, but the only Flask v1 environments in the envlist are named flask-v1.1.4 (factor v1.1.4). Tox factor matching requires an exact match of each dash-separated component, so v1 ≠ v1.1.4 — the itsdangerous, markupsafe, and jinja2 compat deps will never be installed, leaving py3.6/7/8-flask-v1.1.4 environments broken. The condition should be flask-v1.1.4 and should include py3.6.

Evidence
  • Envlist (tox.ini:295) defines only {py3.6,py3.7,py3.8}-flask-v1.1.4; no env with factor v1 exists.
  • flask-v{1} in a tox deps condition generates the compound factor selector flask-v1, which requires both flask and v1 to be present as dash-split factors in the env name.
  • Env py3.7-flask-v1.1.4 has factors py3.7, flask, v1.1.4v1 is absent, so the condition never fires.
  • By contrast, the existing flask-v1.1.4: markupsafe<2.1.0 (tox.ini:804) correctly uses the full versioned factor and does match.
  • The generated tox.ini (lines 949–951) reproduces the same broken selector verbatim, confirming the template is the source of truth.

Suggested fix: Replace flask-v{1} with flask-v1.1.4 and add the missing py3.6 factor to match the actual envlist entry.

Suggested change
{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
{py3.6,py3.7,py3.8}-flask-v1.1.4: itsdangerous>=0.24,<2.0
{py3.6,py3.7,py3.8}-flask-v1.1.4: markupsafe<2.0.0
{py3.6,py3.7,py3.8}-flask-v1.1.4: jinja2<3.1.1
Also found at 1 additional location
  • tox.ini:949-951

Identified by Warden find-bugs · KJA-VQJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants