Repository navigation
feat: modernize Python tooling (pyproject.toml + uv + semantic-release) - #590
irfanuddinahmad wants to merge 17 commits into
Conversation
Replace setup.py/setup.cfg with PEP 621 [project] metadata and setuptools-scm for git-tag-based versioning. openedx_events/__init__.py's __version__ (used at runtime by data.EventData.sourcelib) now derives from importlib.metadata instead of a hand-maintained string. The [bumpversion] section in setup.cfg is dropped along with the file -- setuptools-scm now owns versioning. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace requirements/*.in + *.txt with PEP 735 dependency-groups in pyproject.toml and a single uv.lock. Update tox.ini to use tox-uv's uv-venv-lock-runner, update the Makefile, and switch ci.yml to install uv and run via `uv run tox` / `uv sync`. Django 4.2/5.2 are declared as mutually-conflicting dependency-group forks via [tool.uv].conflicts so both coexist in one lock. quality/doc groups preserve the existing pylint + pycodestyle + isort + ruff (docstring-only) toolchain unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Configure python-semantic-release: pushes to main with conventional commits now automatically bump the version, tag it, and publish to PyPI via OIDC trusted-publisher auth (id-token: write, no stored credentials), replacing the old release-triggered publish.yml token-based flow. commitlint.yml already enforces conventional commits in this repo, so no separate commit is needed for that piece. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by 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. |
Three related CI failures found after opening this PR:
- pyproject.toml: fallback_version was "0.0.0.dev0" -- data.EventData.sourcelib
parses __version__ via tuple(map(int, __version__.split("."))), and "dev0"
isn't a valid int, so any environment without visible tags crashed 17 tests
with ValueError. Changed to "0.0.0" (still a placeholder, but int-parseable).
- ci.yml: actions/checkout defaults to a shallow, tag-less clone, so
setuptools-scm could never see real tags in the tests job and always fell
back regardless of the fallback_version fix above. Added fetch-depth: 0.
(release.yml's checkout doesn't need this -- python-semantic-release's own
action auto-deepens a shallow clone before evaluating version history.)
- .readthedocs.yaml: still pointed at requirements/doc.txt, deleted in the
prior commit. Switched to RTD's custom-build-command escape hatch (uv sync
+ sphinx-build), matching the pattern already used in openedx/edx-enterprise#2654.
Verified by simulating CI's actual shallow/no-tags checkout locally
(git clone --depth 1 --no-tags) and confirming all 109 tests pass.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
codecov.yml requires 100% patch coverage. The except branch added in the metadata-consolidation commit can't be exercised in CI/tests (the package is always installed), so codecov/patch correctly flagged it as an uncovered new line. Mark it pragma: no cover rather than contriving a test for an environment that can't occur here. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@release/v1 is a floating branch ref -- xblocks-core's release just failed with "docker: manifest unknown" because the Docker image tag it resolved to at checkout time wasn't published on ghcr.io yet. Pin to the exact commit backing the current v1.14.0 release instead, consistent with this repo's own SHA-pinning rule for every other action. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reviewer feedback: this should be set across the whole batch, not just repos currently on 0.x, so no repo in this effort can ever auto-jump to 1.0.0 as an accidental side effect if it's reset to 0.x in the future. Note this is a no-op for repos already past 1.0 -- major_on_zero only governs the 0.x -> 1.0.0 transition, not 1.x -> 2.0.0 (there's no PSR setting that suppresses major bumps once past 1.0; that's normal SemVer behavior for a breaking-change commit at any version). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
openedx/sample-plugin -- the reference implementation this whole modernization effort points at -- already uses src-layout, which this repo's earlier pyproject.toml migration didn't follow. Move the package under src/ and update every path reference that assumed the old flat layout: - pyproject.toml: add where = ["src"] to packages.find - tox.ini: prefix src/ onto the package name in pylint/pycodestyle/ruff/ isort quality-env commands - Makefile: same prefix in the isort convenience target; also drops a stale reference to setup.py (deleted in the earlier metadata-migration commit, left behind here) - MANIFEST.in: same prefix on the recursive-include line No other path-sensitive helpers found in this repo (no in-package here()/ root() climb, no Dockerfile, docs/conf.py has no sphinx-apidoc call to fix -- simplest of the 7 library repos in this batch). Verified: uv sync against the committed lockfile (no re-lock), full tox matrix (django42, django52, quality, docs) all green, uv build --wheel + twine check pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Same category of fixes farhan flagged on the batch's other reviewed PRs: - ci.yml: add enable-cache/python-version to astral-sh/setup-uv and drop the now-redundant actions/setup-python step (fetch-depth: 0 was already correctly set here and is untouched) - pyproject.toml: add [tool.uv] package = true - Drop CHANGELOG.rst from the dynamic readme file list and delete it -- python-semantic-release + GitHub Releases is the changelog of record - Migrate .coveragerc into [tool.coverage.run] and delete the old file - MANIFEST.in: also fixed a previously-noted-but-unfixed gap from this repo's src-layout commit -- `include requirements/base.in` and `include requirements/constraints.txt` referenced files deleted long ago as part of the uv migration; removed both alongside the CHANGELOG.rst include Verified: uv sync (no lock drift), full django52 test run (109 passed), quality and docs envs pass end to end -- docs env's apidoc + wheel build + twine check confirm the readme/coverage/MANIFEST.in changes work.
|
Here's the bump that was blocking the PR: #593 - but we do have a gh tag matching https://github.com/openedx/openedx-events/tree/v11.2.0 so I'm not sure if it's necessary since all we've done is maintenance on the repo |
…migration # Conflicts: # .github/workflows/ci.yml # .github/workflows/pypi-publish.yml # requirements/base.txt # requirements/ci.txt # requirements/dev.txt # requirements/doc.txt # requirements/pip-tools.txt # requirements/pip.txt # requirements/quality.txt # requirements/test.txt
Makefile now assumes an already-synced/activated local env; uv run stays in CI workflow steps only. See openedx/ccx-keys#190 (review comment r4097501942). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…gration Resolve conflicts with main: drop the requirements/*.txt and *.in files the migration removed, keep CHANGELOG.rst, move the new tasks.py under src/, and add celery (new in base.in on main) to dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the version straight from package metadata, matching the other migrated repos. The package is always installed in dev, CI and prod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
LGTM! Thank you so much for this :))
We can merge this once @salman2013's comments are addressed :)
- release.yml: match openedx/sample-plugin (GITHUB_TOKEN, PSR v10.7.0, vcs_release false + gh release create with dist attached) - .readthedocs.yaml: install via RTD's native uv support, keep fail_on_warning, pin build.os to ubuntu-26.04 - authors: Open edX Project <oscm@openedx.org> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set include-package-data = false, as setup.py had it. With it on, setuptools-scm pulled every tracked file under the package into the wheel, including 72 test schema files. The wheel now matches 11.2.0 on PyPI (plus the new tasks.py). Also drop the isort migrations skip, which wasn't in setup.cfg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep requirements/*.txt deleted; they are replaced by uv.lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…recated serve_docs no longer re-syncs the env (dev already includes doc). Set tag_format explicitly with the standard comment, and point CHANGELOG.rst at GitHub Releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Moves
openedx-eventsto pyproject.toml, uv and python-semantic-release. Part of openedx/public-engineering#514 (parent openedx/public-engineering#506).setup.pyandsetup.cfgreplaced bypyproject.toml. The version now comes from git tags via setuptools-scm.requirements/replaced by uv dependency groups anduv.lock. Django 4.2 and 5.2 share one lock through[tool.uv].conflicts.src/layout.release.ymlmatchesopenedx/sample-plugin: semantic-release withGITHUB_TOKEN, and PyPI publishing through OIDC trusted publishing. This replacespypi-publish.ymland its token.CHANGELOG.rststays..coveragercsettings moved intopyproject.toml.pylintrcandruff.tomlare unchanged.Before merging
openedx-events(repoopenedx/openedx-events, workflowrelease.yml)The
v11.2.0tag exists, so the first automated release continues from 11.2.0.Testing
qualityanddocspass.Reviewer notes
test-djangoXYgroup and extend[tool.uv].conflicts.🤖 Generated with Claude Code