Skip to content

feat: modernize to uv + pyproject.toml (PEP 621/735) + python-semantic-release#247

Draft
farhan wants to merge 2 commits into
openedx:masterfrom
farhan:farhan/modernize-python-repo
Draft

feat: modernize to uv + pyproject.toml (PEP 621/735) + python-semantic-release#247
farhan wants to merge 2 commits into
openedx:masterfrom
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 enmerkar-underscore to uv + pyproject.toml (PEP 621/735) + python-semantic-release.

Part of openedx/public-engineering#506.

  • 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
  • Package already in src/ layout; updated pyproject.toml to reference it with where = ["src"]
  • Retain flake8 as on master (ruff deferred to its own epic per #506); flake8 config migrated from setup.cfg to .flake8; coverage config moved into pyproject.toml
  • Update tox.ini to use tox-uv with uv-venv-lock-runner; drop Python 3.11
  • Update CI to use astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger
  • Add python-semantic-release + release.yml (OIDC trusted publishing)
  • Add commitlint.yml to enforce conventional commit format on all future PRs to this repo (already existed on master — no change needed)
  • Drop Python 3.11 support; set requires-python = ">=3.12"

Removed

Deleted files: setup.py, setup.cfg, requirements/, .flake8 (config moved to .flake8 from setup.cfg [flake8]), publish_pypi.yml (replaced by release.yml)

Removed Makefile targets:

Target Reason
lint Replaced by quality target (delegates to tox -e quality)
coverage Referenced django-babel-underscore (wrong package name) and setup.py test; coverage now runs as part of tox -e py312-django*
release Depended on python setup.py sdist upload — replaced by python-semantic-release in release.yml
dist Depended on python setup.py sdist bdist_wheelpython -m build used in release.yml instead

Python 3.11 dropped

Python 3.11 reached end-of-life on October 31, 2024 and Open edX Sumac dropped it platform-wide. Removed from the tox envlist, CI matrix, and classifiers.

Versioning

[Dynamic] setuptools-scm with dynamic = ["version"] — master had a PyPI publish workflow (publish_pypi.yml); python-semantic-release controls the version string at release time via git tags. The repo is on 2.x, so no zero-version guard is needed.

Notes

setuptools<71 constraint added: The enmerkar==0.7.1 dependency uses pkg_resources (from setuptools), which was removed from the default namespace in setuptools >= 71. A setuptools<71 constraint is added to [tool.edx_lint].uv_constraints and [tool.uv].constraint-dependencies to ensure the package continues to function. This is a pre-existing upstream issue in the enmerkar package.

pytest-pep8 and pytest-flakes removed: These pytest plugins were in requirements/test.in but are incompatible with modern pytest (they use an outdated pytest_collect_file hook signature). They are dropped in favor of running flake8 directly in the quality tox env. The linting coverage is preserved.

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, make test, make docs, python -m build). 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 — first publish fails silently otherwise (out-of-band, Axim team must configure on PyPI project → Publishing → Add trusted publisher for openedx/enmerkar-underscore, workflow release.yml).
  • commitlint.yml was already present on master, so conventional commit format is already enforced — no behavioral change for contributors.
  • The setuptools<71 constraint is a runtime workaround for enmerkar==0.7.1's use of the deprecated pkg_resources API; ideally enmerkar should be updated upstream to use importlib.metadata instead.
  • HISTORY.rst is kept (it is not CHANGELOG.rst) — semantic-release will manage future release notes.

🤖 Generated with Claude Code

farhan and others added 2 commits July 17, 2026 22:09
- 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
- src/ layout already present; update pyproject.toml to reference it
- Retain flake8 as on master (ruff deferred to its own epic); coverage config moved into pyproject.toml
- Add .flake8 config (migrated from setup.cfg [flake8] section)
- Update tox.ini to use tox-uv with uv-venv-lock-runner; drop py311
- Update CI to use astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger
- Add release.yml with python-semantic-release and OIDC trusted publishing
- Delete publish_pypi.yml (replaced by release.yml)
- Add setuptools<71 constraint (required by enmerkar==0.7.1 which uses pkg_resources)

Part of openedx/public-engineering#506

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… Codecov

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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.

1 participant