Skip to content

Modernize Python tooling (uv, pyproject.toml, src layout, semantic release) - #563

Open
salman2013 wants to merge 4 commits into
openedx:masterfrom
salman2013:modernize-python-tooling
Open

Modernize Python tooling (uv, pyproject.toml, src layout, semantic release)#563
salman2013 wants to merge 4 commits into
openedx:masterfrom
salman2013:modernize-python-tooling

Conversation

@salman2013

@salman2013 salman2013 commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • Phase 1: Migrate package metadata from setup.cfg/setup.py to pyproject.toml (PEP 621) with setuptools-scm, static dependencies, and coverage config
  • Phase 2: Switch dependency management from pip-tools to uv — adds dependency-groups, uv.lock, updates tox.ini to use tox-uv, updates CI to use astral-sh/setup-uv, and removes requirements/
  • Phase 3: Add python-semantic-release for automated versioning and PyPI publishing via OIDC (replaces pypi-publish.yml)
  • Phase 4: Migrate to src/ layout — moves edx_lint/src/edx_lint/

Ticket: openedx/public-engineering#519

Test plan

  • CI passes on all matrix envs (django42, django52, pylint)
  • uv sync --group dev installs successfully
  • uv run tox -e pylint passes (verified locally)
  • Configure OIDC trusted publisher on PyPI for edx-lint with workflow release.yml before merging

🤖 Generated with Claude Code

salman2013 and others added 4 commits August 6, 2026 15:01
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>
@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Aug 6, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @salman2013!

This repository is currently maintained by @openedx/axim-engineering.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Aug 6, 2026
@salman2013 salman2013 changed the title build: modernize Python tooling (uv, pyproject.toml, src layout, semantic release) Modernize Python tooling (uv, pyproject.toml, src layout, semantic release) Aug 6, 2026

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

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

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.

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

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.

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"

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.

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

Comment thread pyproject.toml
[tool.setuptools_scm]
version_scheme = "only-version"
local_scheme = "no-local-version"
fallback_version = "0.0.0.dev0"

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.

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.

Comment thread .github/workflows/ci.yml
@@ -20,18 +20,14 @@ jobs:

steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

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.

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.

Comment thread pyproject.toml
allow_zero_version = true
major_on_zero = false

[tool.uv]

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.

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

@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

4 participants