Skip to content

Automate Puzzletron GPU lifecycle tests - #2167

Open
j-rausch wants to merge 4 commits into
jrausch/puzzletron-gpu-quality-baseline-v4from
jrausch/puzzletron-gpu-ci-image-workflow
Open

j-rausch wants to merge 4 commits into
jrausch/puzzletron-gpu-quality-baseline-v4from
jrausch/puzzletron-gpu-ci-image-workflow

Conversation

@j-rausch

@j-rausch j-rausch commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: New tests.

The existing gpu_puzzletron session proves the current Puzzletron lifecycle but is only run manually. This change adds a digest-pinned repository-owned CUDA image recipe and a dedicated copied-PR, nightly, and manual workflow that runs that focused session against the reusable tiny-Qwen lifecycle test.

The workflow accepts only immutable nvcr.io image references, verifies the checked-out image contract before allocating a GPU, and installs the checked-out ModelOpt source without resolving dependencies at runtime. The image build preinstalls the declared ModelOpt runtime and test dependencies and verifies the pinned CUDA, Torch, Transformers, LMMS-Eval, AutoModel, AIPerf, and Nox environment.

Testing

Adds CPU contract coverage for the recorded base-image digest, image-reference validation, Docker setup contract, workflow permissions and routing, and dependency-isolated runtime installation. The dedicated GPU workflow runs the existing one-GPU Puzzletron lifecycle test through nox -s gpu_puzzletron.

Additional Information

This PR is stacked on #2166. The registry image must be built and published separately, then PUZZLETRON_GPU_CI_IMAGE must be configured with its immutable digest before the workflow can run.

Summary by CodeRabbit

  • New Features

    • Added automated Puzzletron GPU testing for pull requests, scheduled runs, and manual execution.
    • Added a pinned CUDA-based CI environment with automated setup and validation.
    • Added immutable container image resolution and verification for reliable GPU test execution.
  • Bug Fixes

    • Improved environment checks to validate configured dependency and CUDA versions dynamically.
  • Documentation

    • Added instructions for building, publishing, validating, and running the GPU CI image locally.
  • Tests

    • Added coverage for image immutability, workflow configuration, dependency isolation, and GPU environment validation.

@copy-pr-bot

copy-pr-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • release/.*
  • feature/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1b1021ce-d353-476d-b533-40574a89ba05

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d8f84405-3279-4d00-902c-087e1eaf55c3

📥 Commits

Reviewing files that changed from the base of the PR and between 79eb6cd2defbcf134628b2255379664708b61896 and 278e06017d1047812ff0b17da5503692a97012ba.

📒 Files selected for processing (9)
  • .github/workflows/puzzletron_gpu_tests.yml
  • .github/workflows/unit_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

📝 Walkthrough

Walkthrough

The PR adds a pinned CUDA-based Puzzletron CI image, validates its image and environment contracts, updates Nox GPU verification, and adds a gated GitHub Actions workflow for GPU lifecycle tests.

Changes

Puzzletron GPU CI

Layer / File(s) Summary
Pinned image and contract validation
examples/puzzletron/ci_environment.json, examples/puzzletron/ci/Dockerfile, examples/puzzletron/ci/resolve_ci_image.py, examples/puzzletron/ci/README.md, tests/unit/torch/puzzletron/test_ci_image_contract.py
Defines the immutable CUDA image and dependencies. The resolver validates image references and repository contracts. Documentation covers image build, execution, and publication. Tests cover resolver and image contracts.
GPU environment provisioning and verification
examples/puzzletron/ci/setup_env.sh, noxfile.py, tests/unit/torch/puzzletron/test_ci_image_contract.py
Adds pinned dependency installation, ModelOpt installation, environment checks, GPU-image-specific Nox validation, and runtime installation checks.
Gated GPU workflow execution
.github/workflows/puzzletron_gpu_tests.yml, .github/workflows/unit_tests.yml, tests/unit/torch/puzzletron/test_ci_image_contract.py
Adds pull-request, nightly, and manual workflow execution. The workflow gates file scope, resolves the immutable image, runs the GPU Nox session, and reports required-check status.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: 🔵 Low · up to 278e0

