Skip to content

feat: replace pip-compile with uv#31

Merged
feanil merged 6 commits intomainfrom
feanil/switch_to_uv
Apr 27, 2026
Merged

feat: replace pip-compile with uv#31
feanil merged 6 commits intomainfrom
feanil/switch_to_uv

Conversation

@feanil
Copy link
Copy Markdown
Contributor

@feanil feanil commented Apr 23, 2026

Summary

Replaces the pip-compile / pip-sync toolchain with uv, consolidating all dependency declarations into pyproject.toml and replacing the multiple requirements/*.txt lockfiles with a single uv.lock.

  • Moves runtime deps to a static [project].dependencies list
  • Adds PEP 735 [dependency-groups] (test-base, test, django42, quality, doc, ci, dev) replacing all requirements/*.in files
  • Uses [tool.uv].conflicts so a single uv.lock covers both the Django 4.2 and 5.2 matrix entries with fully reproducible installs (uv-venv-lock-runner)
  • Adds [tool.uv].constraint-dependencies managed by edx_lint write_uv_constraints (see feat: add write_uv_constraints command to manage uv constraint-dependencies edx-lint#537)
  • Updates tox.ini to use tox-uv with uv-venv-lock-runner and dependency group factor conditionals
  • Updates Makefile: compile-requirementsuv lock, upgrade → write constraints then uv lock --upgrade, requirementsuv sync --group dev
  • Updates backend-ci.yml to install uv via astral-sh/setup-uv and run uv sync --group ci
  • Removes entire requirements/ directory
  • Adds docs/how-tos/adding-a-matrix-dependency.rst explaining how to add or retire any version from the test matrix

Dependencies

This PR depends on openedx/edx-lint#537 being merged and released to PyPI before make upgrade will work (the upgrade target calls uv run --with edx-lint edx_lint write_uv_constraints). Everything else works independently of that PR.

@feanil feanil force-pushed the feanil/switch_to_uv branch from a3d8c89 to 501cb25 Compare April 24, 2026 12:34
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.23%. Comparing base (00d6874) to head (52e61b6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #31   +/-   ##
=======================================
  Coverage   88.23%   88.23%           
=======================================
  Files          13       13           
  Lines         408      408           
  Branches       16       16           
=======================================
  Hits          360      360           
  Misses         40       40           
  Partials        8        8           
Flag Coverage Δ
unittests 88.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replaces dynamically-loaded dependencies (from requirements/base.in)
with a static [project].dependencies list, and adds [dependency-groups]
(PEP 735) covering test/quality/doc/ci/dev groups. Also adds
[tool.uv].constraint-dependencies (machine-managed via edx_lint
write_uv_constraints) and creates constraints.txt as the hook for
future repo-specific pins.

The .in files are removed since [dependency-groups] replaces them.
The compiled .txt lockfiles are removed in a follow-up commit together
with the uv.lock.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@feanil feanil force-pushed the feanil/switch_to_uv branch from 501cb25 to ae54e6d Compare April 27, 2026 13:59
Copy link
Copy Markdown

@bmtcril bmtcril left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, I think we would want that matrix dependency doc elsewhere as well since we're going to need it in many places

feanil and others added 5 commits April 27, 2026 10:48
Adds tox-uv>=1 to [tox].requires. Switches all testenv sections to
uv-venv-lock-runner so every run installs exactly from uv.lock.

For the Django version matrix, splits test-base (framework-agnostic
pytest deps) from test (test-base + current Django 5.2). The django42
group holds the legacy Django 4.2 pin. Declaring these groups as
conflicting in [tool.uv].conflicts lets uv produce a single uv.lock
with a separate resolution per group. Tox factor conditionals select
the right group per environment.

Adds docs/how-tos/adding-a-matrix-dependency.rst explaining how to add
or retire a version from any dependency matrix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces pip-compile targets with uv equivalents:
- compile-requirements: runs uv lock (generates lockfile without upgrading)
- upgrade: writes constraints via edx_lint write_uv_constraints first,
  then runs uv lock --upgrade
- requirements: runs uv sync --group dev (installs project in editable
  mode automatically, no separate pip install -e . needed)

Removes PIP_COMPILE variable, piptools target, and all pip-sync usage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces pip install steps with astral-sh/setup-uv and uv sync --group ci.
tox and tox-uv are in the ci group; uv sync also installs the project
itself so everything tox needs is available. uv.lock ensures reproducible
installs in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deletes the entire requirements/ directory (all .txt lockfiles and
constraints.txt — the local constraints file has moved to constraints.txt
next to pyproject.toml). Adds the generated uv.lock which replaces all
the individual .txt lockfiles with a single universal lockfile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Django 6.0 requires Python 3.12+, so Python 3.11 is also dropped from
the matrix and requires-python is bumped to >=3.12.

- Replaces django42 group with django60 (Django>=6.0,<7.0)
- Adds Django<7.0 to constraints.txt to override the global Django<6.0
  constraint from edx-lint, allowing Django 6.x to resolve
- Updates [tool.uv].conflicts and tox envlist/factor conditionals
- Regenerates uv.lock with both Django 5.2 and 6.0 resolutions

BREAKING CHANGE: Python 3.11 is no longer supported (requires Python 3.12+) and Django 4.2 is no longer tested or supported.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@feanil feanil force-pushed the feanil/switch_to_uv branch from ae54e6d to 52e61b6 Compare April 27, 2026 14:49
@feanil
Copy link
Copy Markdown
Contributor Author

feanil commented Apr 27, 2026

@bmtcril good call out on the doc, I moved it to docs.openedx.org and just linked to it from here: openedx/docs.openedx.org#1436

@feanil feanil merged commit 0884981 into main Apr 27, 2026
9 checks passed
@feanil feanil deleted the feanil/switch_to_uv branch April 27, 2026 14:59
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.

2 participants