Migrate to modern Python tooling (uv, pyproject.toml, semantic-release) - #2423
salman2013 wants to merge 5 commits into
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 #2423 +/- ##
==========================================
+ Coverage 95.46% 95.53% +0.06%
==========================================
Files 198 198
Lines 22842 22820 -22
Branches 1551 1549 -2
==========================================
- Hits 21807 21801 -6
+ Misses 780 765 -15
+ Partials 255 254 -1
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:
|
d6b467b to
5ae0ab5
Compare
|
Hi @salman2013, thank you for your contribution! Please let us know when it is ready for review. |
13c9e99 to
7d5e631
Compare
| readme = "README.rst" | ||
| license = "AGPL-3.0-only" | ||
| license-files = ["LICENSE"] | ||
| authors = [ |
There was a problem hiding this comment.
Same as acid-block#282: {name = "edX", email = "oscm@edx.org"} is the legacy convention. This migration effort has standardized on {name = "Open edX Project", email = "oscm@openedx.org"}, matching sample-plugin's actual current pyproject.toml.
There was a problem hiding this comment.
This one doesn't look addressed yet — pyproject.toml still has {name = "edX", email = "oscm@edx.org"}. Please update to {name = "Open edX Project", email = "oscm@openedx.org"} per the migration convention.
There was a problem hiding this comment.
Confirmed — pyproject.toml now has {name = "Open edX Project", email = "oscm@openedx.org"}. Thanks for the fix. Resolving.
|
Hi @salman2013, it looks like one of the coverage checks is failing here. Could you have a look? |
…ntic-release) - Migrate to src layout (src/openassessment/) - Adopt uv for dependency management with pyproject.toml - Add tox environments: docs, quality; update js env to django42 - Integrate python-semantic-release for automated versioning - Update release workflow with immutable releases strategy and bumped action versions - Fix i18n_tool, webpack, and eslint paths for src layout - Update author to Open edX Project convention - Add docs tox env with doc8, build, and twine checks - Switch coverage to source_pkgs; add pragma: no cover to __version__ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
030f813 to
199dc30
Compare
…tooling # Conflicts: # .github/workflows/ci.yml # .github/workflows/pypi-publish.yml # openassessment/__init__.py
The omit pattern 'openassessment/runtime_imports/*' no longer matches 'src/openassessment/runtime_imports/*' after the src layout migration. Use '*/runtime_imports/*' to match regardless of path prefix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Change --cov target from 'openassessment' to 'src/openassessment' so pytest-cov finds the package after the src layout migration - Add 'build' to norecursedirs to prevent stale build artifacts from being collected by pytest - Remove */tests/*, */__pycache__/*, */settings.py from coverage omit to match original .coveragerc behaviour; omitting in-package test files (100% covered) was artificially lowering the project coverage % Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds lock entries for build, doc8, twine and their transitive dependencies introduced in the doc dependency group. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@itsjeyd All tests are green now. |
|
Thanks @salman2013. @openedx/axim-engineering Pinging you here since this repo is currently unmaintained. This PR got approval from a CC earlier (#2423 (review)) and has a green build. Could you please have a look and merge the changes if they look good to you as well? |
|
|
||
| [tool.setuptools.package-data] | ||
| # locale/ is a symlink to conf/locale/ — include the real path instead | ||
| # (setuptools cannot copy symlinked directories into the wheel) |
There was a problem hiding this comment.
python -m build --wheel fails on this branch:
error: can't copy 'src/openassessment/locale': doesn't exist or not a regular file
src/openassessment/locale is a git-tracked symlink to conf/locale, and setuptools-scm's file finder puts every git-tracked path into SOURCES.txt, so build_py tries to copy the symlink as a file. origin/master builds fine. PSR runs build_command before it commits or tags, so the first push to master after this merges fails there and no version publishes.
The comment here is wrong too. MANIFEST.in's recursive-include src/openassessment/locale *.mo does copy through the symlink: published 7.1.1 and a build off this branch both carry the same 77 .mo files under openassessment/locale/, so conf/locale/** only adds a second copy of them.
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
| include = ["openassessment*"] | ||
| exclude = ["*.tests", "*.tests.*"] |
There was a problem hiding this comment.
Once the build is fixed the wheel is 957 files / 4,878,011 bytes, against 466 / 2,601,590 for PyPI 7.1.1. Nothing that shipped before is dropped. What is new is 154 duplicate locale files under openassessment/conf/locale/, 191 test and spec files including 101 fixtures under openassessment/xblock/test/data, and the sass sources, xblock/static/xml and the font-awesome fonts.
include-package-data defaults to true under pyproject.toml, and with setuptools-scm's file finder that means every git-tracked file under a package directory, so neither MANIFEST.in nor [tool.setuptools.package-data] bounds the wheel any more. Widening this exclude to cover *.test is not enough on its own; I tried it and the files still ship as package data of the parent package.
Get the wheel back to what 7.1.1 shipped.
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
There was a problem hiding this comment.
docs is in the tox envlist but not in this matrix, and it is red: tox -e docs stops at doc8 docs/ with 105 errors across 8 files. That env is the only place that runs python -m build --wheel and twine check, which is what would have caught the wheel not building.
Add docs to the matrix and fix the doc8 failures.
| @@ -0,0 +1,121 @@ | |||
| name: Semantic Release | |||
There was a problem hiding this comment.
.github/release_process.md still says to bump the version in openassessment/__init__.py and package.json and then hand-create a matching release tag. That path no longer exists, the Python version comes from git tags now, and semantic-release creates the tag. Update it here.
Summary
Test plan
🤖 Generated with Claude Code