Skip to content

feat: modernize repo to use uv, pyproject.toml, and semantic-release#65

Closed
farhan wants to merge 15 commits into
openedx:masterfrom
farhan:farhan/modernize-repo
Closed

feat: modernize repo to use uv, pyproject.toml, and semantic-release#65
farhan wants to merge 15 commits into
openedx:masterfrom
farhan:farhan/modernize-repo

Conversation

@farhan

@farhan farhan commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Important

PR implemented with the assistance of Claude Code, human-reviewed and improved before pushing to code review.

Summary

Modernize mockprock to uv + pyproject.toml (PEP 621/735).

Part of openedx/public-engineering#506.

  • Replace setup.py with pyproject.toml (PEP 621 static metadata)
  • Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock
  • Replace pylint/isort/pycodestyle with ruff (check + format); coverage config moved into pyproject.toml
  • Update tox.ini to use tox-uv with uv-venv-lock-runner; rename test env to py312
  • Add new ci.yml using astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger
  • Add placeholder test so pytest collects at least one item (mockprock has no existing tests)
  • Drop Python 3.11 support; set requires-python = ">=3.12"

Removed

Deleted files: setup.py, pylintrc, pytest.ini, requirements/

Removed Makefile targets:

Target Reason
quality Replaced by ruff check + ruff format via tox lint env
quality-python Subsumed by the above; no longer a distinct target
test-python Replaced by top-level test target; tox handles env selection

Python 3.11 dropped

Python 3.11 reached end-of-life in October 2024 and Open edX dropped it platform-wide. Removed from the tox envlist, CI matrix, and classifiers. The new minimum is Python 3.12.

Not included

release.yml / python-semantic-release — master had no PyPI publish workflow. The existing release.yml is an npm/Node.js semantic-release pipeline preserved unchanged.

Versioning

[Static] version = "2.0.0" carried over directly from setup.py on master — master had no PyPI publish workflow, so setuptools-scm is not used and the version is bumped manually on each release tag.

Testing Notes

This PR has not been manually tested against the repo's own features. Testing relied on CI checks and local agent tooling (make requirements, make lint, make test, python -m build). Repo-owner is encouraged to run the repo's feature tests before merging.

Code reviewer notes:

  • The existing release.yml is an npm/Node.js pipeline already on master — it is preserved unchanged; no python-semantic-release is introduced.
  • MANIFEST.in is retained with requirements/ references removed; all other lines unchanged from master.
  • The rest_api_client/ subpackage and templates/ are now correctly included in the distribution (master's setup.py omitted them by listing only packages=['mockprock']).

🤖 Generated with Claude Code


The non-ruff modernization work has been extracted into a focused PR per the decision in the main story (public-engineering#506):

This PR retains the ruff adoption and can be rebased onto farhan/modernize-python-repo once that lands, to serve as the ruff epic PR.

farhan and others added 2 commits July 7, 2026 16:12
- Migrated package metadata to pyproject.toml (PEP 621/735)
- Replaced setup.py, requirements/*.txt, pytest.ini, pylintrc, MANIFEST.in
- Switched from pip-compile to uv with PEP 735 dependency groups and uv.lock
- Added python-semantic-release for automated versioning and PyPI publishing
- Replaced pylint/isort/pycodestyle with ruff; coverage config in pyproject.toml
- Added ci.yml using astral-sh/setup-uv and uv run tox
- Updated release.yml to use python-semantic-release v10
- Updated lockfileversion-check.yml to verify uv.lock instead of package-lock.json

Closes openedx/public-engineering#506

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add tests/test_db.py and tests/test_auth.py with 11 passing tests covering
  the DB layer and JWT auth class
- Add requests to test dependency group so rest_api_client can be imported
- Fix ruff violations across all source files: unsorted imports (I001),
  percent-format strings (UP031), super() calls (UP008), unused imports (F401),
  collections.abc migration (UP035), f-string conversion (UP032), and
  exception chaining (B904)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Copilot AI 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.

Pull request overview

This PR modernizes the repo’s Python packaging and automation by moving metadata/config into pyproject.toml, switching dependency management to uv (with dependency groups + lockfile checks), and updating CI/release workflows to support automated publishing.

Changes:

  • Replace legacy packaging + requirements pinning (setup.py, requirements/*.in|*.txt, pytest.ini, pylintrc, MANIFEST.in) with pyproject.toml, uv dependency groups, and ruff.
  • Add/adjust tox + GitHub Actions workflows to run via uv and to perform semantic-release + PyPI publishing.
  • Add new unit tests for DB behavior and JWT auth header injection.

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tox.ini Introduces tox-uv runner and dependency group-based envs for lint/tests.
tests/test_db.py Adds DB unit tests for exams/attempts and row factory behavior.
tests/test_auth.py Adds unit tests for SuppliedJwtAuth.
tests/init.py Adds tests package marker.
setup.py Removes legacy setuptools entrypoint in favor of pyproject.toml.
requirements/testing.txt Removes pip-tools pinned test requirements.
requirements/testing.in Removes pip-tools input file for test requirements.
requirements/server.txt Removes pip-tools pinned server requirements.
requirements/server.in Removes pip-tools input file for server requirements.
requirements/pip.txt Removes pip-tools pinned pip/setuptools/wheel requirements.
requirements/pip.in Removes pip-tools input file for pip requirements.
requirements/pip-tools.txt Removes pip-tools pinned tooling requirements.
requirements/pip-tools.in Removes pip-tools input file for pip-tools requirements.
requirements/constraints.txt Removes constraints indirection used by pip-compile flow.
requirements/common_constraints.txt Removes shared constraints file previously downloaded/used.
requirements/base.txt Removes legacy base requirements file content.
requirements/base.in Removes legacy base requirements input file.
pytest.ini Moves pytest/cov config into pyproject.toml.
pyproject.toml Adds PEP 621 project metadata, dependency groups, ruff/pytest/coverage, and semantic-release config.
pylintrc Removes pylint config (replaced by ruff).
mockprock/server.py Python 3 modernizations + formatting; updates request handling and string usage.
mockprock/rest_api_client/client.py Formatting/modernization; improves exception chaining behavior.
mockprock/rest_api_client/auth.py Modernizes header formatting to f-string.
mockprock/desktop_views.py Formatting/modernization; normalizes string quoting/routes.
mockprock/db.py Formatting/modernization; retains schema setup logic and CRUD helpers.
mockprock/commands.py Updates CLI formatting/argparse style.
mockprock/backend.py Normalizes string quoting for provider metadata.
MANIFEST.in Removes explicit manifest in favor of pyproject/setuptools defaults.
Makefile Replaces pip-tools-based workflow with uv sync/lock + tox/ruff targets.
.github/workflows/release.yml Replaces npm semantic-release with python-semantic-release + artifact publishing + PyPI publish via OIDC.
.github/workflows/lockfileversion-check.yml Replaces package-lock check with uv lock --check.
.github/workflows/ci.yml Adds CI workflow using setup-uv, uv sync, and uv run tox.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mockprock/db.py
Comment thread mockprock/server.py
farhan and others added 12 commits July 8, 2026 17:28
- Add Django framework classifiers (Framework :: Django, 4.2, 5.2)
- Add test-base and doc dependency groups per skill spec
- Add DJ (flake8-django) rule to ruff lint selectors
- Add [tool.ruff.lint.isort] with known-third-party = ["django"]
- Fix ruff target-version from py311 to py312
- Fix Makefile lint/test targets to use `uv run tox` instead of bare `tox`
- Regenerate uv.lock for new dependency groups

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mockprock has no PyPI publish workflow on master — this repo does not
publish to PyPI. The previous commit incorrectly used setuptools-scm
and python-semantic-release (PyPI path). Switch to the correct no-PyPI
path:

- Remove setuptools-scm from [build-system].requires
- Remove [tool.setuptools_scm] section
- Remove dynamic = ["version"]; add static version = "2.0.0" from master
- Remove [tool.semantic_release] section
- Bump requires-python to >=3.12 (modern tooling target)
- Remove Python 3.11 classifier (no longer supported)
- Add [tool.edx_lint].uv_constraints = [] and run
  edx_lint write_uv_constraints to populate
  [tool.uv].constraint-dependencies from common_constraints.txt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… workflow

The release gate failed: master had no PyPI publish workflow (only an
npm-based semantic-release workflow). The new release.yml incorrectly
added python-semantic-release + PyPI publish steps.

Restore the original npm release.yml verbatim from master. The
python-semantic-release workflow has been removed entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
requires-python is now >=3.12. Remove py311-test from tox envlist,
CI matrix, and the make test target.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per migration skill requirements: always add a minimal codecov.yml
(header comment + URL reference) when one does not already exist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…heel

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>
No tests exist in this repo; pytest was exiting with code 5 (no tests
collected). Remove the Codecov upload step and codecov.yml too.

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>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan
farhan marked this pull request as ready for review July 15, 2026 09:29
@farhan farhan moved this to 🏗 In progress in Aximprovements Team Jul 15, 2026
@farhan farhan self-assigned this Jul 15, 2026
@farhan farhan moved this from 🏗 In progress to 👀 In review in Aximprovements Team Jul 15, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan

farhan commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing on account of #66

@farhan farhan closed this Jul 16, 2026
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Aximprovements Team Jul 16, 2026
kdmccormick pushed a commit that referenced this pull request Jul 23, 2026
…o ruff) (#66)

- Replace setup.py with pyproject.toml (PEP 621 static metadata)
- Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock
- Retain pylint/isort as on master (ruff deferred to separate epic per public-engineering#506)
- Update tox.ini to use tox-uv with uv-venv-lock-runner
- Add ci.yml using astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger
- Drop Python 3.11 support; set requires-python = ">=3.12"
- Add placeholder test so pytest collects at least one item

Split from #65; ruff retained there for
adoption in a future epic (per public-engineering#506).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants