Skip to content

feat: modernize repo to use uv and pyproject.toml#436

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

feat: modernize repo to use uv and pyproject.toml#436
farhan wants to merge 3 commits into
openedx:masterfrom
farhan:farhan/modernize-repo

Conversation

@farhan

@farhan farhan commented Jul 7, 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 to uv + pyproject.toml (PEP 621/735).

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
  • 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
  • Update CI to use astral-sh/setup-uv; SHA-pin all actions; add workflow_call trigger

Removed

Deleted files: setup.py, setup.cfg, requirements/, .coveragerc, pylintrc, pylintrc_tweaks

Removed Makefile targets:

Target Reason
check-setup.py setup.py deleted — no equivalent target in pyproject.toml workflow
compile-requirements Replaced by uv sync; pip-compile workflow removed
install-dev-requirements Replaced by uv sync --group dev
pip-compile pip-compile replaced by uv
pip-compile-upgrade pip-compile replaced by uv
pylint pylint replaced by ruff

Not included

release.yml / python-semantic-release — master had no PyPI publish workflow.

Versioning

[Static] version = "0.1.0" declared directly in pyproject.toml — 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:

  • tox.ini is newly added (master had none); it drives all CI jobs (lint, mypy, docs, py312-test) via tox-uv.
  • The CI matrix is restructured: a single ubuntu-latest runner replaces the old matrix.os axis, with separate tox envs per job. The existing required status check name "Tests (ubuntu-latest, 3.12)" is preserved via matrix.job-name.
  • Pay close attention to the ruff rule set in pyproject.toml — some pylint checks that were previously enforced may not have a direct ruff equivalent, so confirm the linting coverage meets the project's expectations.

🤖 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.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.85106% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.17%. Comparing base (6b9feb1) to head (7225860).

Files with missing lines Patch % Lines
openedx_webhooks/utils.py 55.00% 9 Missing ⚠️
openedx_webhooks/github_views.py 44.44% 5 Missing ⚠️
openedx_webhooks/tasks/github.py 50.00% 4 Missing ⚠️
openedx_webhooks/tasks/__init__.py 57.14% 3 Missing ⚠️
openedx_webhooks/tasks/pr_tracking.py 91.89% 3 Missing ⚠️
openedx_webhooks/debug.py 0.00% 1 Missing ⚠️
openedx_webhooks/tasks/jira_work.py 50.00% 1 Missing ⚠️
openedx_webhooks/ui.py 50.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (6b9feb1) and HEAD (7225860). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (6b9feb1) HEAD (7225860)
1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #436       +/-   ##
===========================================
- Coverage   89.84%   78.17%   -11.68%     
===========================================
  Files          38       19       -19     
  Lines        3103     1356     -1747     
  Branches      239      167       -72     
===========================================
- Hits         2788     1060     -1728     
+ Misses        281      271       -10     
+ Partials       34       25        -9     
Flag Coverage Δ
unittests 78.17% <80.85%> (?)

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.

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 Python packaging, dependency management, linting, CI, and release automation for openedx-webhooks by migrating to pyproject.toml + uv dependency groups/lockfile patterns and introducing semantic-release-driven publishing.

