Skip to content

build: modernize packaging with uv, pyproject.toml and semantic-release - #476

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

feanil merged 1 commit into
openedx:masterfrom
farhan:farhan/modernize-python-repo

Conversation

@farhan

@farhan farhan commented Oct 10, 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 django-user-tasks
Part of openedx/public-engineering#506

Summary

  • Published on PyPI: https://pypi.org/project/django-user-tasks/
  • 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.
  • Coverage config moved from .coveragerc into pyproject.toml.
  • Update CI to use astral-sh/setup-uv; SHA-pin all actions.
  • Add python-semantic-release + release.yml (OIDC trusted publishing), replacing pypi-publish.yml.
  • Switch .readthedocs.yaml to install the doc dependency group via uv.

Removed/Updated

Deleted files: setup.py, setup.cfg, requirements/, .coveragerc, openedx.yaml (superseded by catalog-info.yaml, which this repo already has; see openedx/public-engineering#349), .github/workflows/pypi-publish.yml

Updated Makefile targets:

Target Change
requirements pip-sync requirements/dev.txt → uv sync --locked --group dev
upgrade pip-compile chain → edx_lint write_uv_constraints + uv lock --upgrade
quality Runs pylint/pycodestyle/pydocstyle/isort directly instead of tox -e quality; tox now calls make quality
docs Runs doc8/Sphinx/python -m build/twine check directly instead of tox -e docs; tox now calls make docs
test pytest → python -Wd -m pytest $(PYTEST_ARGS) so tox can call it with the same flags as before
dummy_translations Path updated to src/user_tasks

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. The baseline tag v4.0.0 already exists for the latest PyPI release (4.0.0).

Important Notes

  • uv.lock was seeded with the exact versions pinned in master's requirements/*.txt, so this PR does not upgrade any dependency. A fresh resolve pulled edx-lint 6.2.0, which crashes pylint (pii_terms setting must be configured); that upgrade is left for the weekly upgrade job.
  • Tox env names, the CI job name (tests) and the toxenv matrix are unchanged, so branch-protection check names keep working.
  • ci.yml no longer triggers on push; release.yml calls it via workflow_call, so CI does not run twice on merge.
  • commitlint.yml was already present, so conventional commit format is already enforced on PRs.
  • The wheel is now tagged py3-none-any instead of py2.py3-none-any (the [bdist_wheel] universal = 1 setting was dropped with setup.cfg).
  • CHANGELOG.rst is kept with a deprecation note at the top. Release notes now go only on GitHub Releases.

Out of Scope

Item Notes Next action
edx-lint 6.2.0 upgrade Needs a pii_terms pylint setting, or pylint crashes Configure pii_terms when the upgrade job bumps edx-lint
docs/conf.py hardcoded version = '0.3.0' Already stale on master Separate cleanup PR
Unused tox factors (celery53/54, drf313) Already no-ops on master (no deps) Repo owner to decide whether to drop or wire them

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.91%. Comparing base (ab1e3de) to head (778c0cc).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #476   +/-   ##
=======================================
  Coverage   95.90%   95.91%           
=======================================
  Files          18       18           
  Lines         488      489    +1     
  Branches       55       55           
=======================================
+ Hits          468      469    +1     
  Misses         19       19           
  Partials        1        1           
Flag Coverage Δ
unittests 95.91% <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.

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

Before merging, a PyPI owner needs to add a trusted publisher for this repo with workflow release.yml. Earlier releases used an API token, so the first OIDC publish will fail without it.

Comment thread .github/workflows/release.yml Resolved
Comment thread .github/workflows/ci.yml
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
run: uv run tox -e ${{ matrix.toxenv }}

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 use uv run --locked tox -e ${{ matrix.toxenv }}. Without --locked, uv run silently re-locks when uv.lock is stale instead of failing. It also matches i18n-tools, codejail-includes and platform-plugin-aspects.

@farhan farhan Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uv sync --locked --group ci in the previous step already fails on a stale uv.lock, so --locked on uv run is redundant.

Comment thread pyproject.toml
"tox-uv",
"coverage",
]
dev = [

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 {include-group = "doc"} to dev. Without it, make requirements && make docs fails on a fresh clone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

dev already includes doc transitively via quality (quality has {include-group = "doc"}), so make requirements && make docs works on a fresh clone.

Comment thread pyproject.toml Resolved
@farhan
farhan force-pushed the farhan/modernize-python-repo branch 2 times, most recently from 1b52648 to 870dbc0 Compare October 26, 2026 07:07
Move to PEP 621 metadata, PEP 735 dependency groups locked with uv, a
src/ layout, and python-semantic-release with OIDC publishing, as part
of the Python repo modernization effort (openedx/public-engineering#506).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from f3be561 to 778c0cc Compare October 26, 2026 07:45
@farhan
farhan marked this pull request as ready for review October 26, 2026 07:45

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

LGTM!

@feanil
feanil merged commit 86088d0 into openedx:master Oct 29, 2026
9 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