Modernize python tooling#519
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>
|
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. |
Populates [tool.uv].constraint-dependencies with setuptools<82.0 and common constraints so uv.lock pins setuptools to <82 (required by openedx-django-pyfs which uses pkg_resources). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@openedx/axim-engineering this is ready for review. Thanks! |
|
👋 Reviewed this against the same checklist we've been applying across the modernization effort (openedx/public-engineering#506/#511/#513/#514). A couple of things worth fixing before merge: 1. Old 2. Minor/non-blocking: |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24e1715 to
6bad88d
Compare
There was a problem hiding this comment.
Improvements:
-
CHANGELOG.rstnot deleted — for PyPI repos (release gate passed),CHANGELOG.rstshould be deleted becausepython-semantic-releasetakes over release notes. The file is also still listed inMANIFEST.in. — this is an absent deletion. -
.github/workflows/pypi-publish.ymlnot deleted — this workflow fires on every tag push and will conflict withrelease.yml, causing duplicate publish attempts.
| @@ -0,0 +1,161 @@ | |||
| [build-system] | |||
| requires = ["setuptools>=64", "setuptools-scm>=8.0"] | |||
There was a problem hiding this comment.
We had a discussion on it.
It's not a blocker.
| "workbench" = ["static/**/*", "templates/**/*", "test/**/*"] | ||
|
|
||
| [tool.setuptools.exclude-package-data] | ||
| "*" = ["tests*", "*.tests*", "spec*", "*.spec*"] |
There was a problem hiding this comment.
The pattern "tests*" does not match directories named test/ (singular). The test dirs in this repo (workbench/test/, sample_xblocks/basic/test/) use the singular form, so they appear in the built wheel. Add "test*" and "*.test*":
"*" = ["test*", "tests*", "*.test*", "*.tests*", "spec*", "*.spec*"]|
|
||
| [tool.coverage.run] | ||
| branch = true | ||
| source = ["."] |
There was a problem hiding this comment.
After the src/ move, source = ["."] measures coverage from the repo root rather than the installed packages. Use source_pkgs instead:
source_pkgs = ["workbench", "sample_xblocks"]This ensures pytest-cov targets the installed package under src/ rather than unrelated root-level files.
| branch = true | ||
| source = ["."] | ||
| omit = [ | ||
| "workbench/test/*", |
There was a problem hiding this comment.
The omit paths here (and on the next line) use the pre-src/ layout. After the move, test files live at src/workbench/test/* and src/sample_xblocks/*/test/*, so these patterns will not match and test-helper code will be included in coverage:
omit = [
"src/workbench/test/*",
"src/sample_xblocks/*/test/*",
"*/migrations/*",
"*/__pycache__/*",
"*/settings.py",
]| __version__ = '0.14.0' | ||
| from importlib.metadata import version | ||
|
|
||
| __version__ = version("xblock-sdk") |
There was a problem hiding this comment.
importlib.metadata.version() raises PackageNotFoundError on any checkout that hasn't been pip install -e .'d. Wrap with a fallback:
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version("xblock-sdk")
except PackageNotFoundError:
__version__ = "0.0.0"|
|
||
| - name: Upload dist artifacts | ||
| if: steps.release.outputs.released == 'true' | ||
| uses: actions/upload-artifact@v4 |
There was a problem hiding this comment.
actions/upload-artifact@v4 is a floating tag. Pin to a SHA with a version comment for supply-chain security, consistent with actions/checkout and setup-uv elsewhere in this PR.
|
|
||
| steps: | ||
| - name: Download dist artifacts | ||
| uses: actions/download-artifact@v4 |
There was a problem hiding this comment.
actions/download-artifact@v4 is a floating tag. Pin to a SHA with a version comment, same as the upload step above.
| @@ -1,33 +1,33 @@ | |||
| name: Python CI | |||
| on: | |||
| push: | |||
There was a problem hiding this comment.
The push: branches: [master] trigger was removed.
Is this intentional?
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.