Skip to content

Modernize python tooling#282

Open
salman2013 wants to merge 7 commits into
openedx:masterfrom
salman2013:salman/modernize-python-tooling
Open

Modernize python tooling#282
salman2013 wants to merge 7 commits into
openedx:masterfrom
salman2013:salman/modernize-python-tooling

Conversation

@salman2013

Copy link
Copy Markdown

Modernizes the Python tooling for this repo in three phases, aligning with the Open edX org standard established in openedx/sample-plugin.

Ticket: openedx/public-engineering#511
Parent ticket: openedx/public-engineering#506

Changes generated by Claude Sonnet 4.6 using the modernize-python-tooling skill, reviewed by a human.

salman2013 and others added 3 commits July 15, 2026 11:25
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 Jul 15, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @salman2013!

This repository is currently maintained by @codewithemad.

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.

ci.yml was not present before this migration; removing it to avoid
introducing new checks. release.yml runs semantic-release directly
on push to master without a prior test gate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Jul 15, 2026
@irfanuddinahmad

Copy link
Copy Markdown
Contributor

👋 Reviewed this against the same checklist we've been applying across the modernization effort (openedx/public-engineering#506/#511). One real pre-merge blocker and one shared issue:

1. Missing git tag for the actual latest published version. PyPI shows acid-xblock at 0.4.1, but the latest git tag is only 0.4.0 (no 0.4.1 tag exists). Once semantic-release is enabled, setuptools-scm computes the build version from the latest tag — without a matching 0.4.1 tag, the first automated release could compute a version at or below what's already published, which PyPI will reject. Recommend a maintainer push a 0.4.1 (or v0.4.1, matching whatever tag format is configured) tag at the current master HEAD before merging — same issue we hit on openedx-events in this same effort.

2. pypa/gh-action-pypi-publish@release/v1 is a floating branch ref, not a pinned SHA. Same as flagged on xblock-sdk#519 — this is what caused openedx/xblocks-core's release to fail with docker: manifest unknown (https://github.com/openedx/xblocks-core/actions/runs/29327012856/job/87066591905). Worth pinning to a commit SHA. (Filed the same fix upstream against the reference implementation: openedx/sample-plugin#54.)

salman2013 and others added 2 commits July 17, 2026 21:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salman2013
salman2013 force-pushed the salman/modernize-python-tooling branch from 57d2474 to ba46de2 Compare July 17, 2026 17:31
@farhan
farhan self-requested a review July 21, 2026 09:08

@farhan farhan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tox.ini — The migration requires adding tox.ini when absent. Master lacked it too,

Furhter: this migration is the required moment to add it (with requires = tox-uv>=1, runner = uv-venv-lock-runner, dependency_groups =, and a quality env for pylint). Without it uv run tox cannot be used in CI or locally.


Nice to have:
Missing minimal codecov.yml — The migration skill requires adding a minimal codecov.yml

jobs:
run_tests:
uses: ./.github/workflows/ci.yml
secrets: inherit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ci.yml does not exist on this branch or on master.
We ought to add ci to run the tests.

- name: Upload dist artifacts
if: steps.release.outputs.released == 'true'
uses: actions/upload-artifact@v4
with:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/upload-artifact@v4 is not SHA-pinned. All other actions in this file use immutable commit SHAs; this one should too.

Resolve the current SHA:

gh api repos/actions/upload-artifact/git/refs/tags/v4 --jq '.object.sha'

Then use: uses: actions/upload-artifact@<sha> # v4

steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/download-artifact@v4 is not SHA-pinned. Same fix as upload-artifact above.

gh api repos/actions/download-artifact/git/refs/tags/v4 --jq '.object.sha'

Comment thread pyproject.toml
@@ -0,0 +1,101 @@
[build-system]
requires = ["setuptools>=64", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setuptools>=64

same we had a discussion on it.
Not a blocker

Comment thread pyproject.toml
license-files = ["LICENSE.TXT"]
authors = [{name = "edX", email = "oscm@edx.org"}]
classifiers = [
"Development Status :: 4 - Beta",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Django framework classifiers and AGPL trove classifier. setup.py on master included 'License :: OSI Approved :: GNU Affero General Public License v3'; omitting it is a PyPI metadata regression.

Add after the existing classifiers:

"License :: OSI Approved :: GNU Affero General Public License v3",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",

Comment thread pyproject.toml
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python 3.11 should be dropped — the migration target is requires-python = ">=3.12". Python 3.11 reached end-of-life in October 2024 and is removed org-wide in this cycle.

Remove this classifier and update requires-python to ">=3.12" on the following line.

Comment thread src/acid/__init__.py
from .acid import AcidBlock, AcidParentBlock, AcidAside

from importlib.metadata import version
__version__ = version("acid-xblock")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues with __version__:

  1. Import orderingC0411: wrong-import-order: stdlib import (importlib.metadata) placed after a local import (from .acid import ...). This is a new pylint regression not present on master; make quality exits 21. Move the stdlib import to line 1.

  2. Missing fallback — Without except PackageNotFoundError, import acid on an uninstalled checkout raises AttributeError. Add:

from importlib.metadata import version, PackageNotFoundError

from .acid import AcidBlock, AcidParentBlock, AcidAside

try:
    __version__ = version("acid-xblock")
except PackageNotFoundError:
    __version__ = "0.0.0"

Comment thread Makefile
quality-python: ## Run python linters
pylint --rcfile=pylintrc acid setup.py
uv run pylint --rcfile=pylintrc acid

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude suggestion:

After the src/ layout migration, pylint is still passed acid (the old top-level path) rather than src/acid. It resolves correctly today because the package is installed in editable mode, but passing the explicit source path is clearer and consistent with other migrated repos.

Consider: uv run pylint --rcfile=pylintrc src/acid

Comment thread pyproject.toml

[tool.coverage.run]
branch = true
source = ["acid"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude suggested

For a src/-layout package, source_pkgs = ["acid"] is preferred over source = ["acid"]. source_pkgs tells coverage to locate the package via import (finding it under src/) rather than by filesystem path, which avoids measuring the wrong copy when both an editable install and a source directory exist.

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: Ready for Review

Development

Successfully merging this pull request may close these issues.

5 participants