The new GPU test image currently runs its test process as root, leaving a bounded container-isolation risk that should remain explicitly owned and followed up; this is mergeable without blocking the PR.

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant PRGate
  participant ImageResolver
  participant GPUContainer
  participant RequiredCheck
  PullRequest->>PRGate: evaluate changed-file scope
  PRGate->>ImageResolver: resolve pinned CI image
  ImageResolver->>GPUContainer: provide image and digest cache key
  GPUContainer->>RequiredCheck: report GPU test result
  PRGate->>RequiredCheck: report gate result
  ImageResolver->>RequiredCheck: report image result
Loading

Possibly related PRs

Suggested reviewers: kevalmorabia97, danielkorzekwa, grzegorz-k-karch

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
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: automating Puzzletron GPU lifecycle tests.
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 The PR-range diff adds no prohibited load, remote-code, eval/exec, or # nosec patterns, and adds no pyproject.toml or requirements.txt dependencies.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jrausch/puzzletron-gpu-ci-image-workflow

Comment @coderabbitai help to get the list of available commands.

@j-rausch
j-rausch marked this pull request as ready for review August 12, 2026 12:11
@j-rausch
j-rausch requested review from a team, danielkorzekwa, grzegorz-k-karch and kevalmorabia97 and removed request for a team August 12, 2026 12:11
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/puzzletron_gpu_tests.yml:
- Around line 19-23: Remove secrets: inherit from the pr-gate reusable workflow
invocation in puzzletron_gpu_tests.yml. Preserve the existing permissions and
uses configuration; if pr-gate requires a secret, pass only the specific named
secret through an explicit secrets mapping.

In `@examples/puzzletron/ci/Dockerfile`:
- Around line 20-31: Create a non-root runtime user in the Dockerfile, assign
ownership of /venv and /workspace/modelopt to that user, and add the
corresponding USER instruction before WORKDIR so GPU jobs execute checked-out
code without root privileges.

In `@examples/puzzletron/ci/resolve_ci_image.py`:
- Around line 18-22: Add the module-level __all__ declaration immediately after
the imports in resolve_ci_image.py, listing resolve_image_reference and
validate_repository_contract so both functions are explicitly exposed as the
resolver module’s public API.

In `@tests/unit/torch/puzzletron/test_ci_image_contract.py`:
- Line 87: Replace yaml.load with yaml.safe_load in the workflow parsing setup,
then update the related scalar assertions to expect PyYAML’s native values,
including True for “on” and integer 50 for “timeout-minutes.”
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ab0acb2b-83ac-4994-9a09-dc95f1ef40f2

📥 Commits

Reviewing files that changed from the base of the PR and between be08d472eebf5025ed75f622582f2459bff80f74 and 2413b5054eee120bc47522508bc4b40a420c1869.

📒 Files selected for processing (8)
  • .github/workflows/puzzletron_gpu_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

Comment thread examples/puzzletron/ci/Dockerfile Resolved
@codecov

codecov Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.04%. Comparing base (4e965c7) to head (9abfd3f).
⚠️ Report is 18 commits behind head on jrausch/puzzletron-gpu-quality-baseline-v4.

Additional details and impacted files
@@                             Coverage Diff                             @@
##           jrausch/puzzletron-gpu-quality-baseline-v4    #2167   +/-   ##
===========================================================================
  Coverage                                       63.03%   63.04%           
===========================================================================
  Files                                             709      709           
  Lines                                           91929    91929           
===========================================================================
+ Hits                                            57948    57954    +6     
+ Misses                                          33981    33975    -6     
Flag Coverage Δ
examples 30.03% <ø> (ø)
gpu 23.75% <ø> (ø)
puzzletron 31.75% <ø> (ø)
regression 8.94% <ø> (ø)
unit 29.42% <ø> (+<0.01%) ⬆️

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.

