Repository navigation
Conversation
|
Thanks for the pull request, @irfanuddinahmad! 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. |
Per explicit direction on PR openedx#704 review thread r3880106779: follow sample-plugin's release.yml exactly, including this pin, superseding the skill's prior guidance (reversed 2026-08-05) to leave this one action on the floating @release/v1 tag. SHA verified against the action repo's own tag history before use (dc37677b -> v1.14.2). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9218fb4 to
0c6634e
Compare
Modernize openedx-core to uv + pyproject.toml (PEP 621/735) + python-semantic-release. Part of openedx/public-engineering#506 (tracked in openedx/public-engineering#516). - Replace setup.py/setup.cfg with pyproject.toml (PEP 621 static metadata), version derived from git tags via setuptools-scm. - Switch from pip-compile to uv with PEP 735 dependency groups; commit uv.lock. - 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 python-semantic-release + release.yml, replacing the old token-based pypi-publish.yml with OIDC trusted publishing. - src/ layout not touched -- this repo already used it, so no change was needed here. - Delete setup.py, setup.cfg, .coveragerc, requirements/ (all .in/.txt files, constraints.txt, private.readme), .github/workflows/pypi-publish.yml. Addresses salman2013's PR review feedback: - Keep the CI job name as tests, matching the pre-migration name (deferring the per-toxenv rename to avoid breaking required-status-check matching). - __version__ falls back to "unknown" on PackageNotFoundError instead of leaving it unset, with the except branch marked pragma: no cover since the package is always installed in CI. - Remove the legacy, unused .readthedocs.yml (superseded by .readthedocs.yaml). - Drop an unintended fetch-depth: 0 on the checkout step -- a leftover side effect of removing the separate setup-python step, not a deliberate choice. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0c6634e to
ec638c2
Compare
|
Conflicts need to be resolved. |
…dropped during merge
…ernize-python-tooling # Conflicts: # requirements/base.txt # requirements/ci.txt # requirements/dev.txt # requirements/doc.txt # requirements/quality.txt # requirements/test.txt
…mad/modernize-python-tooling # Conflicts: # requirements/base.txt # requirements/ci.txt # requirements/dev.txt # requirements/doc.txt # requirements/pip-tools.txt # requirements/quality.txt # requirements/test.txt # src/openedx_core/__init__.py
…e job Matches openedx/sample-plugin's current release.yml; the custom OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN secret isn't needed.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
| dependencies = [ | ||
| "attrs", | ||
| "celery", | ||
| "Django>=5.2,<6.0", |
There was a problem hiding this comment.
1.4.0 published Django, edx-drf-extensions and edx-organizations with no bounds, because setup.py read requirements/base.in and dropped the -c constraints.txt line. This branch publishes Django<6.0,>=5.2, edx-drf-extensions>=10.7.0 and edx-organizations>=9.0.0, and those are the only three Requires-Dist changes in the wheel.
<6.0 is the one that matters. It was a constraint on this repo's own installs; in released metadata it blocks openedx-platform from resolving Django 6 until openedx-core cuts a release. I also can't find where 10.7.0 comes from, base.txt pinned edx-drf-extensions==10.9.0.
Restore the unbounded specifiers, or say what each bound is for.
There was a problem hiding this comment.
Restored unbounded Django/edx-drf-extensions/edx-organizations in published deps. The 10.7.0 floor didn't match any real release or historical pin — traced it to a stale snapshot from when the migration commit was authored. Django<6.0 stays in constraint-dependencies only.
|
|
||
| coverage: clean ## generate and view HTML coverage report | ||
| pytest --cov-report html | ||
| uv run pytest --cov-report html |
There was a problem hiding this comment.
We're dropping the uv run prefixes from Makefiles, so this goes back to pytest --cov-report html. The Makefile should assume the environment is already set up: activate the venv locally, put uv run in the workflow step in CI. openedx/public-engineering#506 (comment)
Same for the other uv run lines in this file, apart from the --with edx-lint one that upgrade needs.
There was a problem hiding this comment.
Dropped uv run — bare pytest --cov-report html now.
| pycodestyle src tests test_utils manage.py test_settings.py mysql_test_settings.py | ||
| pydocstyle src # don't need to lint docs for tests & utils | ||
| isort --check-only --diff src tests test_utils setup.py manage.py test_settings.py mysql_test_settings.py | ||
| isort --check-only --diff src tests test_utils manage.py test_settings.py mysql_test_settings.py |
There was a problem hiding this comment.
Makefile:59 dropped lint-imports, so make quality doesn't run it locally any more. CI still covers it through the lint-imports.yml workflow, same as before.
Add it to [testenv:quality] rather than back to the Makefile. import-linter is already in the quality group through test-base, so it resolves there, and the CI matrix already runs tox -e quality. That makes lint-imports.yml redundant, so we can just drop that workflow in this PR.
| isort --check-only --diff src tests test_utils manage.py test_settings.py mysql_test_settings.py | |
| isort --check-only --diff src tests test_utils manage.py test_settings.py mysql_test_settings.py | |
| lint-imports |
There was a problem hiding this comment.
Added lint-imports to [testenv:quality]'s commands, right after isort — import-linter was already resolving via test-base.
| @@ -1,5 +1,6 @@ | |||
| [tox] | |||
| envlist = py312-django{52}, quality, docs, pii_check, lint-imports | |||
There was a problem hiding this comment.
This lint-imports entry in the envlist can be deleted. There's no [testenv:lint-imports] section, so it falls back to [testenv] and runs pytest again rather than the linter. We're gonna ad the import-linter to the quality check so we're still getting that coverage.
There was a problem hiding this comment.
Removed the bogus lint-imports envlist entry.
Makefile now assumes an already-synced/activated local env; uv run stays in CI workflow steps only. See openedx/ccx-keys#190 (review comment r4097501942). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ernize-python-tooling # Conflicts: # requirements/base.txt # requirements/ci.txt # requirements/dev.txt # requirements/doc.txt # requirements/quality.txt # requirements/test.txt
feanil
left a comment
There was a problem hiding this comment.
62b51bc takes care of the uv run prefixes. The other three comments from last round are still open: the dependency bounds in pyproject.toml, moving lint-imports into [testenv:quality] and dropping lint-imports.yml, and the lint-imports entry in the tox envlist.
I rebuilt the wheel off 38916465 with SETUPTOOLS_SCM_PRETEND_VERSION=1.4.0 and re-diffed it against openedx_core-1.4.0 from PyPI. Still nothing dropped, still the same 11 README and ARCHITECTURE additions, and Requires-Dist still differs on exactly Django, edx-drf-extensions and edx-organizations. uv lock --check is clean and all 8 checks are green.
I tried the [testenv:quality] change locally to make sure it resolves: import-linter comes from the quality group through test-base, and tox -e quality finishes in 28s with Contracts: 2 kept, 0 broken. Worth doing now that main has added openedx_catalog as a fourth root package in .importlinter.
One new comment below, on branch protection.
| @@ -12,18 +12,19 @@ jobs: | |||
| lint-imports: | |||
| name: Lint Python Imports | |||
There was a problem hiding this comment.
Lint Python Imports is a required status check on main, so deleting this workflow means the check never reports on the head and this PR blocks on itself.
Before this merges and once lint-imports is in [testenv:quality] I can remove the requirements on the Python Lint Imports job. tests (ubuntu-latest, 3.12, quality, 8) is already required and covers it.
There was a problem hiding this comment.
Left lint-imports.yml in place for now so the required check keeps reporting — lint-imports is wired into quality as of this commit, so this should be ready for you to lift the branch-protection requirement whenever you get a chance. Will remove the workflow file in a follow-up once that's done.
… published deps The last real release (1.4.0) published Django, edx-drf-extensions, and edx-organizations with no version bounds at all, since pre-migration setup.py read requirements/base.in (unpinned) rather than base.txt or constraints.txt. The pyproject.toml dependencies list introduced by the uv migration added bounds that never existed in published metadata -- most importantly Django<6.0, which would block openedx-platform (or any other consumer) from resolving Django 6 until openedx-core cuts a new release. The edx-drf-extensions>=10.7.0 lower bound also didn't match history: it came from a stale requirements/base.txt snapshot on this branch at the time pyproject.toml was authored. The actual last-released pin (v1.4.0 tag) was 10.8.0, and the latest pre-migration pin on main (before requirements/base.txt was deleted by the migration) was 10.9.0. Neither matches 10.7.0, and none of these pins were ever part of published Requires-Dist in the first place. Restore all three to unbounded, matching PyPI's published metadata for 1.4.0. Django<6.0 is still enforced for this repo's own lockfile/test resolution via [tool.uv].constraint-dependencies, which only affects this repo and does not propagate to consumers. uv.lock regenerated; resolved package set is unchanged (specifiers only). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
tox.ini's envlist listed a lint-imports entry with no matching [testenv:lint-imports] section, so it silently fell back to the generic [testenv] and just re-ran pytest instead of linting imports. This also meant Makefile's `make quality` (which delegates to `tox -e quality`) never actually ran import-linter locally. Delete the bogus envlist entry and instead run `lint-imports` as a step in [testenv:quality], right after isort. import-linter is already pulled in via the quality dependency-group (through test -> test-base), so no new dependency is needed. .github/workflows/lint-imports.yml is intentionally left in place: it is currently a required branch-protection status check on main. Removing it now would leave that required check permanently stuck at "Expected -- Waiting for status" on this PR's head commit, deadlocking the PR. Per feanil, that workflow should only be removed once quality's lint-imports step is confirmed working and he lifts the branch-protection requirement on "Lint Python Imports" (since tox -e quality is already a required check and will cover the same ground). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
| - name: Install Dependencies | ||
| run: pip install -r requirements/ci.txt | ||
| - name: Install CI dependencies | ||
| run: uv sync --group ci |
There was a problem hiding this comment.
Add --locked here and on the uv run tox step below, so CI fails when uv.lock doesn't
match pyproject.toml instead of relocking it in the runner. Both pass on this branch as-is.
There was a problem hiding this comment.
Added --locked to both steps, verified uv sync --locked --group ci passes cleanly.
| # applying any version constraints. Bounding these here would restrict | ||
| # what versions consumers (e.g. openedx-platform) can resolve. Any bound | ||
| # this repo itself needs for local testing/resolution belongs in | ||
| # [tool.uv].constraint-dependencies instead (see Django<6.0 below). |
There was a problem hiding this comment.
nit: point this at [tool.edx_lint].uv_constraints. constraint-dependencies is written by
edx_lint write_uv_constraints on every make upgrade, so a bound hand-edited into it gets
overwritten.
There was a problem hiding this comment.
Fixed -- pointed the comment at [tool.edx_lint].uv_constraints instead (the actual safe-to-edit spot), and confirmed directly that Django<6.0 is already covered globally via edx-lint's common_constraints.txt, so it was never at risk of being lost.
- ci.yml: added --locked to uv sync/uv run tox steps. Verified uv sync --locked --group ci passes cleanly. - pyproject.toml: the comment next to the unbounded Django/etc. dependencies pointed at [tool.uv].constraint-dependencies as the place to add a repo-specific bound -- that block is tool-generated output (edx_lint write_uv_constraints), not an editing target. Corrected to point at [tool.edx_lint].uv_constraints instead, and noted Django<6.0 is already covered globally via edx-lint's common_constraints.txt (confirmed directly), not something this repo added itself. Per feanil's review on openedx#704: discussion_r4147327735, r4147327755. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@irfanuddinahmad now that this has landed, I've dropped the requirement on the LintImports check and it should be safe to remove in a follow up PR. Feel free to tag me on it. |
Summary
Modernize
openedx-coreto uv + pyproject.toml (PEP 621/735) + python-semantic-release.Part of openedx/public-engineering#506 (tracked in openedx/public-engineering#516).
setup.py/setup.cfgwithpyproject.toml(PEP 621 static metadata), version derived from git tags viasetuptools-scmuvwith PEP 735 dependency groups; commituv.locktox.inito usetox-uvwithuv-venv-lock-runnerastral-sh/setup-uv; SHA-pin all actionspython-semantic-release+release.yml, replacing the old token-basedpypi-publish.ymlwith OIDC trusted publishingNot included:
src/layout. This repo already usessrc/openedx_{core,content,tagging,catalog}andsrc/openedx_django_lib, so Phase 0 of the org-wide migration (openedx/public-engineering#506's 2026-07-15 decision) required no changes here — MANIFEST.in,.coveragerc's (now[tool.coverage.run])source,docs/conf.py'ssys.pathentries, andtox.inialready pointed atsrc/.Removed
Deleted files:
setup.py,setup.cfg,.coveragerc,.readthedocs.yml(legacy duplicate of.readthedocs.yaml),requirements/(all.in/.txtfiles,constraints.txt,private.readme),.github/workflows/pypi-publish.yml(replaced byrelease.yml, OIDC instead of thePYPI_UPLOAD_TOKENsecret).Removed Makefile targets:
compile-requirementsuv lockupgradeandrequirementstargets were kept but rewritten to useuv(edx_lint write_uv_constraints+uv lock --upgrade, anduv sync --group dev, respectively) instead ofpip-compile/pip-sync.Versioning
Dynamic —
setuptools-scmderives the build version from the latest git tag. Pre-flight check passed: latest git tagv1.1.0matches the version currently live on PyPI (1.1.0), so the first automated release should compute the correct next version from conventional-commit history.Testing Notes
Verified locally:
uv lockresolves cleanly (156 packages)uv sync(base project, no groups) succeeds; editable install makes all five packages (openedx_core,openedx_content,openedx_tagging,openedx_django_lib,openedx_catalog) importable, withopenedx_core.__version__correctly resolving to1.1.0viaimportlib.metadatapython -m build+twine check dist/*both pass; inspected the built wheel and confirmed all five packages (withpy.typedmarkers) are bundled correctlymypyresolves the editable install correctly under this repo's existingsrc/layout (ran ad hoc with a partial dependency set due to a local sandbox limitation below; it got past all import/plugin resolution and only flagged missingpytest/freezegunstubs from the deliberately-partial ad hoc install, not a resolution problem)tox -llists all envs correctly (py312-django52,quality,docs,pii_check,lint-imports) —tox.iniparses cleanly against the new[dependency-groups]namesCould not verify locally:
uv sync --group dev(andtest/quality/doc) fails to build in this sandbox becausemysqlclienthas no macOS wheel and needs local MySQL client headers unavailable here. This predates the migration (same coupling existed via the oldrequirements/test.in) and is expected to build fine on GitHub Actions'ubuntu-latestrunners, which ship with MySQL client libraries preinstalled. Full test-suite / quality-check execution therefore relies on this PR's own CI run.Code reviewer notes
openedx-core(tracked in the consolidated comment on Tbain/253 add tags count #506) before the first automated release can publish.OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKENis already a standard org-level secret used by many other repos, so no action needed there..github/workflows/upgrade-python-requirements.ymlcallsopenedx/.github's shared reusable workflow, which hardcodesadd-paths: requirements. Now thatrequirements/is deleted, that scheduled job will silently stop producing real dependency-upgrade PRs — same gap across every repo in this migration batch; needs a fix inopenedx/.githubitself, not here.mysqlclientis bundled into thetest-basedependency group (and thereforetest/quality/doc/ci/devtransitively), matching the pre-migration coupling inrequirements/test.in→quality.in/doc.in/dev.in. This is why the "Not included"/"Testing Notes" sections above call out the local verification gap.[dependency-groups].ciis intentionally minimal (tox,tox-uvonly, noinclude-group) — CI's ownuv sync --group cistep only needstoxonPATH;toxinstalls each env's actual dependency group itself viauv-venv-lock-runner.This PR was created with Claude Code.