feat: modernize to uv + pyproject.toml + python-semantic-release - #444
feat: modernize to uv + pyproject.toml + python-semantic-release#444irfanuddinahmad wants to merge 7 commits into
Conversation
Move auth_backends/ to src/auth_backends/, per the confirmed decision on openedx/public-engineering#506 that src/ layout is in scope for this cycle (precedented by xblock-core/xblock-extras). Update setup.py, tox.ini, and pytest.ini to reference the new path.
Replace setup.py/setup.cfg with PEP 621 static metadata in pyproject.toml. setuptools-scm now derives the version from git tags instead of the hardcoded __version__ in auth_backends/__init__.py; that attribute is kept for backward compatibility but now reads the installed package version via importlib.metadata. Coverage configuration is consolidated into [tool.coverage.*]. Part of openedx/public-engineering#506.
Replace requirements/*.in/*.txt with PEP 735 dependency groups in pyproject.toml (test-base, test, quality, ci, dev), resolved into a committed uv.lock. Update tox.ini to use tox-uv with the uv-venv-lock-runner, and update the Makefile and CI workflow to install dependencies via uv sync instead of pip-compile / pip-sync. CI now uses astral-sh/setup-uv (SHA-pinned) with caching, runs each tox env via `uv run tox -e <env>`, and checks out with fetch-depth: 0 so setuptools-scm can see tags during test runs. Also drop stale requirements/ references from MANIFEST.in. Part of openedx/public-engineering#506.
Add [tool.semantic_release] to pyproject.toml and a new release.yml workflow: run tests via the reusable ci.yml, cut a release with python-semantic-release on push to master, and publish to PyPI via OIDC trusted publishing (no stored token). Replaces the old tag-triggered pypi-publish.yml, which used a stored PYPI_UPLOAD_TOKEN and an unpinned pypa/gh-action-pypi-publish@release/v1 ref. commitlint.yml already existed and needed no changes. Part of openedx/public-engineering#506.
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently unmaintained. 🔘 Find a technical reviewerTo get help with finding a technical reviewer, reach out to the community contributions project manager for this PR:
Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
changelog: "false" was blindly copied from the sample-plugin reference template with no ticket ever requiring it disabled. CHANGELOG.rst was never deleted, so wire semantic-release to update it in place going forward: add the insertion marker, configure [tool.semantic_release.changelog] with mode="update", and set tag_format to match this repo's existing "vX.Y.Z" tag convention.
Version bumping and changelog entries are now handled automatically by python-semantic-release on merge to master, so the manual "Version bump if needed" / "Changelog record added" checklist items no longer apply.
python-semantic-release's release.yml now creates the tag and publishes to PyPI automatically on merge -- these were no longer real manual steps.
Summary
Modernize
auth-backendsto uv + pyproject.toml (PEP 621/735) + python-semantic-release.Part of openedx/public-engineering#506 (tracked in public-engineering#516).
auth_backends/tosrc/auth_backends/— per the confirmed decision on public-engineering#506 (2026-07-15) thatsrc/layout is in scope this cycle, precedented byxblock-core/xblock-extrassetup.py/setup.cfgwithpyproject.toml(PEP 621 static metadata)uvwith PEP 735 dependency groups (test-base,test,quality,ci,dev); commituv.locktox.inito usetox-uvwithuv-venv-lock-runnerci.yml) to useastral-sh/setup-uv, SHA-pin all actions, addfetch-depth: 0so setuptools-scm sees tagspython-semantic-release+release.yml, replacing the old tag-triggeredpypi-publish.yml(stored PyPI token, unpinnedpypa/gh-action-pypi-publish@release/v1); publish to PyPI via OIDC trusted publishing insteadcommitlint.ymlalready existed and needed no changesRemoved
Deleted files:
setup.py,setup.cfg,requirements/(all.in/.txtfiles),.github/workflows/pypi-publish.ymlRemoved Makefile targets:
$(COMMON_CONSTRAINTS_TXT)wget target and thepyjwt/social-auth-coreconstraint-strippingsedsteps inupgrade(no longer needed —edx_lint write_uv_constraintshandles constraints now)Not included
No ruff/lint-tooling changes — pylint/pycodestyle/edx-lint are left exactly as configured before (no isort config existed in
setup.cfgto port); this migration is tooling-only, not a linting overhaul.Versioning
Dynamic —
setuptools-scmderives the package version from git tags (version_scheme = "only-version",local_scheme = "no-local-version",fallback_version = "0.0.0"). Confirmed the latest git tag (v5.0.0, viagit tag --sort=-v:refname) matches the latest version actually published on PyPI (5.0.0), so the first automated release frompython-semantic-releaseshould compute a version strictly newer than 5.0.0.Testing Notes
Verified locally:
uv lockresolves cleanly (uv lock --checkpasses)uv sync --group devsucceedsuv run tox— all three envs pass:django52(21 tests),quality(pycodestyle + pylint),check_keywordspython -m build(the exactbuild_commandsemantic-release will invoke) produces a correct wheel: entry points n/a, SPDX license expression, README-as-long-description, andedx_auth_backends-5.0.0.dist-info/licenses/LICENSE.txtall verified by inspecting the built wheel's METADATA/file list; test files (tests/*) are correctly excluded from the wheelomit(*/tests/*, etc.) drops the reported package coverage from 99% to 98% (a one-time ~1% drop from no longer counting test files' own trivially-covered statements) — well within the existingcodecov.yml's 95% project/patch thresholds, so nocodecov.ymlchange was needed for this repo (unlike some sibling repos in this effort where the drop was larger)src/layout: verifieduv syncgives an importable editable install (import auth_backendsresolves tosrc/auth_backends/__init__.py) andpython -m buildproduces a wheel withauth_backends/*at its root (thesrc/prefix is a source-tree-only convention). This repo has no mypy config to verify against.Could not verify locally (needs CI / a maintainer):
secrets.CODECOV_TOKENavailability)OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKENorg secret (used byrelease.ymlto letpython-semantic-releasepush the release commit/tag) is configured for this repoedx-auth-backends, as far as I can tell — this needs a maintainer with PyPI project-owner access to addopenedx/auth-backends'srelease.yml/publish_to_pypienvironment as a trusted publisher on pypi.org. This is not a blocker for merging this PR, but the first automated release will fail at thepublish_to_pypijob until it's set up.Known out-of-scope gap:
upgrade-python-requirements.yml.github/workflows/upgrade-python-requirements.ymlcalls the org's shared reusableworkflow (
openedx/.github/.github/workflows/upgrade-python-requirements.yml), whichhardcodes
ADD_PATHS="requirements"(plus ascripts/**/requirements*glob) for thePR-creation step, with no
add_paths-style input exposed on itsworkflow_call(confirmed by reading its source directly). Now that
requirements/is deleted, thisscheduled job will keep running but will never see
uv.lock/pyproject.tomlchangesas a match for its hardcoded add-paths glob — it won't fail, it'll just silently stop
producing real dependency-upgrade PRs. This can't be fixed from this repo alone (it
requires parameterizing or auto-detecting in the centrally-owned reusable workflow) —
flagging it here rather than leaving it as a silent gap, same treatment as the PyPI
OIDC item above.
Code reviewer notes
sixremains a runtime dependency even though it's only imported byauth_backends/tests/test_backends.py, not by any production module — carried forward unchanged from the oldinstall_requiressince this migration doesn't touch actual dependency behavior.auth_backends/__init__.py's__version__now reads fromimportlib.metadatainstead of being hardcoded, to avoid it going stale after the first tag-less commit.release.yml's action pins (python-semantic-release/python-semantic-release@v10.6.1,publish-action@v10.6.1,actions/upload-artifact@v7,actions/download-artifact@v8) intentionally use plain version tags, matchingopenedx/XBlock's actual productionrelease.ymlexactly — earlier sibling PRs in this same effort SHA-pinned these and 3 of 5 turned out to have fabricated/swapped SHAs, so this repo deliberately does not repeat that. Onlypypa/gh-action-pypi-publishis SHA-pinned (ba38be9e461d3875417946c167d0b5f3d385a247= the real commit for tagv1.14.1, verified viagh api repos/pypa/gh-action-pypi-publish/commits/<sha>), because@release/v1is a floating branch with a confirmed production failure history.tox.ini'scheck_keywordsenv anddb_keyword_overrides.yml/manage.pymechanism (fromedx-django-release-util) are unchanged in behavior, just switched todependency_groups = testand verified passing locally.This PR was created with Claude Code.