@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-quality-baseline-v4 branch from 55478b8 to de15733 Compare August 12, 2026 15:32
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from c2b81f3 to 1b5940f Compare August 12, 2026 15:32
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot 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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/puzzletron_gpu_tests.yml:
- Around line 69-71: Remove the privileged NGC_API_KEY use from the
push-triggered GPU workflow around the credentials block. Move the GPU job and
secret access into a maintainer-controlled workflow revision, and require an
explicit trusted workflow_dispatch or maintainer approval before executing
copied PR content.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 402d3d89-0192-4214-a74a-3b6b28b3c9a9

📥 Commits

Reviewing files that changed from the base of the PR and between de15733fa18f6d2263e786e3214da47ee456b5b4 and 1b5940f1c0b2156303a140c728a4c6f2213f9785.

📒 Files selected for processing (8)
  • .github/workflows/puzzletron_gpu_tests.yml
  • examples/puzzletron/ci/Dockerfile
  • examples/puzzletron/ci/README.md
  • examples/puzzletron/ci/resolve_ci_image.py
  • examples/puzzletron/ci/setup_env.sh
  • examples/puzzletron/ci_environment.json
  • noxfile.py
  • tests/unit/torch/puzzletron/test_ci_image_contract.py

@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-quality-baseline-v4 branch from e013fe8 to e3f78c2 Compare August 12, 2026 16:32
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 1b5940f to 3274cb6 Compare August 12, 2026 16:32
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-quality-baseline-v4 branch from 6a6b3d0 to 79eb6cd Compare August 12, 2026 21:51
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 3274cb6 to 278e060 Compare August 12, 2026 21:51
@j-rausch

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-quality-baseline-v4 branch from 79eb6cd to a34b939 Compare August 12, 2026 23:03
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 278e060 to 20988e6 Compare August 12, 2026 23:03
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-quality-baseline-v4 branch from a34b939 to 57c87e1 Compare August 13, 2026 01:00
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 20988e6 to 5fdeeb2 Compare August 13, 2026 01:00
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from 5fdeeb2 to f022768 Compare August 13, 2026 01:15
@j-rausch

Copy link
Copy Markdown
Contributor Author

/claude review

Comment thread .github/workflows/unit_tests.yml Resolved
Comment thread examples/puzzletron/ci/setup_env.sh Resolved

@claude claude Bot 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.

Claude review — Puzzletron GPU CI image + workflow

Findings: CRITICAL: 0 · IMPORTANT: 2 · SUGGESTION: 2

Scope: all 9 changed files reviewed (547 additions). This PR touches no modelopt/ runtime code — it is CI infrastructure (workflow, Dockerfile, provisioning script, resolver, noxfile session, contract test), so the review focused on CI correctness, gate coverage, and the pinning contract rather than algorithm/mode/export concerns. I traced setup_env.sh end-to-end against noxfile.py::gpu_puzzletron, _pr_gate.yml's run_tests output, _wait_for_checks.yml's secret usage, pyproject.toml's setuptools_scm config, and the targeted GPU test's fixture (build_tiny_qwen_campaign).

Most impactful findings

1. [IMPORTANT] Unconfigured PUZZLETRON_GPU_CI_IMAGE becomes a red required check on many PRs (puzzletron_gpu_tests.yml:57-61). With the variable unset — the state this PR merges in, per its own description — resolve-image fails, gpu-puzzletron is skipped, and gpu-puzzletron-required-check exits 1. The gate list includes pyproject.toml, noxfile.py, and tests/conftest.py, so this lands on a large share of PRs plus every nightly, and the error text (must be an immutable nvcr.io digest) reads as malformed value rather than variable never set. Suggested: distinguish unset from invalid in resolve_ci_image.py::main, and either land after publishing or make the unset case an explained skip while keeping invalid values a hard failure.

