Modernize Python tooling (uv, pyproject.toml, src layout, semantic release) - #563
Modernize Python tooling (uv, pyproject.toml, src layout, semantic release)#563salman2013 wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the pull request, @salman2013! 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. |
irfanuddinahmad
left a comment
There was a problem hiding this comment.
Did a full pass verifying against actual current file content and live CI (not just the diff). All CI is green, but that's expected -- the most severe issues live in release.yml, which only runs on push to master and is never exercised by PR CI, so it would merge clean and then break the first real release attempt.
Note: I'm seeing the same changelog: "false" bug in two sibling PRs (code-annotations#246, api-doc-tools#409) with an otherwise-identical release.yml, so this looks like it's baked into a shared template rather than repo-specific -- worth fixing at the source if there is one.
Things that are done correctly and worth not re-litigating: the Django version-matrix pattern (real [tool.uv].conflicts, not the shared-group+deps= anti-pattern seen in 3 sibling repos), pypa/gh-action-pypi-publish correctly left at the stable tag, OIDC-only publish scoping, license/SPDX handling, and no leftover PyPI-publish workflow racing the new one.
| changelog: "false" | ||
| - name: Upload dist | ||
| if: steps.release.outputs.released == 'true' | ||
| uses: actions/upload-artifact@601987b96cf95d5f9a5fe5e0ec0e34c5583d7fc6 # v4.4.3 |
There was a problem hiding this comment.
This is a fabricated commit SHA -- gh api repos/actions/upload-artifact/commits/601987b96cf95d5f9a5fe5e0ec0e34c5583d7fc6 returns 422 No commit found. The action can't even resolve; this job will fail to start. The real commit SHA for v4.4.3 (verified via git ls-remote --tags + confirmed as a real commit) is b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882:
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/download-artifact@fa0a91b85d4f404e444306234e16dac3d6cce7b0 # v4.1.8 |
There was a problem hiding this comment.
Same issue -- fabricated SHA, verified via gh api repos/actions/download-artifact/commits/fa0a91b85d4f404e444306234e16dac3d6cce7b0 returning 422. The real commit SHA for v4.1.8 is fa0a91b85d4f404e444e00e005971372dc801d16 (very close to what's here but not the same -- easy to have mistyped/mis-copied):
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
| with: | ||
| git_committer_name: "github-actions" | ||
| git_committer_email: "github-actions@github.com" | ||
| changelog: "false" |
There was a problem hiding this comment.
changelog: "false" disables changelog generation entirely -- this is the exact setting that caused real CHANGELOG.rst content loss in a sibling repo earlier in this effort. Recommend removing this line and configuring [tool.semantic_release.changelog] in pyproject.toml instead (mode = "update", insertion_flag matching a .. changelog-insertion-marker line at the top of CHANGELOG.rst).
| [tool.setuptools_scm] | ||
| version_scheme = "only-version" | ||
| local_scheme = "no-local-version" | ||
| fallback_version = "0.0.0.dev0" |
There was a problem hiding this comment.
fallback_version = "0.0.0.dev0" -- this exact value crashed 17 tests in a sibling repo (openedx-events) because runtime code parsed __version__ via tuple(map(int, __version__.split("."))) and choked on the non-numeric dev0 segment. I checked this repo's own __version__ consumers (src/edx_lint/write.py, src/edx_lint/cmd/main.py) and neither int-parses it, so it won't crash here today -- but it's still worth using a plain int-parseable value like "0.0.0" to avoid the same class of bug if a consumer is ever added.
| @@ -20,18 +20,14 @@ jobs: | |||
|
|
|||
| steps: | |||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |||
There was a problem hiding this comment.
Missing fetch-depth: 0. Without it, setuptools-scm can't see git tags during test runs and falls back to fallback_version (see the pyproject.toml comment) on every CI run, not just release.yml. release.yml's own checkout correctly has this set.
| allow_zero_version = true | ||
| major_on_zero = false | ||
|
|
||
| [tool.uv] |
There was a problem hiding this comment.
[dependency-groups] above defines a group literally named dev, which collides with uv's implicit default group name. Every invocation in this repo (Makefile: uv run --group test ..., uv run --group quality ...; ci.yml: uv sync --group ci) already names an explicit --group, which is exactly the condition under which default-groups = [] is needed here -- without it, those calls also silently sync the full dev superset alongside the requested narrower group.
Summary
setup.cfg/setup.pytopyproject.toml(PEP 621) withsetuptools-scm, static dependencies, and coverage configpip-toolstouv— addsdependency-groups,uv.lock, updatestox.inito usetox-uv, updates CI to useastral-sh/setup-uv, and removesrequirements/python-semantic-releasefor automated versioning and PyPI publishing via OIDC (replacespypi-publish.yml)src/layout — movesedx_lint/→src/edx_lint/Ticket: openedx/public-engineering#519
Test plan
django42,django52,pylint)uv sync --group devinstalls successfullyuv run tox -e pylintpasses (verified locally)edx-lintwith workflowrelease.ymlbefore merging🤖 Generated with Claude Code