Skip to content

build: modernize django-pyfs to uv + pyproject.toml - #316

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

feanil merged 3 commits 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-pyfs
Part of openedx/public-engineering#506

Summary

  • Publishes to PyPI as openedx-django-pyfs.
  • Move the package into a src/ layout (src/djpyfs).
  • Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata); the built wheel has the same file list and Requires-Dist as the 4.0.0 wheel on PyPI.
  • Switch from pip-compile to uv with PEP 735 dependency groups (test-base, test, django42, quality, ci, dev); commit uv.lock.
  • Retain pylint/isort (plus pycodestyle/pydocstyle in the quality group) as on master.
  • Move .coveragerc and pytest.ini config into pyproject.toml.
  • Update CI to use astral-sh/setup-uv, uv sync --locked --group ci and uv run tox; all actions SHA-pinned.
  • Add python-semantic-release + release.yml (OIDC trusted publishing), replacing pypi-publish.yml.

Removed/Updated

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

Removed Makefile targets:

Target Reason
$(COMMON_CONSTRAINTS_TXT) Downloaded requirements/common_constraints.txt for pip-compile; edx-lint's write_uv_constraints now merges common constraints into [tool.uv].constraint-dependencies.

Updated Makefile targets:

Target Change
requirements uv sync --locked --group dev instead of pip/pip-sync.
quality Runs pylint, isort --check-only, python -m build and twine check directly on src/djpyfs instead of tox -e quality.
upgrade edx_lint write_uv_constraints + uv lock --upgrade instead of pip-compile.

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 (baseline tag v4.0.0 already exists).

Important Notes

  • No docs tox env/CI job was added: the repo has no docs/ directory, Sphinx config or docs make target.
  • Repo-specific pins moto<5.0.0 and setuptools<82 moved from constraints.txt into [tool.edx_lint].uv_constraints with their original reasons.
  • include-package-data = false keeps wheel parity with master: djpyfs/static/index.html was never shipped in the wheel.
  • Framework :: Django :: 5.1 and the License classifier were dropped (5.1 is not tested; the license is now the SPDX license = "Apache-2.0").

Out of Scope

Item Notes Next action
Codecov upload source CI still uploads htmlcov/index.html from the django42 job, as on master. Separate PR to upload coverage.xml from the newest Django job if desired.
pycodestyle/pydocstyle Installed by the quality group (as quality.in did) but never run on master; config preserved (tox.ini [pycodestyle], [tool.pydocstyle]). Repo owner to decide whether to wire them into make quality.
example/ app Legacy sample project still uses removed Django APIs; it is untouched and not tested. Separate cleanup if needed.

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


🤖 Generated with Claude Code

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

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.

Keeping plain uv run tox, as in sample-plugin: the preceding uv sync --locked --group ci step already fails on a stale uv.lock, so --locked on uv run is redundant.

@farhan
farhan force-pushed the farhan/modernize-python-repo branch 2 times, most recently from 52c9199 to 9fbca36 Compare October 26, 2026 07:07
@farhan
farhan marked this pull request as ready for review October 26, 2026 07:45
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (0f047ef) to head (9fbca36).

Additional details and impacted files
@@      Coverage Diff      @@
##   master   #316   +/-   ##
=============================
=============================

☔ 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 and others added 3 commits October 27, 2026 12:35
Move packaging to static PEP 621 metadata with setuptools-scm, manage
dependencies with uv and PEP 735 groups, and release via
python-semantic-release with OIDC publishing, per
openedx/public-engineering#506.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
setuptools-scm adds every tracked file to the sdist, so the deprecated
CHANGELOG.rst started shipping in it; 4.0.0's sdist did not include it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Carries over the certifi upgrade that landed on master in the deleted
requirements files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from 9fbca36 to 72e31d9 Compare October 27, 2026 07:44

@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 6b0381b into openedx:master Oct 29, 2026
5 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