Repository navigation
feat: modernize python tooling - #685
Conversation
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #685 +/- ##
==========================================
- Coverage 97.94% 94.23% -3.71%
==========================================
Files 84 36 -48
Lines 8160 2916 -5244
Branches 0 355 +355
==========================================
- Hits 7992 2748 -5244
+ Misses 168 114 -54
- Partials 0 54 +54
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Faraz32123
left a comment
There was a problem hiding this comment.
Thanks for the PR. Once CI is green, I'll again take a look at the PR.
| python-version: | ||
| - '3.12' | ||
| toxenv: [django52, quality] | ||
| toxenv: [django42, django52, quality] |
There was a problem hiding this comment.
django42 testing was already dropped. Let's only support django5.2.
There was a problem hiding this comment.
Already done — current ci.yml matrix is [django52, quality], no django42.
|
👋 Reviewed this against the same checklist we've been applying across the modernization effort. One shared issue, one non-blocking note:
Minor/non-blocking: |
10e707e to
9e15933
Compare
6c30241 to
9a92bec
Compare
|
@Faraz32123 You can review the PR, thanks. |
@salman2013 Unfortunately, I’ve been quite busy lately and missed your message. Could you please resolve the conflicts and tag me again once they’re resolved? |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add NOTICE to license-files so it ships in wheel dist-info - Exclude test subpackages from wheel via packages.find - Add default-groups = [] to [tool.uv] - Fix release.yml: concurrency group, PSR v10.6.2, vcs_release=false, gh release create step, released output fallback, publish_to_pypi if-condition, pin pypa/gh-action-pypi-publish to SHA Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9a92bec to
01f0ba5
Compare
|
@Faraz32123 conflicts have been resolved. |
|
A few things from a modernize-python-tooling review pass:
|
- Use AGPL-3.0-only SPDX identifier to match the original "no or later" classifier, instead of the deprecated bare AGPL-3.0 form. - Reuse python-semantic-release's tag output in release.yml instead of hardcoding a v-prefixed version string, matching the pattern used in sample-plugin. - Fix make test to pass the lti_consumer label explicitly. After the src-layout migration, unittest's discovery can no longer recurse into src/ (no __init__.py), so the bare ./test.py --noinput invocation was silently running 0 tests while still exiting 0. This is what caused the codecov/project coverage drop from 97.93% to 33.28%. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tooling # Conflicts: # requirements/ci.txt # requirements/pip.txt # requirements/quality.txt # requirements/test.txt
…tooling # Conflicts: # .github/workflows/ci.yml # .github/workflows/pypi-publish.yml # requirements/common_constraints.txt # requirements/pip.txt # requirements/pip_tools.txt # src/lti_consumer/__init__.py
| lti_consumer = ["static/**/*", "templates/**/*", "public/**/*", "conf/locale/**"] | ||
|
|
||
| [tool.setuptools.exclude-package-data] | ||
| "*" = ["tests*", "*.tests*", "spec*", "*.spec*"] |
There was a problem hiding this comment.
The wheel doesn't build from a git checkout, so the first release will fail at PSR's build_command:
$ SETUPTOOLS_SCM_PRETEND_VERSION=9.9.9 python -m build --wheel
...
error: can't copy 'src/lti_consumer/locale': doesn't exist or not a regular file
setuptools-scm lists the tracked locale and translations symlinks as files. The translations/ directory also needs to ship, 11.4.4 has the .po/.mo files there and the platform falls back to <pkg>/translations when there are no atlas translations. With this the wheel builds and translations/ matches 11.4.4:
| lti_consumer = ["static/**/*", "templates/**/*", "public/**/*", "conf/locale/**"] | |
| [tool.setuptools.exclude-package-data] | |
| "*" = ["tests*", "*.tests*", "spec*", "*.spec*"] | |
| lti_consumer = ["static/**/*", "templates/**/*", "public/**/*", "conf/locale/**", "translations/**/*"] | |
| [tool.setuptools.exclude-package-data] | |
| # Symlinks to conf/locale; git lists them as files and build_py cannot copy them. | |
| lti_consumer = ["locale", "translations"] | |
| "*" = ["tests*", "*.tests*", "spec*", "*.spec*"] |
| exclude_lines = [ | ||
| "pragma: no cover", |
There was a problem hiding this comment.
| exclude_lines = [ | |
| "pragma: no cover", | |
| exclude_also = [ |
exclude_lines replaces coverage's default pragma regex, and this repo marks its exclusions # pragma: nocover, so those 23 sites start counting as misses. That's 78 of the newly missed lines behind the codecov/project drop. exclude_also keeps the default, so the pragma: no cover entry isn't needed either.
| - name: Install Dependencies | ||
| run: pip install -r requirements/ci.txt | ||
| - name: Install CI dependencies | ||
| run: uv sync --group ci |
There was a problem hiding this comment.
| run: uv sync --group ci | |
| run: uv sync --locked --group ci |
We want --locked on the uv sync and uv run calls in CI so a stale uv.lock fails the build instead of being re-resolved on the runner. Same for the uv run tox below.
| pip install -q -r requirements/dev.txt | ||
|
|
||
| install: install-test | ||
| install: ## Install dev dependencies via uv |
There was a problem hiding this comment.
README.rst still points people at make install-dev, which is gone now, and the section that says setup.py and requirements.txt carry the dependencies needs to point at pyproject.toml and uv.lock instead.
| python setup.py -q sdist | ||
| twine check dist/* | ||
| pycodestyle src/lti_consumer | ||
| pylint --rcfile=pylintrc src/lti_consumer |
There was a problem hiding this comment.
The old make quality built the sdist and ran twine check, and nothing in CI builds the package now, which is how the symlink failure above got past CI. Can we add python -m build and twine check dist/* back to the quality checks?
- Ship translations/ and exclude the locale/translations symlinks so the wheel builds from a git checkout - Use coverage exclude_also to keep the default pragma regex - Run uv sync/uv run with --locked in CI - Build the package and run twine check in make quality - Update README for uv-based setup and pyproject.toml/uv.lock Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Modernizes the Python tooling for xblock-lti-consumer 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 human.