Changes:

  • Migrates packaging metadata from setup.py/setup.cfg + requirements/*.in|.txt to pyproject.toml dependency groups and uv workflows (incl. tox-uv).
  • Replaces pylint/isort/pycodestyle with ruff and updates test/lint/docs automation (Makefile, tox, CI).
  • Adds GitHub Actions release workflow using python-semantic-release and OIDC-based PyPI publishing.

Reviewed changes

Copilot reviewed 60 out of 63 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tox.ini Adds tox configuration using tox-uv runners and dependency groups.
tests/test_utils.py Formatting/ruff-driven style updates in tests.
tests/test_rescan.py Formatting/ruff-driven style updates in tests.
tests/test_pull_request_opened.py Formatting/ruff-driven style updates in tests.
tests/test_pull_request_closed.py Formatting/ruff-driven style updates in tests.
tests/test_pr_comments.py Import ordering/formatting changes in tests.
tests/test_info.py Formatting/import ordering changes in tests.
tests/test_helpers.py Formatting + minor idiomatic set-comprehension change in tests.
tests/test_gh_projects.py Formatting/quote style normalization in tests.
tests/test_faker.py Formatting/spacing tweaks in tests.
tests/test_fake_jira.py Formatting/spacing tweaks in tests.
tests/test_fake_github.py Formatting/parametrize style tweaks in tests.
tests/helpers.py Type-hint spacing and comment alignment tweaks.
tests/faker.py Formatting + raw f-string prefix tweak.
tests/fake_jira.py Modernizes typing syntax (PEP 604/585) and formatting.
tests/fake_github.py Modernizes typing syntax (PEP 604/585) and formatting.
tests/conftest.py Modernizes typing syntax (PEP 585) and formatting.
setup.py Removes legacy setuptools build script (migrated to pyproject.toml).
setup.cfg Removes legacy tool configuration (migrated to pyproject.toml).
requirements/test.txt Removes pip-compile generated pinned requirements (migrated to uv).
requirements/test.in Removes pip-compile input requirements (migrated to uv groups).
requirements/private.readme Removes pip-tools private requirements guidance (no longer used).
requirements/pip.txt Removes pip-tools bootstrap pins (no longer used).
requirements/pip.in Removes pip-tools bootstrap inputs (no longer used).
requirements/pip-tools.txt Removes pip-tools pins (no longer used).
requirements/pip-tools.in Removes pip-tools inputs (no longer used).
requirements/doc.txt Replaces pip-compile export with uv export output.
requirements/doc.in Removes pip-compile doc inputs (migrated to uv groups).
requirements/dev.txt Removes pip-compile dev pins (migrated to uv groups).
requirements/dev.in Removes pip-compile dev inputs (migrated to uv groups).
requirements/constraints.txt Removes pip constraint mechanism (replaced by uv/edx-lint flow).
requirements/base.txt Removes base pinned requirements (migrated to pyproject.toml).
requirements/base.in Removes base inputs (migrated to pyproject.toml).
requirements.txt Removes legacy requirements entrypoint.
pyproject.toml Adds PEP 621 metadata, dependency groups, and tool configs (ruff/pytest/coverage/mypy/scriv/semantic-release).
pylintrc_tweaks Removes legacy pylint plugin tweak file (pylint removed).
pylintrc Removes generated pylint configuration (pylint removed).
openedx_webhooks/utils.py Typing modernizations + small refactors/formatting and safer graphql_query signature.
openedx_webhooks/ui.py Formatting and f-string update.
openedx_webhooks/types.py Migrates type aliases to builtin generics/PEP 585.
openedx_webhooks/tasks/pr_tracking.py Typing modernizations + formatting; minor refactors.
openedx_webhooks/tasks/jira_work.py Typing modernizations + formatting.
openedx_webhooks/tasks/github.py Typing modernizations + formatting; minor refactors.
openedx_webhooks/tasks/init.py Formatting and route string normalization.
openedx_webhooks/settings.py Typing modernizations (`
openedx_webhooks/info.py Typing modernizations; updates imports/formatting.
openedx_webhooks/github_views.py Formatting/structural cleanup for request handling and dict literals.
openedx_webhooks/gh_projects.py Typing modernizations + formatting; minor refactors.
openedx_webhooks/debug.py Formatting simplification.
openedx_webhooks/config.py Formatting cleanup; tuple literal normalization.
openedx_webhooks/cla_check.py Typing modernizations + formatting.
openedx_webhooks/bot_comments.py Typing modernizations + formatting; string literal normalization.
openedx_webhooks/auth.py Formatting simplification; comment spacing normalization.
openedx_webhooks/init.py Import ordering/formatting updates for app setup.
Makefile Replaces pip-tools targets with uv/tox/ruff oriented developer commands.
docs/conf.py Quote/style normalization consistent with formatter.
codecov.yml Adds Codecov status thresholds/targets.
.readthedocs.yaml Switches RTD install to doc requirements + pip install project.
.isort.cfg Removes legacy isort config (ruff handles import sorting).
.github/workflows/release.yml Adds semantic-release-driven release + artifact publish pipeline.
.github/workflows/ci.yml Updates CI to use uv + tox matrix and uploads coverage from tests env.
.coveragerc Removes legacy coverage config (migrated to pyproject.toml).

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

Comment thread openedx_webhooks/info.py
Comment thread openedx_webhooks/__init__.py Outdated
@farhan farhan self-assigned this Jul 9, 2026
@farhan farhan moved this to 🏗 In progress in Aximprovements Team Jul 9, 2026
@farhan
farhan force-pushed the farhan/modernize-repo branch from 2071e65 to e72089e Compare July 10, 2026 11:39
@farhan
farhan marked this pull request as ready for review July 10, 2026 11:54
@farhan farhan moved this from 🏗 In progress to 👀 In review in Aximprovements Team Jul 13, 2026
@farhan
farhan force-pushed the farhan/modernize-repo branch from 966b4d2 to 4b54aad Compare July 13, 2026 11:18
@irfanuddinahmad

Copy link
Copy Markdown
Contributor

Overall this looks like a clean modernization, but two things worth resolving before merge:

  1. openedx_webhooks/tasks/pr_tracking.py_fix_project_node_fields: the new guard if settings.GITHUB_OSPR_PROJECT is None: return isn't a reformat — it's not present on master. Previously, if GITHUB_OSPR_PROJECT were unset while github_projects_info was non-empty, this would raise a TypeError; now it silently no-ops instead. Looks like a mypy-driven fix (confirmed mypy now passes in CI, which it wasn't gated on before), but since it changes control flow, can you confirm the silent-skip behavior is intentional and add test coverage for it?

  2. The codecov/patch and codecov/project checks are currently failing on this PR — worth checking whether that's just a "no baseline yet" artifact of coverage tracking being new to this repo, or a real gap (possibly the new branch above).

Everything else (tests, remaining app code, tooling/config) checked out as cosmetic/mechanical — nice touch preserving the Tests (ubuntu-latest, 3.12) required-check name via matrix.job-name in ci.yml.

@farhan

farhan commented Jul 14, 2026

Copy link
Copy Markdown
Author

Thanks for the careful read!

_fix_project_node_fieldsGITHUB_OSPR_PROJECT is None guard

The silent-skip behavior is intentional. On master, if GITHUB_OSPR_PROJECT is unset while github_projects_info is non-empty, the code raises a TypeError on settings.GITHUB_OSPR_PROJECT[0] — which is both unhandled and incorrect behavior. The right thing to do when there's no OSPR project configured is to simply skip updating project fields, which is what the early return does. The change was surfaced by mypy (which now runs in CI), but the fix reflects correct intent.

A unit test covering this branch has been added: it instantiates PrTrackingFixer directly with GITHUB_OSPR_PROJECT=None and a non-empty github_projects_info, calls _fix_project_node_fields, and asserts no update action is taken.

farhan and others added 3 commits July 14, 2026 15:16
- Migrated package metadata to pyproject.toml (PEP 621/735) — replaces setup.py, setup.cfg
- Switched dependency management from pip-compile to uv with PEP 735 dependency groups and uv.lock
- Replaced pylint/isort/pycodestyle with ruff; coverage and mypy config moved into pyproject.toml
- Updated CI to use astral-sh/setup-uv and uv run tox with dependency groups
- Dropped support for Python < 3.12 (requires-python = ">=3.12")

Note: release.yml / python-semantic-release not added — master had no PyPI publish workflow.

Part of openedx/public-engineering#506

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Since this repo has no PyPI publish workflow and is not integrating
python-semantic-release, setuptools-scm adds no value. Replace the
dynamic version with a static 0.1.0 (matching master's __version__)
and drop the setuptools-scm build dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@farhan
farhan force-pushed the farhan/modernize-repo branch from d240205 to 7225860 Compare July 14, 2026 10:16
@farhan farhan changed the title feat: modernize repo to use uv, pyproject.toml, and semantic-release feat: modernize repo to use uv and pyproject.toml Jul 15, 2026
@farhan

farhan commented Jul 15, 2026

Copy link
Copy Markdown
Author

Closing on account of #437

@farhan farhan closed this Jul 15, 2026
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Aximprovements Team Jul 15, 2026
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.

3 participants