feat: cut over Makefile, tox.ini, and CI to uv (2/5)#38836
feat: cut over Makefile, tox.ini, and CI to uv (2/5)#38836irfanuddinahmad wants to merge 1 commit into
Conversation
Rewrites the Makefile's requirements targets, tox.ini, and ~13 CI workflows to use uv instead of pip-compile/pip-sync for the main app. Deletes requirements/edx/*.in and *.txt (superseded by pyproject.toml + uv.lock, added in PR 1 / #38835). requirements/constraints.txt, common_constraints.txt, and pip-tools.{in,txt} are intentionally kept for now: requirements/edx-sandbox and scripts/* still pip-compile against them and aren't migrated until PR 3/4. requirements/edx/{base,assets,development}.txt are regenerated as `uv export` compatibility artifacts (via the Makefile's compile-requirements target) since external tooling -- notably tutor's Dockerfile -- installs from those exact paths with plain pip, not uv. check_python_dependencies.yml is disabled (workflow_dispatch only, job gated with if: false) since find_python_dependencies can't scan pyproject.toml yet; tracked at openedx/repo-tools#725. User-confirmed before committing since this removes a CI safety net. Part of openedx/public-engineering#543 (2 of 5). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Deletes requirements/constraints.txt, common_constraints.txt, and
pip-tools.{in,txt} -- these were kept alive through PR 2-4 because
requirements/edx-sandbox and scripts/* still pip-compiled against
them, but PR 4 was the last consumer, so they're now fully unused.
Removes the correspondingly-vestigial Makefile machinery: the
pre-requirements target, the COMMON_CONSTRAINTS_TXT curl-fetch-and-sed
target, and the CUSTOM_COMPILE_COMMAND/COMPILE_OPTS variables that only
existed to feed pip-compile invocations which no longer exist anywhere
in this repo.
Finalizes requirements/README.rst for the fully-migrated state and
fixes a couple of remaining stale references (constraints.txt ->
[tool.edx_lint].uv_constraints).
This is the last of 5 PRs migrating openedx-platform from pip-compile
to uv + PEP 621/735 pyproject.toml, tracked in
openedx/public-engineering#543. Two follow-up
items remain outside this repo's control:
- openedx/repo-tools#725: find_python_dependencies needs pyproject.toml
support before check_python_dependencies.yml can be re-enabled.
- Tutor's Dockerfile installs from requirements/edx/{base,assets,development}.txt
with plain pip; those are kept as `uv export` compatibility artifacts
(see PR 2 / #38836) rather than deleted, so no action is required there,
but tutor maintainers should be aware these are now generated files.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
PR 2 of 5 in the pip-compile -> uv migration tracked in openedx/public-engineering#543 (child of #506).
Stacked on #38835 (PR 1) — this branch is based on
irfanuddinahmad/uv-migration-01-pyproject-deps, so this diff only shows PR 2's own changes. It'll retarget tomasterautomatically once PR 1 merges.pyproject.tomldeps/dependency-groups + commituv.lock(additive only)Makefile,tox.ini, and CI touv; delete the oldrequirements/edx/*.{in,txt}filesrequirements/edx-sandbox/) to its own standaloneuvprojectuvprojectsWhat changed
dev-requirements/base-requirements/test-requirementsnow calluv syncwith the appropriate group flags (--group dev,--no-default-groups,--only-group testing) instead ofpip-sync. Target names are kept stable since several CI workflows call them by name.compile-requirements/upgradenow runedx_lint write_uv_constraints+uv lock, and still pip-compilerequirements/edx-sandbox+scripts/*(not migrated until PR 3/4) — see "Intentionally not deleted yet" below.tox-uv>=1+runner = uv-venv-lock-runner+dependency_groups = testing, replacingusedevelop/commands_pre = make test-requirements. Also fixed a pre-existing bug:envlist = py{312} quality(space-separated) is misparsed by current tox as a single envpy312quality— needed a comma.unit-tests,quality-checks,js-tests,semgrep,static-assets-check,migrations-check,lint-imports,ci-static-analysis,pylint-checks,compile-python-requirements,check-consistent-dependencies,upgrade-one-python-dependency): addastral-sh/setup-uv, add.venv/binto$GITHUB_PATHafteruv syncso later steps' barepython/pytestresolve correctly, and replace barepip freeze/pip install/pip checkwithuv pip freeze/uv pip install/uv pip check(uv-managed venvs don't shippip)..readthedocs.yaml: exports thedocdependency-group to a plain requirements.txt viauv exportin apost_create_environmenthook, then installs it into RTD's own managed venv viapost_install— chosen to avoid restructuring RTD's build model. This one needs real-world verification — I can't test an actual RTD build locally; the first real build after this merges will confirm it.requirements/edx/{base,assets,development}.txt: regenerated asuv export --no-emit-projectcompatibility artifacts (see "Tutor compatibility" below), refreshed automatically bymake compile-requirements.README.rst,requirements/README.rst,docs/references/static-assets.rst,docs/concepts/testing/testing.rst,scripts/watch_sass.sh,scripts/compile_sass.py— all hadpip install -r requirements/edx/*.txtexamples that would otherwise now point at nothing.check_python_dependencies.ymldisabled (workflow_dispatchonly, jobif: false):find_python_dependencies(fromedx-repo-tools) can only scan flatrequirements/*.txtfiles for undocumented git-hosted deps, notpyproject.toml. Filed openedx/repo-tools#725 to add that support; re-enable once it lands.uv.lockversions become the ones actually installed by CI andmake. See PR 1's "Dependency version changes" section — most are harmless bumps, butprotobuf/wraptdowngrade across a major version (transitively, viaedx-django-utils's OpenTelemetry-based FrontendMonitoringMiddleware) and a few packages (django-autocomplete-light,edxval,social-auth-core) jump a major version. Worth a specific look before merging, not just treating this as a mechanical tooling swap.make dev-requirements/base-requirements/test-requirementsnow install into a project-local.venv/instead of whatever Python is currently active on$PATH. Previously,pip-syncinstalled into whichever interpreterpipresolved to (an already-activated virtualenv, devstack's system Python, etc.). If you're used to activating your own venv first and then running these targets, packages will now land in.venv/instead — you'll wantsource .venv/bin/activate(oruv run ...) afterward. This matches uv's standard project model but is a real change in muscle memory for anyone doing local (non-devstack, non-CI) development.Intentionally not deleted yet
requirements/constraints.txt,requirements/common_constraints.txt, andrequirements/pip-tools.{in,txt}are kept —requirements/edx-sandbox/base.inand all threescripts/*/requirements/*.infiles still reference-c ../constraints.txt(or similar) and are still pip-compiled until PR 3/4 migrate them off pip-compile entirely. Deleting these now would break those sub-projects'make compile-requirements.Tutor compatibility
Confirmed (
~/Library/Application Support/tutor/env/build/openedx/Dockerfile) that tutor's Docker build doespip install -r requirements/edx/base.txt -r requirements/edx/assets.txtand separatelypip install -r requirements/edx/development.txt, with plainpip, not uv. Deleting these files outright would break every tutor-based Open edX deployment build. Instead,make compile-requirementsnow regenerates them asuv export --no-hashes --no-emit-projectartifacts (verified they exclude the-e .self-reference uv adds by default, which the old files never had and which would likely break tutor's multi-stage build where only the requirements file, not the full source tree, is mounted at that layer).Bugs found and fixed along the way
edx-lint'swrite_uv_constraintscrashes on this repo'spyproject.toml(fixed in PR 1, carries forward here) — confirmed idempotent and safe on the already-populated file, somake upgradeworks going forward without repeating the workaround.openedx/.githubreusableupgrade-python-requirements.ymlworkflow already addeduvsupport (installs uv, callsmake upgradegenerically) — no changes needed to this repo'supgrade-python-requirements.ymlat all. This removes what I'd originally expected to be a blocking external dependency.uv lock/uv sync/uv run(in-project) needlibmysqlclient-dev+libxmlsec1-devsystem packages that pip-compile apparently didn't need (confirmed empirically: mysqlclient'ssetup.pyunconditionally shells out topkg-configeven for metadata-only PEP 517 hooks, which uv always invokes for sdist-only packages). Added a system-requirements install step tocompile-python-requirements.yml,check-consistent-dependencies.yml, andupgrade-one-python-dependency.yml, none of which previously needed it.upgrade-one-python-dependency.yml's constraint patcher moved fromsed-patchingrequirements/constraints.txtto a smalltomlkit-based Python snippet editing[tool.edx_lint].uv_constraintsinpyproject.toml(run withuv run --no-projectto avoid syncing the whole project just to edit a TOML file). Verified end-to-end against a realpyproject.tomlcopy.Verification
make compile-requirements— validated end-to-end in anubuntu:24.04container (matching CI's system packages):uv locksucceeds, the tutor-compat exports are generated correctly, and the pip-compile loop foredx-sandbox/scripts/*produces byte-identical output to what's already committed (confirms untouched behavior for the not-yet-migrated sub-projects).tox -e quality --notest— validated in the same container; found and fixed theenvlistcomma bug in the process.yaml.safe_load.pyproject.toml/uv.lockfrom PR 1 unchanged by this PR.🤖 Generated with Claude Code