Repository navigation
Conversation
Move the calc and symmath packages into src/calc and src/symmath, per the src/ layout decision on openedx/public-engineering#506 (2026-07-15): flat-layout editable installs aren't resolvable by tools like mypy, while src/-layout repos work fine. tests/ stays at the repo root (it was never nested inside calc/ or symmath/ to begin with, and isn't shipped in the distribution). Update .coveragerc's source path accordingly; the remaining path references (tox.ini, setup.py) are updated in the following commits that replace those files entirely.
Replace setup.py/setup.cfg with PEP 621 static metadata in pyproject.toml: name, description, SPDX license expression, authors, classifiers, static dependencies, setuptools-scm dynamic versioning, dependency-groups (PEP 735), and semantic-release configuration. Move [pycodestyle] from setup.cfg into a standalone .pep8 file (no other tool configuration existed in setup.cfg to port). Move coverage config from .coveragerc into [tool.coverage.*], with source paths updated for the new src/ layout, and add omit/exclude patterns. Remove the hardcoded __version__ from calc/__init__.py (permanently stale once setuptools-scm derives it from git tags) in favor of reading it from installed package metadata via importlib.metadata. Part of openedx/public-engineering#506.
Replace requirements/*.in + pip-compile with PEP 735 dependency groups in pyproject.toml (test, quality, ci, dev), managed and locked via uv: - Add [tool.uv].constraint-dependencies, machine-managed by `edx_lint write_uv_constraints` (see [tool.edx_lint].uv_constraints for repo-specific overrides). - Commit uv.lock. - Delete the requirements/ directory; drop the now-stale `include requirements/*` lines from MANIFEST.in. - Update tox.ini to use tox-uv's uv-venv-lock-runner with dependency_groups instead of deps/-r requirements files, with paths updated for the src/ layout. - Update the Makefile's requirements/test/upgrade targets to use `uv sync`, `uv run tox`, and `uv lock --upgrade`. - Update the CI workflow to install uv (pinned to a commit SHA) and run `uv sync --group ci` + `uv run tox -e <toxenv>`, with per-matrix-job names, read-only permissions, and fetch-depth: 0 so setuptools-scm can see tags. - Add "six" as an explicit runtime dependency: symmath/formula.py imports it directly, but it was never listed in requirements/base.in -- it only worked before because some other pinned dependency happened to pull it in transitively. uv's fresh resolution doesn't reproduce that, and tests failed with ModuleNotFoundError until this was added. Part of openedx/public-engineering#506.
Add release.yml: on push to master, runs the CI workflow, then python-semantic-release (OIDC-free step, github_token from OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKEN), then publishes to PyPI via OIDC trusted publishing (id-token: write, no stored credentials) if a release was cut. [tool.semantic_release] (build_command, major_on_zero, allow_zero_version) was already added to pyproject.toml in the metadata commit. Delete the old token-based pypi-publish.yml (triggered on `push: tags`, used PYPI_UPLOAD_TOKEN) -- release.yml's publish_to_pypi job replaces it with OIDC, per the decision on openedx/public-engineering#506. Update ci.yml to add a workflow_call trigger (so release.yml can reuse it) and drop its own push-to-master trigger, since release.yml now owns that path -- avoids running the test suite twice on every push to master. commitlint.yml already called the org's shared reusable workflow; no change needed there. Pre-flight check: latest git tag (v5.0.0, via `git tag --sort=-v:refname`) matches openedx-calc's actual latest version on PyPI (5.0.0), so semantic-release's next computed version will not collide with or undercut what's already published. Part of openedx/public-engineering#506.
|
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. |
Verified every uses:@sha in release.yml against the GitHub API (repos/<owner>/<repo>/commits/<sha>). While these SHAs happened to be valid commits (unlike the same pins in sibling PRs opaque-keys/ openedx-core, where they were swapped/fabricated), pinning these isn't required by the migration ticket and isn't done by openedx/XBlock's actual, already-releasing release.yml. Reverted python-semantic-release, upload-artifact, and download-artifact to plain version tags matching XBlock exactly. pypa/gh-action-pypi-publish was already correctly pinned to the real commit SHA -- left unchanged.
…ration
This repo never had a CHANGELOG.rst. Per the modernize-python-tooling
effort's decision to not disable changelog generation, add one from
scratch and wire python-semantic-release to keep it updated in place:
- Create CHANGELOG.rst containing only the insertion marker
- Remove changelog: "false" from release.yml's PSR step
- Configure [tool.semantic_release.changelog] to update CHANGELOG.rst
in RST format at the marker
- Set tag_format = "v{version}" explicitly to match this repo's actual
tag convention (verified via git tag --sort=-v:refname)
Verified locally: running `semantic-release changelog` against this
config produces a correctly formatted Unreleased section (grouped by
commit type, linked to commit SHAs/PRs) above the marker, and also
backfills the v5.0.0 section from the existing tag history.
…ernize-python-tooling # Conflicts: # .github/workflows/ci.yml # .github/workflows/pypi-publish.yml
Set changelog: "false" on the PSR release step and remove the [tool.semantic_release.changelog] config / insertion marker. Checked against openedx/XBlock's actual production release.yml (the one repo in this effort that has cut real automated releases) -- every run passes changelog: false and invokes `semantic-release -v version --no-changelog`, and the repo has zero github-actions[bot] commits ever. The auto-changelog config this migration previously added was only ever verified via a local dry-run prototype, never against a real release. feanil flagged the same issue on openedx/DoneXBlock#388: "I thought we were not going to add changelogs since they can't be updated by python-semantic-release the way we have it setup."
The old instructions had developers manually create+activate a venv before running make requirements -- uv sync (which make requirements now runs) creates and manages its own venv, making that step unnecessary and, since it never mentioned uv, misleading about how the tooling actually works now.
This repo has immutable releases enabled, which freezes a release's assets the moment it's published. Previously this workflow didn't even attempt to attach dist files to the GitHub release (relying only on the actions/upload-artifact -> download-artifact path for PyPI publish), so every release shipped with an empty GitHub Release page. Matches the fix already proven on openedx/sample-plugin#57 and validated end-to-end on openedx/event-tracking#434: build without publishing (vcs_release: false), then create the release with dist/* attached in one gh release create call. Not adding the separate gitpython/uv workaround from event-tracking#435/#436 here -- these PRs won't merge until upstream python-semantic-release fixes the GitPython 3.1.60 break (python-semantic-release/python-semantic-release#1476).
A prior commit (550a144) deliberately un-pinned python-semantic-release, actions/upload-artifact, and actions/download-artifact to plain version tags, reasoning that pinning wasn't required by the migration ticket and that openedx/XBlock's release.yml doesn't do it either. It also left the release job's checkout pinned to an actions/checkout SHA for v7.0.0, stale relative to ci.yml's own v7.0.1 pin. openedx/sample-plugin is this org's designated gold-standard reference for release.yml, and it pins all of these (each SHA independently re-verified against the action's own tag history via the GitHub API). Restored/corrected the pins to match, picking up version bumps along the way: actions/checkout v7.0.0 -> v7.0.1, python-semantic-release v10.6.1 -> v10.6.2, and pypa/gh-action-pypi-publish v1.14.1 -> v1.14.2. Also brought release.yml in line with sample-plugin in three more ways: - added `if-no-files-found: error` to the dist upload step, so a release that produced no artifacts fails loudly instead of silently. - added the `github.ref_name == 'master'` guard to publish_to_pypi's `if`, matching the release job's own guard, so the job can't fire on a non-default-branch workflow run. - dropped `fetch-depth: 0` from the release job's checkout; python-semantic-release auto-deepens a shallow clone itself before evaluating version history, so it's never needed there. Co-Authored-By: Claude Sonnet 5 <[email protected]>
src/calc/__init__.py sets __version__ from importlib.metadata; nothing else in the package reads or parses __version__, so a shallow clone is sufficient for CI. sample-plugin's own backend-ci.yml doesn't set fetch-depth: 0 either. Matches that reference. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
@irfanuddinahmad Could you check why the following checks aren't running?
|
Aligns with the org-standard pattern (sample-plugin, other migrated repos): a generic 'py' env instead of a version-pinned one, and a static job name so GitHub auto-generates matrix-suffixed check names (e.g. "tests (ubuntu-latest, 3.12, py)") instead of bare toxenv names. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
Fixed in b79ff2a — renamed |
Branch protection on master requires "Tests (ubuntu-latest, 3.12, py)" and "Tests (ubuntu-latest, 3.12, quality)" (capital T), carried over from this repo's pre-migration ci.yml. GitHub's required-status-check matching is case-sensitive, so the previous lowercase "tests" job name left those required checks permanently unsatisfied. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…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 <[email protected]>
| of the python versions specified for the repo (currently 3.11 and 3.12) -- | ||
| there's no need to create one yourself. | ||
|
|
||
| Then you can run the tests with just `tox`. |
There was a problem hiding this comment.
uv sync creates .venv but doesn't activate it, so there's no tox on PATH after make requirements:
$ make requirements
$ tox -l
bash: line 1: tox: command not found
The activation step this PR removes just above is the one the Makefile now assumes, so keep it, as source .venv/bin/activate. tox -r under "When Upgrading Requirements" needs the same, and the paragraph you added says 3.11 and 3.12 while requires-python is >=3.12.
There was a problem hiding this comment.
Restored source .venv/bin/activate after both make requirements and make upgrade/before tox -r; fixed the stray "3.11 and 3.12" mention to just 3.12. Verified by following the README literally on a fresh clone.
|
|
||
| test: ## Run the library test suite | ||
| tox | ||
| uv run tox |
There was a problem hiding this comment.
We're dropping the uv run prefixes from Makefiles, so this goes back to tox. 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 tox now.
Makefile now assumes an already-synced/activated local env; uv run stays in CI workflow steps only. See openedx-unsupported/ccx-keys#190 (review comment r4097501942). Co-Authored-By: Claude Sonnet 5 <[email protected]>
feanil
left a comment
There was a problem hiding this comment.
Just a little docs cleanup and then I think this is good to go.
| of the python versions specified for the repo (currently 3.11 and 3.12) -- | ||
| there's no need to create one yourself. | ||
|
|
||
| Then you can run the tests with just `tox`. |
There was a problem hiding this comment.
You still need to activate the venv before you can call tox or you can call uv run tox.
There was a problem hiding this comment.
Restored source .venv/bin/activate after both make requirements and make upgrade/before tox -r; fixed the stray "3.11 and 3.12" mention to just 3.12. Verified by following the README literally on a fresh clone.
Add `source .venv/bin/activate` right after `make requirements` (and again after `make upgrade`, before `tox -r`) so tox/pytest actually resolve from the venv uv created, per feanil's repeated review feedback on openedx#217. Also fix the "3.11 and 3.12" mention to just "3.12", matching requires-python in pyproject.toml. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary
Modernize
openedx-calcto uv + pyproject.toml (PEP 621/735) + python-semantic-release.Part of openedx/public-engineering#506 (tracked in
openedx/public-engineering#516).
calc/andsymmath/intosrc/calc/andsrc/symmath/(src/ layout, perthe 2026-07-15 decision on #506) —
tests/stays at the repo root since it wasnever nested inside either package and isn't shipped in the distribution.
setup.py/setup.cfgwithpyproject.toml(PEP 621 static metadata)uvwith PEP 735 dependency groups (test,quality,ci,dev); commituv.locktox.inito usetox-uvwithuv-venv-lock-runnerastral-sh/setup-uv; SHA-pin all actionspython-semantic-release+release.yml, publishing to PyPI via OIDCRemoved
Deleted files:
setup.py,setup.cfg(superseded bypyproject.toml;[pycodestyle]moved toa standalone
.pep8file, the only sectionsetup.cfghad).coveragerc(moved to[tool.coverage.*]inpyproject.toml)requirements/(superseded byuv.lock+[dependency-groups]).github/workflows/pypi-publish.yml(token-based publish-on-tag workflow;replaced by
release.yml's OIDCpublish_to_pypijob)Removed Makefile targets: none removed —
clean/test/requirements/upgradeall kept, just repointed at
uv/tox-uvinstead ofpip/pip-compile.Not included
pycodestyle left exactly as they were).
django42) — this package has noframework dependency at all (
lxml,markupsafe,numpy,pyparsing,six,sympy), so there's nothing to matrix against.Versioning
Dynamic, via
setuptools-scmreading the latest git tag (fallback_version = "0.0.0"). Pre-flight check passed: latest tagv5.0.0(viagit tag --sort=-v:refname) matches the version currently live on PyPI (5.0.0), sosemantic-release's first automated release won't compute a version lower than what's
already published.
Known gaps / needs maintainer action (not code issues)
openedx-calcbefore thefirst automated release can publish (tracked in the consolidated comment on
#506).
OPENEDX_SEMANTIC_RELEASE_GITHUB_TOKENis already a standard org-level secretused by many other repos, so no action needed there.
.github/workflows/upgrade-python-requirements.ymlcalls the org's sharedreusable workflow, which hardcodes
add-paths: requirements. Now thatrequirements/is deleted, that scheduled job will silently stop producing realdependency-upgrade PRs — same gap across every repo in this migration batch;
needs a fix in
openedx/.githubitself, not here.Testing Notes
Verified locally (not just hoped CI would catch it):
uv lock/uv lock --checkresolve cleanly, no driftuv sync --group devanduv sync --group cisucceeduv run tox— bothpyandqualityenvironments pass: 64 tests pass,pycodestyle --config=.pep8andpylint --rcfile=pylintrcboth clean (py312wasrenamed to the generic
pyintox.ini/ci.yml, andci.yml's job uses a staticname: Tests— matching pre-migrationmain's exact naming/casing so the checksGitHub reports don't change)
uv run --with build python -m buildsucceeds, producing a correctly versioned(
5.0.0, matching the git tag) sdist + wheel, withsymmath/README.mdcorrectlybundled and
tests/correctly excludedsymmath/formula.pydoesimport sixdirectly, butsixwas never listed inrequirements/base.in— itonly worked before because some other pinned dependency happened to pull it in
transitively.
uv's fresh resolution doesn't reproduce that transitive path, sotests failed with
ModuleNotFoundError: No module named 'six'untilsixwasadded as an explicit dependency.
release.ymlagainst the actualGitHub tag→commit mapping (
gh api repos/<owner>/<repo>/tags) rather than trustingthe sibling-repo reference implementation's pins as-is: the
python-semantic-release,actions/upload-artifact, andactions/download-artifactpins copied from thatreference were wrong (
upload/downloadwere swapped, and the semantic-releaseSHA didn't correspond to any commit in that repo at all) and have been corrected
here.
Code reviewer notes
src/layout move (calc/→src/calc/,symmath/→src/symmath/) is aseparate first commit, isolated from the metadata/uv/release commits, for easier
review.
sixwas added to[project].dependencies— see Testing Notes above for why.This PR was created with Claude Code.