Skip to content

chore: modernize to uv + pyproject.toml + src/ layout + semantic-release - #237

Draft
farhan wants to merge 8 commits into
openedx:mainfrom
farhan:farhan/modernize-python-repo
Draft

chore: modernize to uv + pyproject.toml + src/ layout + semantic-release#237
farhan wants to merge 8 commits into
openedx:mainfrom
farhan:farhan/modernize-python-repo

Conversation

@farhan

@farhan farhan commented Jul 17, 2026

Copy link
Copy Markdown

Important

PR implemented with the assistance of Claude Code, human-reviewed and improved before pushing to code review.

Summary

Modernize platform-plugin-aspects to uv + pyproject.toml (PEP 621/735) + src/ layout + python-semantic-release.

Part of openedx/public-engineering#506.

  • Replace setup.py/setup.cfg with pyproject.toml (PEP 621 with setuptools-scm for dynamic version)
  • Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock
  • Move the package into a src/ layout (history preserved via git mv)
  • Retain pylint/isort/pycodestyle/black/pydocstyle as on master (ruff deferred to its own epic per #506); coverage config moved into pyproject.toml
  • 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 workflow_call trigger; set fail-fast: false
  • Add python-semantic-release + release.yml (OIDC trusted publishing)
  • commitlint.yml was already present — conventional commit format already enforced on all PRs

Removed

Deleted files: setup.py, setup.cfg, requirements/, .coveragerc, .github/workflows/pypi-publish.yml (replaced by release.yml)

Removed Makefile targets:

Target Reason
piptools pip-tools/pip-sync removed; replaced by uv sync in requirements target

Versioning

[Dynamic] setuptools-scm with dynamic = ["version"] — master had a PyPI publish workflow; python-semantic-release controls the version string at release time via git tags. Latest tag is v2.0.0 (1.x+), so no zero-version guard is needed.

Testing Notes

This PR has not been manually tested against the repo's own features. Testing relied on CI checks and local agent tooling (make requirements, make quality, uv run tox -e py312-django52, python -m build). 109 tests pass at 97% coverage. Repo-owner is encouraged to run the repo's feature tests before merging.

Code reviewer notes:

  • OIDC trusted publisher must be configured on PyPI before merge — the publish_to_pypi job uses OIDC (id-token: write) with no token; PyPI project → PublishingAdd a new publisher, pointing at openedx/platform-plugin-aspects, workflow release.yml. The Axim team (Feanil) must confirm this is configured before merging, otherwise the first publish will fail silently after semantic-release has already tagged and bumped the version.
  • The CI coverage step condition was fixed from matrix.toxenv == 'django42' (never matched — django42 was not in the old matrix) to matrix.toxenv == 'django52'; coverage comments will now actually post on PRs.
  • The GITHUB_TOKEN is used in release.yml for semantic-release (instead of a dedicated OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN); if the org requires a PAT for pushing tags/commits back to the repo, switch to that secret.
  • Old PYPI_UPLOAD_TOKEN secret can be removed from the repo settings after merge (out-of-band).

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/platform_plugin_aspects
  __init__.py
Project Total  

This report was generated by python-coverage-comment-action

farhan and others added 3 commits July 22, 2026 13:34
- Replace setup.py/setup.cfg with pyproject.toml (PEP 621/setuptools-scm)
- Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock
- Move package into src/ layout (git mv with history preserved)
- Retain pylint/isort/pycodestyle/black/pydocstyle (ruff deferred per #506)
- Update tox.ini to use tox-uv with uv-venv-lock-runner
- Update CI to use astral-sh/setup-uv; add workflow_call trigger; SHA-pin actions
- Add release.yml with python-semantic-release and OIDC trusted publishing
- Delete pypi-publish.yml (replaced by release.yml)

Part of openedx/public-engineering#506

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add relative_files = true to [tool.coverage.run] so the coverage XML
  uses relative paths; py-cov-action was failing because absolute paths
  from the tox venv did not match the workspace root on GitHub Actions.
- Update .readthedocs.yaml to install from pyproject.toml + docs/requirements.txt
  instead of the deleted requirements/doc.txt.
- Add docs/requirements.txt for RTD compatibility (RTD does not support
  PEP 735 dependency-groups natively).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- MANIFEST.in: remove redundant `include LICENSE` and `include README.rst`
  (pyproject.toml already declares these via license-files and readme)
- pyproject.toml: add [project.optional-dependencies].docs for RTD
- .readthedocs.yaml: replace requirements.txt step with extra_requirements
- docs/requirements.txt: delete (superseded by optional-dependencies)
- docs/conf.py: remove sys.path.insert for src/ (package is pip-installed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from 58a105f to 993ecb2 Compare July 22, 2026 08:40
@farhan
farhan marked this pull request as ready for review July 22, 2026 08:49
farhan and others added 3 commits July 22, 2026 14:28
- Regenerate uv.lock so `uv lock --check` passes (docs optional
  extra was added without relocking).
- Use bare `setuptools` (no version pin) in [build-system].requires
  for parity across openedx repos; keep setuptools-scm>=8.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Remove `fail-fast: false` from the CI matrix strategy; main did not set
  it, so omit the key to keep parity (defaults to true)
- Drop `requirements` from pytest `norecursedirs`; the directory no longer
  exists after the uv/pyproject migration

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@farhan farhan self-assigned this Jul 22, 2026
@farhan farhan moved this to 👀 In review in Aximprovements Team Jul 22, 2026
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/release.yml Outdated

@bmtcril bmtcril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a couple of questions. Aspects CI (main) is testing this here: openedx/tutor-contrib-aspects#1293 (it will fail for now, since the Verawood changes aren't there yet)

And against Verawood: openedx/tutor-contrib-aspects#1294 (this is the real test)

farhan and others added 2 commits July 22, 2026 18:26
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan
farhan requested a review from bmtcril July 22, 2026 14:45
@farhan
farhan marked this pull request as draft July 23, 2026 07:30
@farhan farhan moved this from 👀 In review to 🏗 In progress in Aximprovements Team Jul 23, 2026
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