Repository navigation
feat: modernize Python tooling (pyproject.toml + uv + semantic-release) - #466
irfanuddinahmad wants to merge 5 commits into
Conversation
Move setup.py/setup.cfg/.coveragerc metadata, isort and coverage config into pyproject.toml (PEP 621/639) with setuptools-scm versioning, and read __version__ from installed package metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace requirements/*.in/*.txt with PEP 735 dependency groups and uv.lock. The tox DRF matrix (drf314/drflatest) now maps to the drf314 and test groups, declared as [tool.uv] conflicts so each resolves separately. Django and other global caps come from edx-lint via `edx_lint write_uv_constraints` instead of downloading common_constraints.txt in the Makefile. CI installs with setup-uv and runs tox through uv, and also runs the existing docs tox env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add release.yml based on openedx/sample-plugin's release workflow: it runs CI, lets python-semantic-release tag and build, creates the GitHub release with the distributions attached, and publishes to PyPI via trusted publishing. Remove the token-based pypi-publish.yml. Co-Authored-By: Claude Opus 5.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. |
…igrations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| env: | ||
| TOXENV: ${{ matrix.toxenv }} | ||
| run: tox | ||
| run: uv run --locked tox |
There was a problem hiding this comment.
I think we can avoid --locked with uv run, with uv sync its already there
| include-package-data = false | ||
|
|
||
| [tool.setuptools.dynamic] | ||
| readme = {file = ["README.rst", "CHANGELOG.rst"], content-type = "text/x-rst"} |
There was a problem hiding this comment.
With the changelog turned off in release.yml, CHANGELOG.rst won't be updated anymore (it already stops at 4.8.0 while PyPI is at 5.0.0), but it's still appended to the PyPI description here. Can you drop it from readme and add a short note at the top of CHANGELOG.rst pointing to GitHub Releases?
There was a problem hiding this comment.
Done, dropped it from readme and added a note at the top of CHANGELOG.rst pointing to GitHub Releases.
| install: | ||
| pip install -r requirements/dev.txt |
There was a problem hiding this comment.
The install target was removed here and the README now points to make requirements. We'd rather not drop existing Makefile targets in these migrations, since someone's local workflow or a script may still call them. Can we keep it implemented with the uv equivalent instead?
install: ## install development environment requirements
uv sync --locked --group devThere was a problem hiding this comment.
Restored, using uv sync --group dev.
CHANGELOG.rst is no longer updated now that release notes go to GitHub Releases, so stop appending it to the long description and note that at the top of the file. uv sync --locked already guards the lockfile in CI. Restore the install target, using uv sync --group dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| include README.rst | ||
| include requirements/base.in | ||
| include requirements/test.in | ||
| recursive-include completion *.html *.png *.gif *js *.css *jpg *jpeg *svg *py |
There was a problem hiding this comment.
The sdist grew from 60 files in 5.0.0 to 100 here. setuptools-scm adds every git-tracked file, so it now ships uv.lock, .github/, docs/, Makefile, tox.ini, pytest.ini, pylintrc, codecov.yml, catalog-info.yaml and more. Can you add excludes here?
prune .github
prune .tx
prune docs
prune htmlcov
exclude uv.lock Makefile tox.ini pytest.ini pylintrc pylintrc_tweaks codecov.yml catalog-info.yaml openedx.yaml manage.py .gitignore
global-exclude .coverage coverage.xml
| # the checks that were required to merge -- and picks up any package added to | ||
| # ci.yml later without needing a change here. | ||
| run_ci: | ||
| uses: ./.github/workflows/ci.yml |
There was a problem hiding this comment.
run_ci calls ci.yml without secrets: inherit, so on master pushes the Codecov step runs without CODECOV_TOKEN, and it has fail_ci_if_error: true. sample-plugin and XBlock are set up the same way, so tokenless upload is probably fine, but has this been confirmed? If the upload fails, release won't run.
Summary
Moves edx-completion from setup.py/pip-tools to pyproject.toml, uv and python-semantic-release.
Part of openedx/public-engineering#512 (parent openedx/public-engineering#506).
pyproject.toml. The version comes from setuptools-scm, and__version__is read withimportlib.metadata. The license isAGPL-3.0-or-later, matching the old "v3 or later" classifier.requirements/is replaced by dependency groups anduv.lock. The DRF matrix maps to thedrf314andtestgroups, which are declared as[tool.uv].conflictsso each gets its own resolution.Django<6.0now come fromedx_lint write_uv_constraintsintoconstraint-dependencies. The Makefile no longer downloadscommon_constraints.txt.tox-uv(uv-venv-lock-runner). CI usessetup-uv,uv sync --locked --group cianduv run --locked tox, and now also runs the existingdocsenv. Aworkflow_calltrigger was added so the release can reuse CI.release.ymlcomes from openedx/sample-plugin, with only the monorepo parts removed. It publishes to PyPI with trusted publishing. The token-basedpypi-publish.ymlis removed.Before merging
edx-completion: repoopenedx/completion, workflowrelease.yml.v5.0.0is the latest tag. It matches PyPI 5.0.0 and is an ancestor of master, so python-semantic-release continues from it with its defaultv{version}tag format.Testing
uv run --locked tox -e quality,docs,django52-drf314,django52-drflatestall pass locally. The two test envs run 48 tests each, the same as master. drf314 resolves DRF 3.14.0 and drflatest resolves 3.18.3.uv lock --checkis clean.completion/tests,completion/api/tests,completion/api/v1/tests) no longer ship.completion/test_utils.py, which openedx-platform imports, still ships. The Requires-Dist set is identical.twine checkpasses, and the sdist still contains CHANGELOG.rst, README.rst and LICENSE.Reviewer notes
src/move) because openedx-translations depends on thecompletion/conf/localepath. Itstransifex.ymlusessource_file_dir: translations/completion/completion/conf/locale/en/, and its extraction workflow skips*/src/*.py312-django52-drf{314,latest}→django52-drf{314,latest}. Thepy312factor was never used, and CI already called the envs by the shorter names. The only required check isopenedx/cla, and the CI job is still namedTests.requires-python = ">=3.12"is new metadata. It matches the only Python classifier and the CI matrix.py2.py3topy3, because the[wheel] universal = 1setting is gone along with setup.cfg.🤖 Generated with Claude Code