2. [IMPORTANT] The new CPU contract test can't be triggered by the file it guards (unit_tests.yml:87). The puzzletron_changed gate matches Puzzletron paths by extension only (**/*.py, **/*.sh, **/*.json, …), and examples/puzzletron/ci/Dockerfile has none — so a Dockerfile-only change (bumped FROM digest, dropped --verify hook, changed extras) skips the puzzletron_v2 job and test_gpu_image_uses_the_recorded_immutable_base never runs. The workflow-level paths: filter does include examples/puzzletron/**, which makes the inner skip easy to miss. Adding examples/puzzletron/ci/** (as puzzletron_gpu_tests.yml:31 already does) closes it. Note the compensating validate_repository_contract check only runs once the image variable is configured, so right now nothing catches this drift.

Suggestions

  • puzzletron_gpu_tests.yml:34 — gate uses modelopt/torch/puzzletron/**, narrower than the CPU Puzzletron gate (modelopt/torch/**) and gpu_tests.yml (modelopt/**), while the lifecycle test exercises nas/prune/opt. Defensible as a runner-cost tradeoff (nightly covers it), but worth widening or annotating.
  • setup_env.sh:23 — the Dockerfile's ENV PUZZLETRON_CI_ENVIRONMENT=/opt/puzzletron/... means the runtime --verify compares the image against its own baked pins, not the checked-out ones the README describes. Drift is still caught, but by _verify_puzzletron_v2_environment one step later, as a raw version-mismatch dict rather than "rebuild the image."

Things I checked that are correct

  • pr-gate without secrets: inherit is safe: _pr_gate.yml references no secrets, and the nested _wait_for_checks.yml uses only the automatic secrets.GITHUB_TOKEN. permissions: {checks: read} matches gpu_tests.yml/example_tests.yml.
  • run_tests is populated for PR pushes even without skip_puzzletron_only — scope-pr runs unconditionally on pull-request/* and defaults run_tests="$ANY_CHANGED", so the gate is not accidentally always-false.
  • --no-deps at runtime does not silently hide new base dependencies: the pip check immediately after the editable install reports them (extras-only additions still escape).
  • The Dockerfile places setup_env.sh --verify in the same RUN as the dependency install, so a [hf]-extra resolution that moves transformers off 5.8.1 fails the build rather than shipping a mispinned image.
  • venv_backend="none" keeps VIRTUAL_ENV=/venv intact, so install_modelopt's sys.prefix guard passes in-image and fails loudly outside it; the missing-.git/shallow-checkout case is covered by fallback_version = "0.0.0".
  • "on": is quoted, so yaml.safe_load yields the string key the test indexes; the targeted GPU test builds its model and dataset locally, so the deliberate absence of HF_TOKEN is fine.

Risk assessment

Low-to-moderate, and confined to CI. No runtime, mode-registration, state, or export surface is touched, and the pinning design (digest-pinned base, recorded contract, build-time and pre-flight verification, no registry credentials on copied-PR branches) is sound. Both IMPORTANT findings are about when checks run rather than what they assert: one makes a new check fail broadly before the image exists, the other leaves the guarded Dockerfile ungated. Both are small, localized fixes.

Pin the execution image and dependency contract so the focused lifecycle workflow runs against a reproducible one-GPU environment.

Signed-off-by: Johannes Rausch <[email protected]>
Require the immutable execution image to support anonymous pulls so copied pull-request branches never receive registry credentials.

Signed-off-by: Johannes Rausch <[email protected]>
@j-rausch
j-rausch force-pushed the jrausch/puzzletron-gpu-ci-image-workflow branch from f022768 to 9abfd3f Compare August 13, 2026 08:37
@j-rausch j-rausch added the puzzletron_v2 Related to feature/puzzletron_v2 branch label Aug 25, 2026
@kevalmorabia97
kevalmorabia97 removed their request for review October 15, 2026 08:19
kevalmorabia97 pushed a commit that referenced this pull request Oct 26, 2026
### 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",
pypa/setuptools-scm#1405). It needs pypa/setuptools-scm@dc2a075
(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](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?:
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](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## 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.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Connor Baker <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

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

Labels

puzzletron_v2 Related to feature/puzzletron_v2 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants