Skip to content

feat: modernize Python tooling to uv + pyproject.toml + semantic-release - #704

Open
irfanuddinahmad wants to merge 1 commit into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/modernize-python-tooling
Open

feat: modernize Python tooling to uv + pyproject.toml + semantic-release#704
irfanuddinahmad wants to merge 1 commit into
openedx:mainfrom
irfanuddinahmad:irfanuddinahmad/modernize-python-tooling

Conversation

@irfanuddinahmad

@irfanuddinahmad irfanuddinahmad commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

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

Not included: src/ layout. This repo already uses src/openedx_{core,content,tagging,catalog} and src/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's sys.path entries, and tox.ini already pointed at src/.

Removed

Deleted files: setup.py, setup.cfg, .coveragerc, .readthedocs.yml (legacy duplicate of .readthedocs.yaml), requirements/ (all .in/.txt files, constraints.txt, private.readme), .github/workflows/pypi-publish.yml (replaced by release.yml, OIDC instead of the PYPI_UPLOAD_TOKEN secret).

Removed Makefile targets:

Target Reason
compile-requirements pip-compile machinery, replaced by uv lock

upgrade and requirements targets were kept but rewritten to use uv (edx_lint write_uv_constraints + uv lock --upgrade, and uv sync --group dev, respectively) instead of pip-compile/pip-sync.

Versioning

Dynamic — setuptools-scm derives the build version from the latest git tag. Pre-flight check passed: latest git tag v1.1.0 matches 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 lock resolves 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, with openedx_core.__version__ correctly resolving to 1.1.0 via importlib.metadata
  • python -m build + twine check dist/* both pass; inspected the built wheel and confirmed all five packages (with py.typed markers) are bundled correctly
  • mypy resolves the editable install correctly under this repo's existing src/ 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 missing pytest/freezegun stubs from the deliberately-partial ad hoc install, not a resolution problem)
  • tox -l lists all envs correctly (py312-django52, quality, docs, pii_check, lint-imports) — tox.ini parses cleanly against the new [dependency-groups] names

Could not verify locally: uv sync --group dev (and test/quality/doc) fails to build in this sandbox because mysqlclient has no macOS wheel and needs local MySQL client headers unavailable here. This predates the migration (same coupling existed via the old requirements/test.in) and is expected to build fine on GitHub Actions' ubuntu-latest runners, 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

  • Two items flagged below need maintainer action, not code changes:
    1. PyPI OIDC trusted publisher needs configuring for openedx-core (tracked in the consolidated comment on Tbain/253 add tags count #506) before the first automated release can publish.
    2. Unable to confirm from outside the org whether the OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN secret used by release.yml is configured for this repo.
  • Known, out-of-scope gap: .github/workflows/upgrade-python-requirements.yml calls openedx/.github's shared reusable workflow, which hardcodes add-paths: requirements with no override input. Now that requirements/ 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 in openedx/.github itself (e.g. parameterizing add_paths, or auto-detecting uv.lock vs. requirements/).
  • mysqlclient is bundled into the test-base dependency group (and therefore test/quality/doc/ci/dev transitively), matching the pre-migration coupling in requirements/test.inquality.in/doc.in/dev.in. This is why the "Not included"/"Testing Notes" sections above call out the local verification gap.
  • [dependency-groups].ci is intentionally minimal (tox, tox-uv only, no include-group) — CI's own uv sync --group ci step only needs tox on PATH; tox installs each env's actual dependency group itself via uv-venv-lock-runner.

This PR was created with Claude Code.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Jul 27, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

This repository is currently maintained by @axim-engineering.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Comment thread .github/workflows/release.yml
Comment thread src/openedx_core/__init__.py Outdated
Comment thread .readthedocs.yml Outdated
Comment thread .github/workflows/ci.yml
irfanuddinahmad added a commit to irfanuddinahmad/openedx-core that referenced this pull request Sep 2, 2026
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>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/modernize-python-tooling branch 2 times, most recently from 9218fb4 to 0c6634e Compare September 3, 2026 11:42
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>
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/modernize-python-tooling branch from 0c6634e to ec638c2 Compare September 3, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants