Skip to content

feat: modernize repo to use uv and pyproject.toml (PEP 621/735) - #41

Closed
farhan wants to merge 3 commits into
openedx:mainfrom
farhan:farhan/modernize-python-repo
Closed

feat: modernize repo to use uv and pyproject.toml (PEP 621/735)#41
farhan wants to merge 3 commits into
openedx:mainfrom
farhan:farhan/modernize-python-repo

Conversation

@farhan

@farhan farhan commented Jul 15, 2026

Copy link
Copy Markdown

Important

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

Summary

Modernize `openedx-webhooks-data-schema` to uv + pyproject.toml (PEP 621/735) + src/ layout.

Part of openedx/public-engineering#506.

  • Replace `setup.py`/`setup.cfg` with `pyproject.toml` (PEP 621 static metadata)
  • Switch from pip-compile to `uv` with PEP 735 dependency groups; commit `uv.lock`
  • Move the package into a `src/` layout
  • Retain pylint/isort/pycodestyle as on main (ruff deferred to its own epic per #506); coverage config moved into `pyproject.toml`
  • Update `tox.ini` to use `tox-uv` with `uv-venv-lock-runner`; add `docs` tox env
  • Add `ci.yml` (main had no CI workflow); use `astral-sh/setup-uv`; SHA-pin all actions; add `workflow_call` trigger
  • Drop Python 3.11 support; set `requires-python = ">=3.12"`

Removed

Deleted files: `setup.py`, `setup.cfg`, `requirements/`, `MANIFEST.in`

Removed Makefile targets:

Target Reason
(none) All targets retained; `upgrade` reimplemented for uv (old pip-compile phony prerequisites collapsed into a single target)

Python 3.11 dropped

Python 3.11 is no longer supported by Open edX platform-wide. Removed from the tox envlist, CI matrix, and classifiers.

Not included/implemented

  • `release.yml` / `python-semantic-release` — main had no PyPI publish workflow.

Versioning

[Static] `version = "2.0"` declared directly in `pyproject.toml` — main 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 quality`, `make test`, `python -m build`). Repo-owner is encouraged to run the repo's feature tests before merging.

Code reviewer notes:

  • `MANIFEST.in` deleted: package data is now declared via `[tool.setuptools.package-data]` in `pyproject.toml`, making `MANIFEST.in` redundant.
  • `version` removed from `init.py`: version is canonical in `pyproject.toml`; any callers using `repo_tools_data_schema.version` should switch to `importlib.metadata.version("repo-tools-data-schema")`.
  • `src/` layout: package moved from `repo_tools_data_schema/` to `src/repo_tools_data_schema/`; lint paths in `tox.ini` updated accordingly.
  • `commitlint.yml` already existed on main and is unchanged — conventional commit format was already enforced on this repo.
  • `ci.yml` is entirely new (main had no CI workflow); the `quality` tox env retains the same pylint/pycodestyle/isort checks that were previously run only via `make quality`.
  • `CHANGELOG.rst` retained: no PyPI publish workflow means no semantic-release; keeping the manual release history.

🤖 Generated with Claude Code

Split out of farhan/modernize-repo; ruff retained there for adoption in
a future epic (per openedx/public-engineering#506).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move repo_tools_data_schema/ → src/repo_tools_data_schema/ using git mv
- Add where = ["src"] to [tool.setuptools.packages.find] in pyproject.toml
- Switch coverage config from source = [...] to source_pkgs = [...] for src/ layout
- Update tox.ini lint commands to point at src/repo_tools_data_schema
- Update docs/conf.py to use ../src path for autodoc

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

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@b0a346f). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #41   +/-   ##
=======================================
  Coverage        ?   33.33%           
=======================================
  Files           ?        2           
  Lines           ?       54           
  Branches        ?        7           
=======================================
  Hits            ?       18           
  Misses          ?       36           
  Partials        ?        0           
Flag Coverage Δ
unittests 33.33% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

With source_pkgs in [tool.coverage.run] handling the measurement target,
--cov=<pkg> on the pytest command line causes a redundant path-based lookup
that triggers a CoverageWarning. Using bare --cov lets pyproject.toml config
control what gets measured.

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

farhan commented Jul 16, 2026

Copy link
Copy Markdown
Author

Re-implementation update — src/ layout added

Two new commits added to this branch since the last push:

  1. refactor: move package into src/ layout — moves repo_tools_data_schema/src/repo_tools_data_schema/ using git mv, updates pyproject.toml with where = ["src"] and source_pkgs coverage config, updates tox.ini lint paths, and updates docs/conf.py path.

  2. fix: use --cov without package arg to avoid module-not-measured warning — with source_pkgs in [tool.coverage.run], the bare --cov flag on the pytest command is sufficient; removing the --cov=repo_tools_data_schema argument eliminates a spurious CoverageWarning.

All tox environments (py312, quality, docs) and make targets pass locally. PR description updated to reflect the src/ layout addition.

@farhan farhan closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant