Repository navigation
Allow setuptools-scm 10 as a build requirement again - #3022
Conversation
291498b ("Pin setuptools-scm<10.0 to fix CICD") capped setuptools-scm below 10 on the day 10.0.2, the first 10.x release on PyPI that isn't yanked, came out. Every 10.0.x release aborts the build of a checkout that git reports as having dubious ownership, as in a container whose user doesn't own the checkout: git introspection failed: fatal: detected dubious ownership in repository at '...' 10.1 and later, on PyPI since June, build there, with the same files as in a normally owned checkout: they take the file list from the work tree found for the version, through `git --git-dir=... ls-files`, which git doesn't subject to its ownership check (pypa/setuptools-scm#1378 and pypa/setuptools-scm#1405). pip installs the newest release that satisfies the requirement, so it no longer picks 10.0.x. The cap, meanwhile, keeps out every 10.x release, the fixed ones included. A build without isolation that checks the build requirements, such as `python -m build --no-isolation` in Nixpkgs (which has 10.2.1), refuses an installed setuptools-scm 10.1 or later. With isolation, pip picks 9.2.2 instead, which builds a checkout with dubious ownership but leaves out every file that only git lists, logging only "listing git files failed - pretending there aren't any": 19 documentation files from the wheel, and 1525 of the 2443 files of the sdist. Go back to the requirement from before the cap. `>=8,!=10.0.*` resolves to the same release on PyPI, but it would still make such builds refuse a 10.0.x, which builds a normally owned checkout fine. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Connor Baker <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Update setuptools-scm version range pyproject.toml |
The build requirement removes the upper version bound. It still requires version 8 or later. |
Priority:
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Suggested labels: cherry-pick-0.48.0
Merge Risk: 
Minimal · up to 2e0f4
-
The build requirement change is mergeable.
Pre-merge checks: 
6
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
Full details: Security Anti-Patterns
-
Explanation
PASS. The pull request changes only
pyproject.toml. It relaxes the existingsetuptools-scmbuild requirement from>=8,<10to>=8; it does not add a new dependency. No modelopt or examples Python files changed, and no listed security anti-pattern is introduced.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3022 +/- ##
==========================================
+ Coverage 77.49% 79.15% +1.65%
==========================================
Files 661 661
Lines 74949 74949
==========================================
+ Hits 58085 59325 +1240
+ Misses 16864 15624 -1240
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/ok to test 2e0f466 |
What does this PR do?
Type of change: Bug fix
Goes back to
setuptools-scm>=8, the build requirement from before 291498b ("Pin setuptools-scm<10.0 to fix CICD").That cap went in about two hours after setuptools-scm 10.0.2, the first 10.x release on PyPI that isn't yanked, came out (16:30 UTC on 2026-03-25). Every 10.0.x release aborts the build of a checkout that git reports as having dubious ownership, as in a container whose user doesn't own the checkout:
The logs of the March runs have expired, so I can't confirm that this was the CI failure.
That failure is specific to 10.0.x. Every release from 10.1.1 (on PyPI since 2026-06-22) builds such a checkout, with the same files as a normally owned one. 10.1 takes the file list from the work tree it found for the version, through
git --git-dir=... ls-files, and git doesn't check ownership for an explicit--git-dir(pypa/setuptools-scm#1378 and pypa/setuptools-scm#1405, see Testing). pip installs the newest matching release (and so does uv, by default), so it no longer picks 10.0.x.But the cap keeps out every 10.x release, the fixed ones included:
python -m build --no-isolation(which Nixpkgs uses, for example) checks the build requirements against it. It refuses setuptools-scm 10.1 or later:ERROR Unmet dependencies ... setuptools-scm<10,>=8. Nixpkgs, which has 10.2.1, has to patch the bound out.listing git files failed - pretending there aren't any:tests/(578),examples/(496),tools/(159),plugins/(111),docs/(64),.github/and others. PyPI has no ModelOpt source sdist (0.46.0rc0 and 0.46.0rc1 have onlywheel-stubredirects), butpython -m buildmakes one by default, and builds the wheel from it.README.md, 2READMEandmodelopt_recipes/ptq.md). The package data thatpyproject.tomlasks for (*.cpp,*.cu,*.cuh,*.h,*.yml,*.yaml) is all there, and no code reads those files, so the wheel works.>=8or>=8,!=10.0.*? Either is fine; this PR uses>=8, and I'm happy to switch if you prefer the exclusion. With PyPI as it is, both resolve to 10.3.4. They differ in two places:python -m build --no-isolation),!=10.0.*keeps refusing a 10.0.x that builds a normally owned checkout fine, as the cap does now for everything from 10.0.>=8accepts it. Distributions do ship 10.0.x: Repology lists 10.0.5 as the current version in, for example, Chimera, openSUSE Tumbleweed, OpenMandriva Rolling and SageMath. I haven't checked which of them run such a check.>=8picks 10.0.x, which aborts under dubious ownership, while!=10.0.*picks 9.2.2 (or fails to resolve). For installs like CI's (pip install -e, with isolation), the exclusion is the more conservative choice: it can never pick a release known to abort there.No upper bound either way: there is no setuptools-scm 11, and an upper bound is what keeps 10.1 and later out now.
Usage
N/A
Testing
These ran on main at 3788881, before the rebase onto efda42c (which doesn't touch
pyproject.toml); the table's wheel builds and the Nixpkgs check were rerun on the rebased commit. Offline, with Python 3.14.8 and setuptools 83.0.0. Dubious ownership is simulated with agitwrapper that setsGIT_TEST_ASSUME_DIFFERENT_OWNER=1, git's test hook for its ownership check (exporting the variable directly wouldn't work, because setuptools-scm removesGIT_*from git's environment). I checked the simulation against a real owner mismatch (a repository owned by another user): git, setuptools-scm's API and the pip builds below behave the same.Every setuptools-scm 10.x on PyPI (10.0.1 to 10.3.4, yanked releases included), pinned exactly,
pip wheel --no-deps .with build isolation: 10.0.1 to 10.0.5 abort as above; 10.1.1 to 10.3.4 build, and their wheels have the same files as in a normally owned checkout.This PR vs. main,
pip wheel --no-deps .with build isolation from a local wheelhouse, in a checkout with dubious ownership:>=8,<10)>=8)>=8,!=10.0.*In a normally owned checkout, every build that runs produces 931 files. Rerun on the rebased commit (and main at efda42c): the same results and file counts.
sdist, with a real owner mismatch: 9.2.2 writes 918 files, against 2443 with the checkout marked safe; 10.3.4 writes 2445 (the same 2443 plus
scm_file_list.jsonandscm_version.json).CI's command forms: a depth-1 clone without tags (as
actions/checkoutmakes) shows the same pattern (10.3.4: 931 files, 10.0.5 aborts, 9.2.2: 912). Withpip install -e .under dubious ownership, 10.0.5 fails withgit introspection failed; 10.3.4 and 9.2.2 install.Which change in 10.1: I built setuptools-scm and vcs-versioning from pypa/setuptools-scm at commits between 10.0.5 and 10.1.0, then built ModelOpt with them. Every commit builds a normally owned checkout. Under dubious ownership, the first one that builds is pypa/setuptools-scm@324b21d ("use run_git (--git-dir) in file finder", fix: replace git archive with git ls-files for file discovery (#662) pypa/setuptools-scm#1405). It needs pypa/setuptools-scm@dc2a075 (refactor: workdir-centric chain API (env → config → workdir → version) pypa/setuptools-scm#1378), whose
egg_info.find_sources()takes the file list from that work tree instead of going throughwalk_revctrl()→git_find_files(), which still aborts. With that override disabled, 324b21d and 10.1.0 abort again.Nixpkgs (
python -m build --no-isolationwith setuptools-scm 10.2.1), rerun on the rebased commit: main fails withUnmet dependencies; this PR builds.pre-commit runwith this repository's configuration passes on the changed file.Not tested: the CI workflows or their containers.
Before your PR is "Ready for review"
CONTRIBUTING.md: N/AAdditional Information
Found while packaging ModelOpt 0.47.0 for Nixpkgs (NixOS/nixpkgs#577198), which relaxes the bound in the meantime. 0.47.0 and
release/0.48.0have the same cap. The open #2167 adds"setuptools-scm>=8,<10"toexamples/puzzletron/ci/setup_env.sh; that still satisfies>=8, so the two don't conflict.AI disclosure: this change, the testing described above and this description were produced with Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code
Summary by CodeRabbit