Modernize Python repo: pyproject.toml + uv + semantic-release#251
Modernize Python repo: pyproject.toml + uv + semantic-release#251salman2013 wants to merge 8 commits into
Conversation
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. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0b62620 to
767f8d9
Compare
Resolved conflicts by keeping deletions of requirements/*.txt and .github/workflows/pypi-publish.yml, which were intentionally removed as part of the pip-tools → uv migration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolved conflicts by keeping requirements/*.txt deletions from modernize-branch (migrated to pyproject.toml/uv). Includes codecov-action bump to v6.0.2 from main. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@salman2013 Thanks for creating the PR! I am sharing a review which is done with the help of Claude, please address if you agree:
Below are the gaps in PR #251 relative to the standardized 1.
|
PSR's action environment does not have uv available, so uv build fails. Switch to python -m build (installing it via pip) and remove the now- unnecessary setup-uv step from release.yml. Ref: openedx/XBlock#928 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace pylint/pycodestyle/pydocstyle/isort with ruff (E, F, I, W rules) - Remove CHANGELOG.rst (semantic-release uses GitHub Releases) - Move coverage config from .coveragerc into pyproject.toml - Add Django classifiers and pin setuptools-scm>=8.0 - Add lint/format/test/docs Makefile targets delegating to tox - SHA-pin all GitHub Actions in release.yml - Add push-to-main trigger and set fail-fast: false in python-tests.yml - Delete pylintrc, pylintrc_tweaks, .coveragerc, CHANGELOG.rst Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Modernizes the repo’s Python packaging/tooling by moving metadata/config into pyproject.toml, switching dependency management to uv, and introducing automated releases via python-semantic-release (plus commit message linting).
Changes:
- Migrate packaging metadata/config from
setup.py/setup.cfgintopyproject.toml(PEP 621) withsetuptools-scm. - Replace
pip-tools/requirements/*.txtwithuvdependency groups + updatedtox.iniand Make targets. - Add GitHub Actions workflows for semantic-release publishing and commitlint; update Python CI to use
uv.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
pyproject.toml |
New canonical packaging + tool configuration; defines dependency groups for uv/tox. |
tox.ini |
Switch tox to tox-uv with uv-venv-lock-runner and dependency groups. |
Makefile |
Replace pip-tools workflow with uv-based install/upgrade and new lint/test/docs targets. |
README.rst |
Update documentation for uv-based setup and adjust project status wording. |
.github/workflows/python-tests.yml |
Update CI to install dependencies with uv and run tox via uv run. |
.github/workflows/release.yml |
Add semantic-release-based GitHub Release + PyPI publish via OIDC. |
.github/workflows/commitlint.yml |
Add Conventional Commits enforcement via reusable workflow. |
MANIFEST.in |
Adjust packaged root files after metadata migration/removals. |
setup.py |
Removed legacy setuptools metadata and pip-tools requirement loading. |
setup.cfg |
Removed legacy tool configuration (isort/wheel). |
requirements/* |
Removed pip-tools compiled requirements and constraints files in favor of uv. |
pylintrc / pylintrc_tweaks |
Removed pylint configuration (quality now via ruff). |
.github/workflows/pypi-publish.yml |
Removed legacy PyPI publish workflow (superseded by release workflow). |
.coveragerc |
Removed in favor of coverage config in pyproject.toml. |
CHANGELOG.rst |
Removed legacy changelog file (semantic-release configured without changelog generation). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * In Development: We're building and testing this block. | ||
| * Ready to Use: You can try this on your site using the Waffle flag. | ||
| * Done: The built-in block has been removed. The setup.py entrypoint has been removed from edx-platform and added to xblock-contrib. | ||
| * Done: The built-in block has been removed. The ``pyproject.toml`` entry-point has been removed from edx-platform and added to xblock-contrib. |
| "beautifulsoup4", | ||
| "chem", | ||
| "defusedxml", | ||
| "django", |
| run_tests: | ||
| uses: ./.github/workflows/python-tests.yml | ||
|
|
| lint: ## run linting checks | ||
| tox -e quality | ||
|
|
||
| format: ## auto-fix ruff lint and formatting issues | ||
| uv run ruff check --fix . | ||
| uv run ruff format . | ||
|
|
||
| test: ## run tests against all supported Python/Django combinations | ||
| tox -e "py312-django{42,52}" | ||
|
|
||
| docs: ## build documentation | ||
| tox -e docs | ||
|
|
||
| upgrade: ## update uv.lock and regenerate uv constraints from edx-lint | ||
| uv run --with edx-lint edx_lint write_uv_constraints pyproject.toml | ||
| uv lock --upgrade | ||
|
|
||
| requirements: ## install development environment requirements using uv | ||
| uv sync --group dev | ||
| uv tool install tox --with tox-uv |
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
|
|
| jobs: | ||
| python-tests: | ||
| name: Run Python Tests and Coverage | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
I think we should the tox env name so it's immediately clear which matrix job failed.
| runs-on: ubuntu-latest | |
| name: ${{ matrix.toxenv }} |
|
|
||
| [tool.ruff.lint] | ||
| select = ["E", "F", "I", "W"] | ||
|
|
There was a problem hiding this comment.
I like the way how they are defined in the xblocks-extra, I think we should follow same tools and docs.
Summary
Modernizes the Python tooling for
xblocks-contribin three phases, aligning with the Open edX org standard established inopenedx/sample-plugin.Ticket: openedx/public-engineering#506
Commits
chore: migrate package metadata to pyproject.tomlpyproject.toml(PEP 621) with staticdependencieslist anddynamic = ["version"]setuptools-scm(version_scheme = "only-version",local_scheme = "no-local-version")license = "AGPL-3.0"+license-files = ["LICENSE.txt"]setup.pyandsetup.cfgchore: switch dependency management from pip-tools to uv[dependency-groups](PEP 735):test-base,test(Django 5.2),django42,quality,doc,ci,dev[tool.uv].conflictsto allow Django 4.2 and 5.2 to coexist in a singleuv.lockwith separate resolutions[tool.edx_lint].uv_constraintsholds repo-specific pins;[tool.uv].constraint-dependenciesmanaged byedx_lint write_uv_constraintstox.inito usetox-uv>=1anduv-venv-lock-runnerwithdependency_groupsMakefile:upgraderunsuv lock --upgrade,requirementsrunsuv sync --group devpython-tests.yml: addedastral-sh/setup-uv,uv sync --group ci,uv run toxrequirements/directory (11 files)chore: add python-semantic-release and commitlint workflows[tool.semantic_release]withbuild_commandexportingSETUPTOOLS_SCM_PRETEND_VERSION=$NEW_VERSIONbeforeuv buildrelease.yml: runspython-tests.ymlas a reusable workflow, then PSR v10.5.3 onmain, publishes to PyPI via OIDC trusted publisher (no token needed)commitlint.yml: enforces conventional commit format on PRspypi-publish.yml(was causing duplicate publishes)upgrade-python-requirements.ymlto sharedopenedx/.githubreusable workflowREADME.rstwith uv-based setup instructionsTest plan
make requirementsuv run tox -e django42uv run tox -e django52uv run tox -e docs