feat: modernize Python tooling to uv + pyproject.toml + semantic-release - #704
Conversation
|
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. |
Per explicit direction on PR openedx#704 review thread r3880106779: follow sample-plugin's release.yml exactly, including this pin, superseding the skill's prior guidance (reversed 2026-08-05) to leave this one action on the floating @release/v1 tag. SHA verified against the action repo's own tag history before use (dc37677b -> v1.14.2). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9218fb4 to
0c6634e
Compare
Modernize openedx-core to uv + pyproject.toml (PEP 621/735) + python-semantic-release. Part of openedx/public-engineering#506 (tracked in openedx/public-engineering#516). - Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata), version derived from git tags via setuptools-scm. - Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock. - Update tox.ini to use tox-uv with uv-venv-lock-runner. - Update CI to use astral-sh/setup-uv; SHA-pin all actions. - Add python-semantic-release + release.yml, replacing the old token-based pypi-publish.yml with OIDC trusted publishing. - src/ layout not touched -- this repo already used it, so no change was needed here. - Delete setup.py, setup.cfg, .coveragerc, requirements/ (all .in/.txt files, constraints.txt, private.readme), .github/workflows/pypi-publish.yml. Addresses salman2013's PR review feedback: - Keep the CI job name as tests, matching the pre-migration name (deferring the per-toxenv rename to avoid breaking required-status-check matching). - __version__ falls back to "unknown" on PackageNotFoundError instead of leaving it unset, with the except branch marked pragma: no cover since the package is always installed in CI. - Remove the legacy, unused .readthedocs.yml (superseded by .readthedocs.yaml). - Drop an unintended fetch-depth: 0 on the checkout step -- a leftover side effect of removing the separate setup-python step, not a deliberate choice. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0c6634e to
ec638c2
Compare
Summary
Modernize
openedx-coreto uv + pyproject.toml (PEP 621/735) + python-semantic-release.Part of openedx/public-engineering#506 (tracked in openedx/public-engineering#516).
setup.py/setup.cfgwithpyproject.toml(PEP 621 static metadata), version derived from git tags viasetuptools-scmuvwith PEP 735 dependency groups; commituv.locktox.inito usetox-uvwithuv-venv-lock-runnerastral-sh/setup-uv; SHA-pin all actionspython-semantic-release+release.yml, replacing the old token-basedpypi-publish.ymlwith OIDC trusted publishingNot included:
src/layout. This repo already usessrc/openedx_{core,content,tagging,catalog}andsrc/openedx_django_lib, so Phase 0 of the org-wide migration (openedx/public-engineering#506's 2026-07-15 decision) required no changes here — MANIFEST.in,.coveragerc's (now[tool.coverage.run])source,docs/conf.py'ssys.pathentries, andtox.inialready pointed atsrc/.Removed
Deleted files:
setup.py,setup.cfg,.coveragerc,.readthedocs.yml(legacy duplicate of.readthedocs.yaml),requirements/(all.in/.txtfiles,constraints.txt,private.readme),.github/workflows/pypi-publish.yml(replaced byrelease.yml, OIDC instead of thePYPI_UPLOAD_TOKENsecret).Removed Makefile targets:
compile-requirementsuv lockupgradeandrequirementstargets were kept but rewritten to useuv(edx_lint write_uv_constraints+uv lock --upgrade, anduv sync --group dev, respectively) instead ofpip-compile/pip-sync.Versioning
Dynamic —
setuptools-scmderives the build version from the latest git tag. Pre-flight check passed: latest git tagv1.1.0matches the version currently live on PyPI (1.1.0), so the first automated release should compute the correct next version from conventional-commit history.Testing Notes
Verified locally:
uv lockresolves cleanly (156 packages)uv sync(base project, no groups) succeeds; editable install makes all five packages (openedx_core,openedx_content,openedx_tagging,openedx_django_lib,openedx_catalog) importable, withopenedx_core.__version__correctly resolving to1.1.0viaimportlib.metadatapython -m build+twine check dist/*both pass; inspected the built wheel and confirmed all five packages (withpy.typedmarkers) are bundled correctlymypyresolves the editable install correctly under this repo's existingsrc/layout (ran ad hoc with a partial dependency set due to a local sandbox limitation below; it got past all import/plugin resolution and only flagged missingpytest/freezegunstubs from the deliberately-partial ad hoc install, not a resolution problem)tox -llists all envs correctly (py312-django52,quality,docs,pii_check,lint-imports) —tox.iniparses cleanly against the new[dependency-groups]namesCould not verify locally:
uv sync --group dev(andtest/quality/doc) fails to build in this sandbox becausemysqlclienthas no macOS wheel and needs local MySQL client headers unavailable here. This predates the migration (same coupling existed via the oldrequirements/test.in) and is expected to build fine on GitHub Actions'ubuntu-latestrunners, which ship with MySQL client libraries preinstalled. Full test-suite / quality-check execution therefore relies on this PR's own CI run.Code reviewer notes
openedx-core(tracked in the consolidated comment on Tbain/253 add tags count #506) before the first automated release can publish.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKENsecret used byrelease.ymlis configured for this repo..github/workflows/upgrade-python-requirements.ymlcallsopenedx/.github's shared reusable workflow, which hardcodesadd-paths: requirementswith no override input. Now thatrequirements/is deleted, that scheduled job will keep running but silently stop producing real dependency-upgrade PRs (empty diff, no failure, no alert). This can't be fixed from this repo — it needs a fix inopenedx/.githubitself (e.g. parameterizingadd_paths, or auto-detectinguv.lockvs.requirements/).mysqlclientis bundled into thetest-basedependency group (and thereforetest/quality/doc/ci/devtransitively), matching the pre-migration coupling inrequirements/test.in→quality.in/doc.in/dev.in. This is why the "Not included"/"Testing Notes" sections above call out the local verification gap.[dependency-groups].ciis intentionally minimal (tox,tox-uvonly, noinclude-group) — CI's ownuv sync --group cistep only needstoxonPATH;toxinstalls each env's actual dependency group itself viauv-venv-lock-runner.This PR was created with Claude Code.