Skip to content

build: modernize edx-ace repo to uv + pyproject.toml - #381

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 29, 2026 •

Copy link
Copy Markdown
Contributor

Important

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

Modernize edx-ace
Part of openedx/public-engineering#506

Summary

  • Publishes to PyPI as edx-ace.
  • Move the package into a src/ layout.
  • Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata); extras_require is ported to [project.optional-dependencies].
  • Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock.
  • Retain pylint/isort/pycodestyle/pydocstyle as on master.
  • Move the .coveragerc and pytest.ini config into pyproject.toml.
  • Update CI to use astral-sh/setup-uv instead of actions/setup-python + pip, with read-only permissions: contents: read since release.yml now calls it.
  • Add python-semantic-release + release.yml (OIDC trusted publishing), replacing the token-based pypi-publish.yml.
  • Add .readthedocs.yaml so Read the Docs installs the doc group from uv.lock (the requirements/doc.txt it could rely on is deleted).

Removed/Updated

Deleted files: setup.py, setup.cfg, requirements/, .coveragerc, pytest.ini, .github/workflows/pypi-publish.yml

Updated Makefile targets:

Target Change
requirements uv sync --locked --group dev instead of pip-sync.
upgrade edx_lint write_uv_constraints + uv lock --upgrade instead of pip-compile.
quality Runs the linters directly (was tox -e quality); setup.py dropped from the isort file list since it was deleted.
docs Runs the doc commands directly (was tox -e docs); builds with python -m build instead of setup.py sdist bdist_wheel.
test python -Wd -m pytest $(PYTEST_ARGS), keeping master's -Wd and tox {posargs}.
write-pylintrc uv run --with edx-lint edx_lint write pylintrc, since pip install isn't available in the uv venv.
extract_translations, compile_translations, detect_changed_source_translations, dummy_translations Path updated to src/edx_ace.

Versioning

setuptools-scm with dynamic = ["version"] — master had a PyPI publish workflow; python-semantic-release controls the version string at release time via git tags. [tool.semantic_release] sets tag_format = "v{version}" (matching existing v1.x.y tags), major_on_zero = false and allow_zero_version = true explicitly instead of relying on tool defaults.

Important Notes

  • commitlint.yml already exists, but with python-semantic-release the commit type now decides the release (fix: → patch, feat: → minor, ! → major).
  • CI keeps the Tests job name, the same os/python-version/toxenv matrix and fail-fast: false, so branch-protection check names do not change.
  • uv.lock is seeded from master's requirements/*.txt pins, so dependency versions match master; upgrades are left to the first make upgrade. This keeps hypothesis at 6.104.2; newer releases find a pre-existing flaky case in test_message.py::test_serialization_roundtrip.
  • README: the "Python CI" badge now tracks release.yml (ci.yml no longer runs on pushes to master), and the "Publish package to PyPi" badge for the deleted pypi-publish.yml is dropped.
  • The wheel contents match master's wheel file for file; the sdist still ships CHANGELOG.rst as master did, and the changelog now carries a deprecation note pointing to GitHub Releases.
  • tox and the Makefile now run the other way round: tox envs call Makefile targets (make test, make quality, make docs), whereas on master tox ran the commands itself. This goes beyond the migration and is intentional. Running make docs locally now also builds the dist and runs twine check, which master only did inside tox -e docs.

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 test, make quality, make docs, python -m build). Repo-owner is encouraged to run the repo's feature tests before merging.


🤖 Generated with Claude Code

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

Copy link
Copy Markdown
Contributor

uv.lock was resolved fresh, so this upgrades most of master's pins, including runtime majors (firebase-admin 6→7, protobuf 6→7, cryptography 44→50, django-waffle 4→5). Per feanil on enterprise-access#1015, please seed the lock from master's requirements/*.txt and leave upgrades to the first make upgrade.

Smaller things:

  • The test command lost -Wd when it moved into the Makefile.
  • README badges: "Publish package to PyPi" points at the deleted pypi-publish.yml, and "Python CI" will stay stuck on its last pre-migration result now that ci.yml only runs inside release.yml on master. Pointing them at release.yml, or dropping them, fixes both.
  • make write-pylintrc still runs pip install, which isn't available in the uv venv; uv run --with edx-lint edx_lint write pylintrc works instead.

@farhan

farhan commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixed in da3ad76.

@irfanuddinahmad irfanuddinahmad 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.

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.

This flips the Makefile/tox direction (tox now calls make). Fine by me since it's the direction feanil prefers, but it's beyond the migration itself, so flag it in the description.

Nit: docs/testing.rst still has the virtualenv wording; make it make requirements then source .venv/bin/activate.

Move packaging to static PEP 621 metadata with setuptools-scm, manage
dependencies with uv dependency groups and a committed uv.lock, adopt
the src/ layout, and release via python-semantic-release with OIDC
trusted publishing, per public-engineering#506.

The lock is seeded from master's requirements pins so dependency
upgrades land separately via `make upgrade`, not hidden in this change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from b61cfef to 4f09c82 Compare November 3, 2026 06:19
@farhan
farhan requested a review from feanil November 3, 2026 15:45
Comment thread pyproject.toml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread Makefile Resolved
Use a plain 0.0.0 fallback so int-tuple version parsing works, lock uv
in CI so the lockfile is never rewritten, let the Makefile assume an
activated env, regenerate pylintrc with current edx-lint, and drop the
legacy openedx.yaml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan requested a review from feanil November 10, 2026 08:05
@farhan farhan closed this Nov 12, 2026
@farhan farhan reopened this Nov 12, 2026
@feanil
feanil merged commit 7a2ecd0 into openedx:master Nov 12, 2026
13 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