Skip to content

chore: modernize Python repo to uv + pyproject.toml - #329

Draft
farhan wants to merge 1 commit into
openedx:edx_releasefrom
farhan:farhan/modernize-python-repo
Draft

farhan wants to merge 1 commit into
openedx:edx_releasefrom
farhan:farhan/modernize-python-repo

Conversation

@farhan

@farhan farhan commented Sep 24, 2026 •

Copy link
Copy Markdown

Important

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

Modernize `django-wiki`
Part of openedx/public-engineering#506

Summary

  • Package published to PyPI as openedx-django-wiki
  • Replace `setup.py` with `pyproject.toml` (PEP 621 static metadata)
  • Switch from pip-compile to `uv` with PEP 735 dependency groups; commit `uv.lock`
  • Retain pylint as on master; add minimal `quality` tox env (repo had no prior quality tooling)
  • Update CI to use `astral-sh/setup-uv`; SHA-pin all actions
  • Add `python-semantic-release` + `release.yml` (OIDC trusted publishing)
  • Add `commitlint.yml` to enforce conventional commit format on all future PRs to this repo
  • Drop Python < 3.12 support; set `requires-python = ">=3.12"`

Removed/Updated

Deleted files: `setup.py`, `requirements/`

Removed Makefile targets:

Target Reason
`upgrade` (pip-compile body) Replaced by `uv lock --upgrade` + `edx_lint write_uv_constraints`

Updated Makefile targets:

Target Change
`upgrade` Replaced pip-compile commands with `uv lock --upgrade` and `edx_lint write_uv_constraints pyproject.toml`

Python 3.8–3.11 dropped

Python 3.8–3.11 reached end-of-life and Open edX Sumac+ dropped them platform-wide. The project already only tested Python 3.12; `requires-python = ">=3.12"` is now set explicitly.

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.

CI / Release workflow fixes

This repo's default branch is `edx_release`, not `master`. The standard `release.yml` template ships with `branches: [master]` and two `if: github.ref_name == 'master'` guards, which meant PSR and PyPI publish would never run after merge.

Fixed in this PR:

  • `release.yml`: `branches: [master]` → `branches: [edx_release]`; both `github.ref_name == 'master'` guards updated to `edx_release`
  • `ci.yml`: removed the dead `push: branches: [master]` trigger. Because `release.yml` already calls `ci.yml` via `workflow_call`, keeping a separate `push:` trigger would fire CI twice on every merge to `edx_release` once the branch name was corrected — the same race-condition bug found and fixed in platform-plugin-aspects#257.

Important Notes

  • This repo had no prior quality tooling (no lint/quality Makefile target, no quality tox env). A minimal `quality` tox env running `pylint --fail-under=0` was added to satisfy the org standard; pre-existing pylint findings are not blocked by this migration. Maintainers are encouraged to address these incrementally.
  • `src/` layout was not adopted because the two packages (`wiki` and `django_notify`) are tightly coupled to the test project layout and the migration would require significant refactoring beyond the scope of this PR.
  • The existing `commitlint.yml` workflow was retained as-is; conventional commit format is now enforced on all future PRs.
  • `pypi-publish.yml` was deleted as it is superseded by the new `release.yml` (OIDC trusted publishing replaces token-based publishing).

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


🤖 Generated with Claude Code

@farhan
farhan force-pushed the farhan/modernize-python-repo branch from 3f650dc to 3d80bf7 Compare October 6, 2026 06:59
farhan added a commit to farhan/farhan-agent-skills that referenced this pull request Oct 6, 2026
…0 and Test#445

Test#180 now verifies release.yml's push branch matches the repo's
actual default branch (via gh repo view) and flags the mismatch with
a concrete fix instruction. Repos like django-wiki use edx_release,
not master, so the standard template would silently never release.

Test#445 gains a note that a dead push trigger (wrong branch name)
masks the double-run bug — both tests must be fixed together when the
default branch is not master. References:
- openedx/platform-plugin-aspects#257 (original double-run fix)
- openedx/django-wiki#329 (first non-master default branch case)

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

farhan commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

Caution

release.yml targets master — auto-releases will never fire after this PR merges

This repo's default branch is edx_release. The master branch exists but has had no commits since November 2014 — all development merges into edx_release.

Why this is a breaking change: The existing pypi-publish.yml (deleted by this PR) triggered on on: release: types: [published] — a manually created GitHub Release. That flow worked regardless of branch name. This PR replaces it with PSR auto-release on push to a branch. That branch is master, which never receives commits, so PSR will never run and PyPI publishing is effectively broken from day one after merge.

As currently written, release.yml listens on branches: [master] and guards both the release and publish_to_pypi jobs with if: github.ref_name == 'master'.

Fix: Update the three occurrences in .github/workflows/release.yml:

  • on.push.branches: [master] → [edx_release]
  • if: github.ref_name == 'master' (×2) → 'edx_release'

@feanil -- Can you please look/share your thoughts into this issue or tag the relevant maintainer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan
farhan force-pushed the farhan/modernize-python-repo branch from caac099 to 3b83232 Compare October 6, 2026 15:45
@feanil

feanil commented Oct 7, 2026

Copy link
Copy Markdown

That makes sense to me.

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.

2 participants