Skip to content

build: modernize edx-val repo to uv + pyproject.toml - #646

Merged
feanil merged 1 commit into
openedx:masterfrom
farhan:farhan/modernize-python-repo
Nov 6, 2026
Merged

feanil merged 1 commit 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-val
Part of openedx/public-engineering#506

Summary

  • Publishes to PyPI as edxval.
  • Move the package into a src/ layout.
  • Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata).
  • 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 coverage config into pyproject.toml.
  • Update CI and check-reserved-keywords.yml to use astral-sh/setup-uv; SHA-pin all actions.
  • Set permissions: contents: read in ci.yml, since release.yml now reuses it via workflow_call.
  • Add python-semantic-release + release.yml (OIDC trusted publishing), replacing the token-based pypi-publish.yml.
  • Drop Python 3.11 support; set requires-python = ">=3.12".
  • Update the README dev setup instructions to use uv.

Removed/Updated

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

Removed Makefile targets:

Target Reason
$(COMMON_CONSTRAINTS_TXT) Downloaded requirements/common_constraints.txt for pip-compile; edx_lint write_uv_constraints now merges the common constraints into pyproject.toml.

Updated Makefile targets:

Target Change
requirements uv sync --locked --group dev instead of pip/pip-sync.
upgrade edx_lint write_uv_constraints + uv lock --upgrade instead of pip-compile.
quality Runs pylint, pycodestyle, pydocstyle, isort, python -m build and twine check directly instead of tox -e quality; tox now calls this target.
test Runs python -Wd -m pytest (what tox ran on master) instead of python manage.py test; tox now calls this target.

Python 3.11 dropped

Python 3.11 is no longer supported by Open edX, which targets Python 3.12. Removed from the tox envlist.

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}" to match the existing v5.0.1 tags, plus major_on_zero = false and allow_zero_version = true so the config does not depend on tool defaults.

Important Notes

  • The built wheel has the same file list as master's: edxval.settings and tests/data/* stay out of it, as before.
  • readme is the static text edx-val, matching master's long_description. README.rst has RST errors that fail twine check.
  • uv.lock keeps master's pinned versions (e.g. djangorestframework==3.17.1). With 3.18, test_no_profile_validation fails, so that upgrade is left to the weekly upgrade job.
  • Test data paths in tests/constants.py and tests/test_api.py now start with src/, because the tests open these files relative to the repo root.
  • The [pycodestyle] config moved from setup.cfg to tox.ini, because pycodestyle does not read pyproject.toml.
  • No docs tox environment: this repo has no docs/ directory, no make docs target and no Sphinx config.
  • CI job names (Tests, toxenvs django52/quality) are unchanged, so branch protection keeps working.
  • Commit messages on all future PRs to this repo must follow the conventional commit format (commitlint.yml), since they now decide the release version.
  • tox and the Makefile now run the other way round: tox envs call Makefile targets (make test, make quality), whereas on master tox ran the commands itself. This goes beyond the migration and is intentional.

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


🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.64%. Comparing base (1a3b245) to head (a4137a5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #646   +/-   ##
=======================================
  Coverage   97.63%   97.64%           
=======================================
  Files          28       28           
  Lines        3262     3263    +1     
  Branches      124      124           
=======================================
+ Hits         3185     3186    +1     
  Misses         60       60           
  Partials       17       17           
Flag Coverage Δ
unittests 97.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Copy link
Copy Markdown
Contributor

Looks good, and the lock matches master's pins. One thing: the README dev setup still says virtualenv venvs/val. With uv that should be make requirements then source .venv/bin/activate.

@farhan

farhan commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixed in 39a4a2f.

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

Move packaging to PEP 621 metadata with setuptools-scm, manage
dependencies with uv dependency groups and a committed uv.lock, and
release via python-semantic-release with OIDC trusted publishing, as
described in openedx/public-engineering#506. CI tokens are read-only
since ci.yml is now reused by release.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from 657d0aa to a4137a5 Compare November 3, 2026 06:19
@farhan
farhan requested a review from feanil November 3, 2026 15:45
@feanil
feanil merged commit cd3875f into openedx:master Nov 6, 2026
7 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