feat: migrate standalone scripts to their own uv projects (4/5)#38838
Conversation
…on 4/5)
Gives scripts/xblock, scripts/user_retirement, and scripts/structures_pruning
each their own standalone pyproject.toml + uv.lock, mirroring the
codejail sandbox pattern from PR 3. structures_pruning's local
[tool.edx_lint].uv_constraints keeps the pymongo<4.4.1 pin it inherited
via the old "-c ../../../requirements/constraints.txt" chain.
These scripts are documented (in their own READMEs) to support git
sparse-checkout usage -- cloning only e.g. scripts/user_retirement/
without the rest of edx-platform. A self-contained pyproject.toml is
actually an improvement here over the old relative "-c
../../../requirements/constraints.txt" reference, which wouldn't even
resolve in a sparse checkout that excludes the root requirements/ dir.
Compatibility .txt exports are kept at their previously-documented
paths (e.g. scripts/user_retirement/requirements/{base,testing}.txt)
since each script's own README explicitly instructs `pip install -r`
against those exact paths.
Also fixes check-consistent-dependencies.yml's path filter and the two
PR-creating workflows' add-paths, neither of which would have picked
up changes to the new scripts/*/pyproject.toml or uv.lock files.
Part of openedx/public-engineering#543 (4 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. |
Summary
PR 4 of 5 in the pip-compile -> uv migration tracked in openedx/public-engineering#543.
Stacked on #38837 (PR 3), which is stacked on #38836 (PR 2), which is stacked on #38835 (PR 1) — this diff only shows PR 4's own changes.
pyproject.tomldeps/dependency-groups + commituv.lockMakefile,tox.ini, and CI touvfor the main appuvprojectuvprojectsWhat changed
scripts/xblock,scripts/user_retirement, andscripts/structures_pruningeach get their ownpyproject.toml+uv.lock, mirroring the codejail sandbox pattern from PR 3 ([tool.uv].package = false— none of these are everpip install -e'd).scripts/structures_pruningkeeps a local[tool.edx_lint].uv_constraints = ["pymongo<4.4.1"], inherited from the old-c ../../../requirements/constraints.txtchain — confirmed the resolvedpymongo==4.4.0matches exactly what pip-compile produced before.scripts/xblockandscripts/user_retirementneed no local constraints (their deps don't intersect the root's pins)..txtexports kept at their previously-documented paths: each script directory's own README explicitly instructspip install -r scripts/<name>/requirements/base.txt(orscripts/xblock/requirements.txt), so those exact paths are preserved asuv export --no-hashes --no-emit-projectartifacts rather than moved/flattened.git sparse-checkout(cloning e.g. onlyscripts/user_retirement/without the rest of edx-platform). The old-c ../../../requirements/constraints.txtreference would never even resolve in such a checkout (the file lives 3 directories above the sparse-checked-out root) — a self-containedpyproject.tomlis a genuine correctness improvement here, not just a lateral move.Makefile: theUV_SUBPROJECTScomment/list now covers all 4 sub-projects. Since their compat-export file layouts aren't uniform (singlebase.txtvs singlerequirements.txtvsbase.txt+testing.txtpairs),compile-requirementshandles each explicitly rather than through one generic loop. The now-emptyREQ_FILESpip-compile loop (previously iterating over these same 3 script dirs) is removed entirely — there's nothing left for it to compile.check-consistent-dependencies.yml's regex and both PR-creating workflows' (compile-python-requirements.yml,upgrade-one-python-dependency.yml)add-pathsdidn't account for the newscripts/*/pyproject.toml/uv.lockpaths — fixed so dependency changes there are correctly detected/committed.External compatibility (tutor/Docker, org-level
.githubworkflows)tutor/env/build/openedx/Dockerfile) that it does not referencescripts/xblock,scripts/user_retirement, orscripts/structures_pruningat all — onlyrequirements/edx/{base,assets,development}.txt(handled in PR 2). The compat.txtexports added here preserve each script directory's own documentedpip install -rcontract, not a tutor/Docker one..githubreusable workflows: this repo'scompile-python-requirements.ymlandupgrade-one-python-dependency.ymlare repo-local (not delegated toopenedx/.github), so theadd-pathsfix above is a local fix only — no coordination needed with the org-level.githubrepo for this PR. (The one workflow that does delegate,upgrade-python-requirements.yml, was already confirmed uv-aware in PR 2 and isn't touched here.)Not yet deleted
requirements/constraints.txt,requirements/common_constraints.txt, andrequirements/pip-tools.{in,txt}are now fully unused (this was the last pip-compile consumer) but are left in place for PR 5 to remove, along with the now-vestigialpre-requirementsMakefile target — keeping this PR scoped to the scripts migration itself.Verification
uv lockfor all three sub-projects inside anubuntu:24.04container — resolves cleanly (6/70/15 packages respectively); confirmedpymongo==4.4.0instructures_pruning's lock matches the constraint.uv sync --group test --frozen+ explicitimportchecks for every direct dependency in all three sub-projects — all succeed.make compile-requirementsre-run end-to-end (root + all 4 uv sub-projects) — completes cleanly.yaml.safe_load.🤖 Generated with Claude Code