Skip to content

Modernize Python tooling (pyproject.toml, uv, src layout) - #730

Open
salman2013 wants to merge 6 commits into
openedx:masterfrom
salman2013:modernize-python-tooling
Open

salman2013 wants to merge 6 commits into
openedx:masterfrom
salman2013:modernize-python-tooling

Conversation

@salman2013

Copy link
Copy Markdown
Contributor

Summary

Migrates this repo from pip-tools/setup.py to modern Python tooling, following the openedx Python Modernization Initiative.

  • Metadata → pyproject.toml: PEP 621 project metadata replaces setup.py. License converted to SPDX (Apache-2.0). __version__ now resolved via importlib.metadata instead of a hardcoded string. Package discovery now correctly includes all three top-level packages (repo_health, repo_health_dashboard, scripts) and the github-py git dependency, both of which the old setup.py silently excluded from install_requires due to a bug in its load_requirements helper.
  • pip-tools → uv: requirements/*.in/*.txt replaced by [dependency-groups] + uv.lock. tox.ini, Makefile, and CI (.github/workflows/ci.yml) updated to use uv/tox-uv. Two Jenkins-invoked automation scripts (scripts/dependencies-health-script.sh, scripts/repo-health-script.sh) updated since they referenced the now-deleted requirements/base.txt.
  • src layout: repo_health/, repo_health_dashboard/, and scripts/ moved under src/. Updated all path references (pyproject.toml, tox.ini, MANIFEST.in, docs/conf.py, doc links, and the Jenkins scripts' --repo-health-path/--configuration arguments, which point at a cloned copy of this repo).

Not included: python-semantic-release / PyPI publishing automation (Phase 3), since this repo has never had a PyPI release or a git tag — introducing automatic public releases for a never-published package is a separate decision or a repo maintainer to make, not something this migration should force.

Test plan

  • make test — 125 tests pass
  • make quality — pylint 10.00/10, isort clean (under this repo's declared Python 3.12)
  • uv lock --check — lockfile in sync with pyproject.toml
  • python -m build --wheel — wheel builds cleanly; verified repo_health_dashboard/*.yaml config files land in the wheel
  • run_checks --collect-only — confirms scripts/run_checks.py's checks-directory discovery still works after the src/ move
  • Repo maintainer: confirm .github/workflows/upgrade-python-requirements.yml (calls openedx/.github/.github/workflows/upgrade-python-requirements.yml@master) is still compatible with the new make upgrade (uv-based) flow — not verified in this PR

salman2013 and others added 3 commits October 12, 2026 16:15
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Oct 12, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @salman2013!

This repository is currently maintained by @usamasadiq.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.97%. Comparing base (1984896) to head (68807f8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #730      +/-   ##
==========================================
+ Coverage   73.91%   73.97%   +0.06%     
==========================================
  Files          24       24              
  Lines        1445     1445              
==========================================
+ Hits         1068     1069       +1     
+ Misses        377      376       -1     
Flag Coverage Δ
unittests 73.97% <100.00%> (+0.06%) ⬆️

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.

@salman2013 salman2013 changed the title build: modernize Python tooling (pyproject.toml, uv, src layout) Modernize Python tooling (pyproject.toml, uv, src layout) Oct 12, 2026

@irfanuddinahmad irfanuddinahmad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a companion PR to openedx/.github's .github/workflows/repo-health-job.yml, merged together with this one. That workflow still installs edx-repo-health/requirements/pip.txt and pip-tools.txt (deleted here) and runs edx-repo-health/scripts/*.sh (moved to src/scripts/ here), and wg-maintenance's daily cron calls it against master, so the nightly run fails as soon as this merges.

Comment thread pyproject.toml Outdated
dependencies = [
"dockerfile",
"github-py @ git+https://github.com/ShineyDev/github.py.git@8e3514010eb35a91e012f2935f48138b3c35cef6",
"gspread",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep gspread<5.12.0 here. The old setup.py published it, and the scripts' plain pip install -e edx-repo-health doesn't see constraint-dependencies, so the scheduled job would pick up gspread 6.x, which constraints.txt notes breaks it. The pytest<8.1.0 pin the scripts got from requirements/base.txt is lost too, so the scripts should install from uv.lock (can go in the same openedx/.github companion PR).

Comment thread pyproject.toml Outdated
"*" = ["tests*", "*.tests*"]

[tool.coverage.run]
branch = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please drop branch = true. Master had no coverage config, and enabling branch coverage is what drops codecov/project by 2.43% and fails the check.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Oct 22, 2026
salman2013 and others added 3 commits November 5, 2026 12:45
…nto modernize-python-tooling

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Keep the gspread<5.12.0 pin in the published dependencies so a plain
pip install -e (used by the scheduled scripts) doesn't pull gspread 6.x.
Drop branch coverage to match master's coverage config.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tooling

# Conflicts:
#	requirements/base.txt
#	requirements/ci.txt
#	requirements/dev.txt
#	requirements/doc.txt
#	requirements/quality.txt
#	requirements/test.txt

@irfanuddinahmad irfanuddinahmad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The companion PR to openedx/.github's .github/workflows/repo-health-job.yml is still needed before this merges. It still installs requirements/pip.txt/pip-tools.txt and runs edx-repo-health/scripts/*.sh, so the nightly job will fail once this lands.

# Install checks and dashboarding script, this should also install pytest-repo-health
# Install all locked deps (including github-py which is a git+ URL excluded from install_requires)
pip install -q -r edx-repo-health/requirements/base.txt
pip install -q -e edx-repo-health

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace the removed requirements/base.txt install with a locked one, e.g. uv export --frozen --no-emit-project --project edx-repo-health -o reqs.txt && pip install -q -r reqs.txt before this line. Without it, pytest<8.1.0 and cachetools==5.5.2 aren't applied, and the job installs versions the constraints say break it. The companion workflow PR will need to install uv.

# Install checks and dashboarding script, this should also install pytest-repo-health
# Install all locked deps (including github-py which is a git+ URL excluded from install_requires)
pip install -q -r edx-repo-health/requirements/base.txt
pip install -q -e edx-repo-health

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in repo-health-script.sh: please install from the lock here too, so pytest<8.1.0 and cachetools==5.5.2 are applied.

Comment thread uv.lock
@@ -0,0 +1,2621 @@
version = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-seed uv.lock from master's current requirements/*.txt. Master has had dependency upgrades since the lock was made, so 24 packages are older here than on master (e.g. Django 5.2.19 → 5.2.18, diff-cover 11.0.1 → 10.6.0, soupsieve 4.0.1 → 3.0.2), and merging would downgrade them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

3 participants