Skip to content

Allow setuptools-scm 10 as a build requirement again - #3022

Merged
kevalmorabia97 merged 1 commit into
NVIDIA:mainfrom
ConnorBaker:setuptools-scm-uncap
Oct 26, 2026
Merged

kevalmorabia97 merged 1 commit into
NVIDIA:mainfrom
ConnorBaker:setuptools-scm-uncap

Conversation

@ConnorBaker

@ConnorBaker ConnorBaker commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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:

git introspection failed: fatal: detected dubious ownership in repository at '...'

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:

  • Builds without isolation that check the build requirements fail. Distributions build against the setuptools-scm they ship, and 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.
  • With build isolation, pip picks 9.2.2 instead, on any index that has it. In a checkout with dubious ownership, 9.2.2 builds, but leaves out every file that only git lists, and only logs listing git files failed - pretending there aren't any:
    • The sdist has 918 of its 2443 files. The 1525 missing are 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 only wheel-stub redirects), but python -m build makes one by default, and builds the wheel from it.
    • The wheel misses 19 documentation files (16 README.md, 2 README and modelopt_recipes/ptq.md). The package data that pyproject.toml asks for (*.cpp, *.cu, *.cuh, *.h, *.yml, *.yaml) is all there, and no code reads those files, so the wheel works.

>=8 or >=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:

  • In builds that check the build requirements (such as 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. >=8 accepts 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.
  • Where an index or a constraint offers nothing newer than 10.0.x, >=8 picks 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 a git wrapper that sets GIT_TEST_ASSUME_DIFFERENT_OWNER=1, git's test hook for its ownership check (exporting the variable directly wouldn't work, because setuptools-scm removes GIT_* 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:

    Wheelhouse main (>=8,<10) this PR (>=8) >=8,!=10.0.*
    setuptools-scm 10.3.4 no matching distribution 10.3.4, 931 files 10.3.4, 931 files
    10.0.2 to 10.0.5 no matching distribution 10.0.5, aborts no matching distribution
    9.2.2 and 10.0.2 to 10.0.5 (PyPI between March and June) 9.2.2, 912 files 10.0.5, aborts 9.2.2, 912 files
    all of the above and 10.1.1 to 10.3.4 9.2.2, 912 files 10.3.4, 931 files 10.3.4, 931 files

    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.json and scm_version.json).

  • CI's command forms: a depth-1 clone without tags (as actions/checkout makes) shows the same pattern (10.3.4: 931 files, 10.0.5 aborts, 9.2.2: 912). With pip install -e . under dubious ownership, 10.0.5 fails with git 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 through walk_revctrl() → git_find_files(), which still aborts. With that override disabled, 324b21d and 10.1.0 abort again.

  • Nixpkgs (python -m build --no-isolation with setuptools-scm 10.2.1), rerun on the rebased commit: main fails with Unmet dependencies; this PR builds.

  • pre-commit run with this repository's configuration passes on the changed file.

Not tested: the CI workflows or their containers.

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: N/A
  • Did you update Changelog?: N/A
  • Did you get Claude approval on this PR?: N/A

Additional 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.0 have the same cap. The open #2167 adds "setuptools-scm>=8,<10" to examples/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

  • Chores
    • Updated the build configuration to support a broader range of compatible build environments. This change affects how the project is prepared for building and does not alter application features or behavior. No user-facing functionality has changed.

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]>
@ConnorBaker
ConnorBaker requested a review from a team as a code owner October 26, 2026 17:08
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between efda42c and 2e0f466.

Files selected for processing: 1
  • pyproject.toml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

The build-system requirement for setuptools-scm changes from >=8,<10 to >=8. The minimum version remains unchanged.

Changes: Build requirement

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

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: Passed 6
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: removing the setuptools-scm upper bound so version 10 can be used as a build requirement.
Docstring Coverage Passed 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…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed PASS. The pull request changes only pyproject.toml. It relaxes the existing setuptools-scm build requirement from >=8,<10 to >=8; it does not add a new dependency. No modelopt or examples Pyth…
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 existing setuptools-scm build requirement from &gt;=8,&lt;10 to &gt;=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

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.15%. Comparing base (a382b8e) to head (2e0f466).
⚠️ Report is 4 commits behind head on main.

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     
Flag Coverage Δ
examples-diffusers 19.90% <ø> (-0.01%) ⬇️
examples-gpt-oss 13.44% <ø> (+<0.01%) ⬆️
examples-hf_ptq 23.34% <ø> (-0.04%) ⬇️
examples-llm_distill 13.52% <ø> (-0.01%) ⬇️
examples-llm_eval 17.17% <ø> (-0.01%) ⬇️
examples-llm_qat 17.34% <ø> (-0.04%) ⬇️
examples-llm_sparsity 16.76% <ø> (-0.01%) ⬇️
examples-megatron_bridge 26.48% <ø> (-0.22%) ⬇️
examples-specdec_bench 13.23% <ø> (-0.01%) ⬇️
examples-speculative_decoding 17.42% <ø> (-0.07%) ⬇️
examples-torch_onnx 21.21% <ø> (-0.03%) ⬇️
examples-torch_trt 15.15% <ø> (-0.01%) ⬇️
examples-vllm_serve 17.38% <ø> (-0.01%) ⬇️
gpu 59.00% <ø> (+7.96%) ⬆️
regression 15.04% <ø> (-0.01%) ⬇️
unit 61.15% <ø> (ø)

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.

@kevalmorabia97
kevalmorabia97 enabled auto-merge (squash) October 26, 2026 17:20
@kevalmorabia97

Copy link
Copy Markdown
Collaborator

/ok to test 2e0f466

@kevalmorabia97
kevalmorabia97 merged commit 607263d into NVIDIA:main Oct 26, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants