Skip to content

build: modernize django-require to uv + pyproject.toml - #19

Merged
feanil merged 2 commits into
openedx:masterfrom
farhan:farhan/modernize-python-repo
Nov 12, 2026
Merged

feanil merged 2 commits into
openedx:masterfrom
farhan:farhan/modernize-python-repo

Conversation

@farhan

@farhan farhan commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

PR implemented with the assistance of Claude Code. Refined and validated before being submitted for code review.

Modernize django-require
Part of openedx/public-engineering#506

Summary

  • Publishes to PyPI as openedx-django-require.
  • Move the package into a src/ layout.
  • Replace setup.py with pyproject.toml (PEP 621 static metadata).
  • Switch to uv with PEP 735 dependency groups; commit uv.lock.
  • Coverage config moved from .coveragerc into pyproject.toml.
  • Update CI to use astral-sh/setup-uv; SHA-pin all actions; give ci.yml read-only permissions: contents: read.
  • Add python-semantic-release + release.yml (OIDC trusted publishing), replacing the token-based pypi-release.yml.

Removed/Updated

Deleted files: setup.py, .coveragerc, .github/workflows/pypi-release.yml

Added Makefile: master had no Makefile, so a minimal one is added.

Target Purpose
requirements uv sync --locked --group dev
test Runs the test suite under coverage; called by tox
upgrade edx_lint write_uv_constraints + uv lock --upgrade; called by upgrade-python-requirements.yml, which had no make upgrade to run on master

Versioning

setuptools-scm with dynamic = ["version"]. python-semantic-release sets the version from git tags at release time; [tool.semantic_release] sets tag_format = "v{version}" (matches latest tag v3.0.0), major_on_zero = false and allow_zero_version = true explicitly instead of relying on PSR defaults.

Important Notes

  • require.__version__ changes from the tuple (3, 0, 0) to the string from importlib.metadata.version("openedx-django-require").
  • No quality or docs tox env/CI job is added, because master has no linters and no docs to run.
  • tox no longer uses changedir = {envtmpdir}; the src/ layout already makes tests import the installed package.
  • CHANGELOG.md gets a deprecation note and stays out of the sdist, as on master.
  • ci.yml drops its push: trigger, since release.yml runs it on pushes to master via workflow_call.
  • Python 3.11 stays supported (requires-python = ">=3.11", tox envlist, CI matrix) as on master; dropping it is left to its own PR.
  • Branch protection: the matrix check names (Tests (ubuntu-latest, 3.11/3.12, django42)) are unchanged.
  • The README CI badge now tracks release.yml, since ci.yml no longer runs on pushes to master.

Caution

setup.py declared license = "BSD", so [project].license is "BSD-3-Clause". The README says contributions after the fork are under Apache-2.0 (LICENSE), and both license files still ship in the wheel. Please verify the license: if it should cover both, change it to "Apache-2.0 AND BSD-3-Clause" before merging.

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, uv run tox, python -m build). The built wheel's file list is identical to master's. Locally, testCollectStaticNoBuildProfile fails the same way on master and on this branch (no Java runtime on the test machine).


🤖 Generated with Claude Code

@farhan
farhan marked this pull request as ready for review October 30, 2026 06:26
@irfanuddinahmad

Copy link
Copy Markdown

Master tests 3.11 and 3.12, and nothing here needs 3.11 dropped. Could we keep requires-python = ">=3.11", along with the classifier, the tox env and the CI matrix entry, and leave dropping 3.11 to its own PR?

Since ci.yml no longer runs on pushes to master (CI now runs inside release.yml), the README "Python CI" badge will stay stuck on its last pre-migration result; XBlock's still shows June's. Pointing it at actions/workflows/release.yml/badge.svg?branch=master, or dropping it, fixes that.

@farhan

farhan commented Nov 2, 2026 •

Copy link
Copy Markdown
Author

Fixed in bc1a459.

@irfanuddinahmad irfanuddinahmad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please add tag_format = "v{version}", major_on_zero = false and allow_zero_version = true to [tool.semantic_release], use fallback_version = "0.0.0", and add a top-level permissions: contents: read to ci.yml, since run_ci now calls it from release.yml.

Before merge: a PyPI trusted publisher is needed for release.yml, and both commits are build:, so a squash as build: won't release anything.

Moves packaging to static PEP 621 metadata with setuptools-scm, uv
dependency groups with a committed uv.lock, and python-semantic-release
with OIDC publishing, per public-engineering#506, so releases come from
conventional commits instead of manual version bumps. Python 3.11
support is kept; dropping it belongs in its own PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from de3ea8c to 7b38914 Compare November 3, 2026 06:18
@farhan
farhan requested a review from feanil November 3, 2026 15:45
Comment thread pyproject.toml Resolved
Comment thread pyproject.toml Resolved
Declare both licenses since post-fork code is Apache-2.0 while upstream
remains BSD-3-Clause, and use a plain 0.0.0 setuptools-scm fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan requested a review from feanil November 10, 2026 08:05
@feanil
feanil merged commit 9cc9a3b into openedx:master Nov 12, 2026
4 checks passed
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.

3 participants