Skip to content

build: generate CUDA dependency metadata from one source - #655

Merged
binaryaaron merged 6 commits into
mainfrom
binaryaaron/cuda13/dependency-manifest
Jul 29, 2026
Merged

build: generate CUDA dependency metadata from one source#655
binaryaaron merged 6 commits into
mainfrom
binaryaaron/cuda13/dependency-manifest

Conversation

@binaryaaron

@binaryaaron binaryaaron commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

this is one of three stacked prs (#656, #657) for our overdue multiple-versions-of-cuda support. This one is the core mechanism for generating the deps all from one place and handles instructions and docs for new installation methods.

  • Define CPU and CUDA runtime extras, conflicts, package sources, and indexes in cuda_deps.toml.
  • Generate the corresponding marked pyproject.toml sections from that single source of truth.

Validation

- uv run --offline --script tools/gen_cuda_deps.py cuda_deps.toml --pyproject pyproject.toml --check
- uv lock --check

Summary by CodeRabbit

Summary

  • New Features

    • Introduced a tool-managed workflow for CPU/CUDA runtime extras via cuda_deps.toml, with automatic regeneration of dependency lists and package source/index metadata.
    • Added a --check/lock-check flow to prevent CUDA metadata drift.
  • Documentation

    • Updated contributor, agent, README, Docker, and CI guidance to regenerate from cuda_deps.toml and keep the lockfile in sync.
  • Quality & Tests

    • Added end-to-end coverage for generation, splicing, idempotency, and error cases.
  • Chores / Style

    • Added dprint-based TOML formatting and expanded CI formatting checks.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 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: e3317d7d-2ef5-4847-a640-f062da8e08bf

📥 Commits

Reviewing files that changed from the base of the PR and between 1abd6df and 4e0d64a.

📒 Files selected for processing (5)
  • .agents/skills/uv-build/SKILL.md
  • cuda_deps.toml
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
📜 Recent review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Unit Tests (3.11)
  • GitHub Check: Unit Tests (3.13)
  • GitHub Check: Unit Tests (3.12)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (11)
.agents/skills/**

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Store skills in canonical location .agents/skills/ with each skill containing a SKILL.md file and optional references/

Read the applicable repository-specific skill under .agents/skills/ instead of duplicating its workflow instructions.

Files:

  • .agents/skills/uv-build/SKILL.md
.agents/skills/*/SKILL.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Domain-specific AI-agent knowledge belongs in .agents/skills/*/SKILL.md and should be exposed through the skills index in AGENTS.md.

Files:

  • .agents/skills/uv-build/SKILL.md
cuda_deps.toml

📄 CodeRabbit inference engine (AGENTS.md)

Add or change CUDA/CPU dependencies in cuda_deps.toml, then regenerate pyproject.toml and update the lock file.

Changes to CUDA dependency declarations must preserve synchronization with generated CUDA metadata and the uv lockfile.

Files:

  • cuda_deps.toml
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Do not commit changes unless the user asks for a commit or PR work.
Use feature branches based on main; branch names commonly include an issue-number prefix such as <author>/123-short-name.
For testing, building, syncing, bootstrapping, worktrees, GitHub, and recurring workflows, use the corresponding skill under .agents/skills/.

**/*: Use pinned mise tasks for formatting, linting, type checking, and testing rather than invoking Ruff or ty directly; run mise run format, mise run check, and mise run test before submitting changes.
All contributions must include DCO sign-off and a cryptographic commit signature; both requirements are independent.

Files must end with a newline and contain no trailing whitespace; use one space between sentences.

Files:

  • cuda_deps.toml
  • tools/gen_cuda_deps.py

⚙️ CodeRabbit configuration file

**/*: Review as a senior maintainer for NeMo Safe Synthesizer. Prioritize issues that can change behavior, break user workflows, weaken privacy guarantees, hide failures, make tests unreliable, or create maintenance risk. Avoid generic style commentary unless it points to a concrete project convention that automated tools will not catch.
Comment only when the finding is actionable and tied to changed code. For each finding, state the impact, the condition that triggers it, and the smallest practical fix. Prefer one precise comment over broad advice. Do not ask for refactors outside the PR scope unless the changed code creates the problem.
Review type guidance: - Potential issue: use for correctness bugs, data loss, privacy leaks,
security risks, broken public APIs, invalid config behavior, missing
validation, hidden failures, nondeterministic tests, or CI breakage.

  • Refactor suggestion: use for local maintainability problems introduced
    by the diff when they have clear future cost, such as duplicated setup,
    unclear boundaries, over-mocking, avoidable complexity, or opaque test
    helpers.
  • Nitpick: avoid in chill mode. Do not emit formatting, import-order,
    wording, or style-only comments unless automated tools cannot catch the
    issue and it affects maintainability.

Severity guidance: - Critical: security/privacy leaks, data loss, training/test/holdout
contamination, or broken release/package/core pipeline execution.

  • Major: incorrect generation/training/evaluation behavior, broken
    CLI/SDK public API, invalid config defaults or validators, or GPU/vLLM
    cleanup and process-isolation bugs likely to fail CI or production
    runs.
  • Minor: localized bugs, missing focused tests for changed behavior, or
    bad test patterns that weaken regression coverage.
  • Trivial: small cleanup with no behavior impact. Usually suppress in
    chill mode.
  • Info: context only. Avoid unless it helps reviewers understand risk.
    Safe-Synthesizer-specific review focus: - Data ...

Files:

  • cuda_deps.toml
  • tools/gen_cuda_deps.py
**/*.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use dprint to format TOML files through the pinned mise tasks.

Format TOML with the repository formatter, use spaces around =, and follow the prescribed section order in pyproject.toml.

Files:

  • cuda_deps.toml
**/*.{md,markdown,py}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown,py}: Avoid decorative bold (**text**) in list items, body text, and docstrings; use structural cues (headers, list markers, colons, backticks) for emphasis instead
Use backticks for code identifiers, paths, and CLI commands in markdown and docstrings

Files:

  • tools/gen_cuda_deps.py
**/*.{py,pyi}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{py,pyi}: Use uv for Python tooling; use uv run for Python execution, and do not use pip or raw python. Support Python 3.11–3.13 with modern syntax such as X | Y, list[str], and Self; Python 3.14+ is unsupported.
Run repository quality tools through mise tasks or wrapper scripts in tools/; do not invoke ruff or ty directly.

Files:

  • tools/gen_cuda_deps.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Put durable implementation guidance in public function and class docstrings, and local invariants in source comments.

**/*.py: Shared Python source code must remain compatible with Python 3.11 syntax; do not use Python 3.12-only syntax such as PEP 695 type statements or bracketed generic class/function parameters.
Use Ruff for Python formatting, import sorting, and linting, through the pinned mise tasks or approved codestyle scripts.
Place durable module-level guidance in Python docstrings and source comments so it appears in the generated API reference.

Use American English spelling in Python code, documentation, and identifiers.

Files:

  • tools/gen_cuda_deps.py
**/*.{py,sh,yaml,yml,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All Python, shell, YAML, and Markdown source files require SPDX copyright headers unless excluded by .copyrightignore.

Every source file requires the appropriate SPDX copyright and license header; Markdown files with YAML frontmatter must place hash-comment headers inside the frontmatter.

Files:

  • tools/gen_cuda_deps.py
**/*.{py,md}

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Keep code, comments, and docstrings within 120 characters.

Files:

  • tools/gen_cuda_deps.py
tools/**

⚙️ CodeRabbit configuration file

Review tools as developer and CI infrastructure. Check that scripts use uv or Makefile wrappers instead of ad hoc python/pip commands, preserve read-only behavior for check targets, fail with clear messages, avoid hidden network or filesystem side effects, and stay consistent with STYLE_GUIDE.md and CONTRIBUTING.md. Tooling may use print() when it is a standalone script or intentional CLI output.

Files:

  • tools/gen_cuda_deps.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T16:58:06.053Z
Learning: When committing, require DCO sign-off and GPG signing: use `git commit --signoff --gpg-sign` (or `-s -S`); never manually write a `Signed-off-by` trailer or pass `--no-gpg-sign`.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T16:58:17.472Z
Learning: Merged commits must follow Conventional Commits format: `<type>(<scope>): <description>` or `<type>: <description>`, with a lowercase allowed type and a description of at most 100 characters.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T16:58:17.472Z
Learning: Branches other than `main` must use the lowercase `<author>/[<type>/][<issue-id>-]<description>` naming convention, with only the documented branch types allowed.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T16:58:17.472Z
Learning: Never move a published release tag; if code changes, create and validate the next release candidate instead.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T16:58:17.472Z
Learning: The stable release tag must point to the exact SHA tested for the release candidate; promote only after artifact, package, container, and documentation verification passes.
🔇 Additional comments (3)
.agents/skills/uv-build/SKILL.md (1)

58-58: LGTM!

Also applies to: 73-83, 143-143

cuda_deps.toml (1)

96-98: LGTM!

tools/gen_cuda_deps.py (1)

954-964: LGTM!


Walkthrough

The PR adds cuda_deps.toml as the CPU/CUDA dependency source of truth, introduces a generator for pyproject.toml, adds generator tests, and updates lock checks, formatting tasks, packaging metadata, and contributor guidance.

Changes

CUDA Metadata Generation

Layer / File(s) Summary
Dependency configuration and validation contract
cuda_deps.toml, tools/gen_cuda_deps.py
Defines CPU/CUDA dependencies, extras, indexes, sources, variants, and validation models.
Fragment generation and pyproject update
tools/gen_cuda_deps.py
Renders requirements and UV mappings, updates generated pyproject.toml sections, and provides CLI check/update behavior.
Generated metadata and packaging configuration
pyproject.toml
Stores generated CPU/CUDA metadata and updates wheel artifacts and type-check exclusions.
Generator behavior and validation tests
tests/test_gen_cuda_deps.py
Tests rendering, splicing, idempotency, drift checks, CLI behavior, routing, and validation failures.
Consistency checks and contributor workflow
.mise/tasks/*, CONTRIBUTING.md, AGENTS.md, .agents/skills/uv-build/SKILL.md, docs/developer-guide/docker.md, dprint.json, STYLE_GUIDE.md, README.md, .github/workflows/README.md, .mise.toml, ruff.toml
Updates metadata and lock verification, task definitions, formatting configuration, and documented generation workflows.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: refactor, test

Suggested reviewers: kendrickb-nvidia, zywind

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: generating CUDA dependency metadata from a single source.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch binaryaaron/cuda13/dependency-manifest

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

Comment thread tools/gen_cuda_deps.py
return spec.as_pepstr(self)
raise TypeError(f"Unsupported dependency entry {dependency!r}")

def applies(self, dependency: DependencyEntry) -> bool:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved at current head. render() returns for both supported entry types and raises TypeError otherwise; applies() returns explicitly from every match arm. mise run check passes.

@coderabbitai coderabbitai Bot added feature New feature or request test Test-only addition or change labels Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.06299% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tools/gen_cuda_deps.py 94.88% 29 Missing ⚠️
tests/test_gen_cuda_deps.py 99.48% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces cuda_deps.toml as the single source of truth for CPU and CUDA runtime extras, replacing hand-maintained pyproject.toml sections with a code-generated approach via tools/gen_cuda_deps.py. A new lock-check step verifies generated metadata stays in sync, and dprint is added for TOML formatting.

  • New generator (tools/gen_cuda_deps.py, 990 lines): Reads structured TOML config, renders PEP 508 requirements and [tool.uv.sources]/[[tool.uv.index]] sections with validated templating, and splices idempotent marker-bounded blocks into pyproject.toml.
  • cuda_deps.toml: Declares base_runtime_deps, torch_runtime_deps, cuda_runtime_deps, torch_wheel_deps, CPU-specific deps, static sources, and per-variant overrides; flashinfer index name correctly uses {extra} template to prevent future multi-variant name collisions.
  • Test suite (tests/test_gen_cuda_deps.py): 441-line suite covering generation, splicing, idempotency, stale-marker replacement, check-mode drift reporting, and no-op write guard.

Confidence Score: 5/5

Safe to merge; the generator is well-tested, idempotent, and resolves prior-thread concerns. Two minor documentation/config observations do not affect runtime correctness.

The generation, splicing, marker-stripping, and check-mode logic are all covered by an extensive test suite including idempotency and no-op write guard tests. The flashinfer multi-variant name-collision concern raised in a prior review thread is resolved by the {extra} template. The two observations flagged here are documentation drift and a ty negation pattern whose effectiveness is uncertain but has no impact on the generated CUDA metadata or lock file.

Files Needing Attention: The !./tools/gen_cuda_deps.py negation in the ty exclude list in pyproject.toml warrants a quick smoke-check to confirm ty actually type-checks that file as intended.

Important Files Changed

Filename Overview
tools/gen_cuda_deps.py New 990-line generator that reads cuda_deps.toml and splices generated sections into pyproject.toml. Core logic is well-structured with idempotent markers, reverse-order insertion, and validated rendering. Addressed items from prior review (frozen model config, no-op write guard, GenStatus.error removal) appear resolved.
cuda_deps.toml New single source of truth for CPU/CUDA dependency matrix. flashinfer index name now uses {extra} template (flashinfer-jit-cache-{extra}), resolving the multi-variant name-collision concern from prior review. Static sources, indexes, and variant-specific deps are well-organized.
tests/test_gen_cuda_deps.py Comprehensive new test suite covering generation, splicing, idempotency, stale-marker replacement, check-mode drift detection, no-op write guard, and error paths. Integration tests against real cuda_deps.toml validate cu129 variant sources and indexes end-to-end.
pyproject.toml CPU and CUDA runtime extras, [tool.uv.sources], and [[tool.uv.index]] sections now wrapped in generated markers and re-generated from cuda_deps.toml. Formatting normalized to 4-space indent by dprint. Also adds !./tools/gen_cuda_deps.py negation to the ty exclude list — effectiveness depends on whether ty supports gitignore-style negation.
.mise/tasks/quality.toml lock-check task now first checks generated CUDA metadata before verifying uv.lock. format/format-check tasks gain dprint as the first step. Changes are consistent with the new toolchain additions.
dprint.json New dprint config for TOML formatting (4-space indent, 120-char line width) with a content-hashed plugin URL for reproducibility.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[cuda_deps.toml] -->|load_cuda_deps_config| B[CudaDepsConfig]
    B -->|build_cuda_pyproject_fragment| C[CudaPyprojectFragment]
    C -->|apply_cuda_fragment_to_pyproject| D{pyproject.toml current?}
    D -->|check=True, current==updated| E[GenStatus.ok]
    D -->|check=True, current!=updated| F[GenStatus.changed → exit 1]
    D -->|check=False, current==updated| E
    D -->|check=False, current!=updated| G[write updated pyproject.toml]
    G --> E

    subgraph build_cuda_pyproject_fragment
        B1[_collect_uv_sources] --> B4[_validate_source_indexes]
        B2[_collect_uv_indexes] --> B4
        B4 --> B3[_build_cuda_fragment_document]
    end

    subgraph apply_cuda_fragment_to_pyproject
        C1[_update_optional_dependencies]
        C2[_update_uv_sections]
        C3[_mark_generated_sections]
        C1 --> C2 --> C3
    end
Loading

Reviews (6): Last reviewed commit: "build: address final dependency manifest..." | Re-trigger Greptile

Comment thread tools/gen_cuda_deps.py Outdated
Comment on lines +224 to +236
@dataclass(frozen=True)
class NvidiaCudaLibrarySpec(StrictModel):
"""NVIDIA CUDA package source routing metadata."""

name: str = Field(description="NVIDIA CUDA library package stem without the nvidia- prefix.")
nvidia_package_suffix: str | None = Field(
default=None,
description="Optional package suffix override. Defaults to the CUDA variant suffix.",
)
index: str | None = Field(
default=None,
description="Optional literal uv index name or template. Defaults to the variant PyTorch index.",
)

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.

P2 @dataclass(frozen=True) applied to a Pydantic BaseModel subclass

NvidiaCudaLibrarySpec combines Python's standard @dataclass(frozen=True) with Pydantic's BaseModel, which is non-standard. Because Pydantic v2 generates __init__ directly into each model class's __dict__, the @dataclass decorator skips its own __init__ — but it still writes __setattr__/__delattr__ that raise FrozenInstanceError, bypassing Pydantic's own immutability machinery. The correct approach for frozen Pydantic models is model_config = ConfigDict(frozen=True), which is already available through StrictModel's configuration. This combination may break silently across Pydantic minor releases if that internal __init__ placement changes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved. NvidiaCudaLibrarySpec now uses Pydantic’s frozen model configuration without @dataclass.

Comment thread tools/gen_cuda_deps.py Outdated
Comment thread tools/gen_cuda_deps.py Outdated
Comment thread tools/gen_cuda_deps.py
Comment on lines +913 to +926
def _update_pyproject(
pyproject_path: Path,
check: bool,
generated: CudaPyprojectFragment,
) -> GenerationResult:
current = pyproject_path.read_text(encoding="utf-8")
updated = apply_cuda_fragment_to_pyproject(current, generated)
if check:
return _check_pyproject(pyproject_path, current, updated)
pyproject_path.write_text(updated, encoding="utf-8")
return GenerationResult(
status=GenStatus.ok,
message=f"Updated generated CUDA dependency sections in {pyproject_path}",
)

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.

P2 Non-check mode always writes and always reports "Updated"

_update_pyproject unconditionally calls pyproject_path.write_text(updated, ...) and returns "Updated generated CUDA dependency sections" even when current == updated. This means running the generator when the file is already up-to-date still modifies the mtime, can create a spurious git diff, and produces a misleading success message. A pre-check if current == updated: return GenerationResult(status=GenStatus.ok, message="... already up to date") before the write would prevent this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved. _update_pyproject() returns without writing when the generated content is already current. Coverage now also proves stale --check mode leaves the file unchanged.

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

Actionable comments posted: 5


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b4bffca5-fd31-4a5a-8bfe-d35cea816d23

📥 Commits

Reviewing files that changed from the base of the PR and between 1a33099 and ae95473.

📒 Files selected for processing (7)
  • .agents/skills/uv-build/SKILL.md
  • .mise/tasks/quality.toml
  • CONTRIBUTING.md
  • cuda_deps.toml
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Unit Tests (3.13)
  • GitHub Check: Unit Tests (3.12)
  • GitHub Check: Unit Tests (3.11)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (17)
**/*.{md,markdown,py}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown,py}: Avoid decorative bold (**text**) in list items, body text, and docstrings; use structural cues (headers, list markers, colons, backticks) for emphasis instead
Use backticks for code identifiers, paths, and CLI commands in markdown and docstrings

Files:

  • CONTRIBUTING.md
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/*.{md,markdown}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown}: Bold is acceptable only in markdown tables where it's the conventional way to mark header-like cells in the body
Use ## headers to segment markdown sections instead of bold text
Use -- (em-dash) instead of - (hyphen) for asides in markdown

Files:

  • CONTRIBUTING.md
**/*.md

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Do not use decorative bold in Markdown body text, list items, or docstrings; use single backticks for code identifiers, paths, and commands.

Use the repository's MkDocs Material Markdown conventions, including supported admonitions, content tabs, fenced code blocks, Mermaid diagrams, task lists, footnotes, definition lists, and emoji where appropriate.

Files:

  • CONTRIBUTING.md
**/*

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

**/*: Every source file requires the SPDX copyright and license header appropriate to its file format.
End files with a newline, remove trailing whitespace, use one space between sentences, and keep code, comments, and docstrings within 120 characters.

**/*: Never move a published release tag; if release code changes, create and validate the next release candidate instead.
A stable release tag must point to the exact tested commit SHA, not a later main commit.
Before publishing a release, verify the wheel, package import, CLI, dependency set, GitHub release, PyPI artifacts, and immutable container image tag.
All contributions must include a DCO Signed-off-by trailer, and commits must also have a verified cryptographic signature.
Commits merged to main must follow Conventional Commits syntax with a lowercase valid type, optional scope, description of at most 100 characters, and ! for breaking changes.
Before submitting a pull request, all existing tests must pass; new features require tests and bug fixes require regression tests.
Use the repository's mise tasks for development, testing, formatting, checking, documentation, and release operations instead of deprecated Makefile task commands.

Files:

  • CONTRIBUTING.md
  • cuda_deps.toml
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py

⚙️ CodeRabbit configuration file

**/*: Review as a senior maintainer for NeMo Safe Synthesizer. Prioritize issues that can change behavior, break user workflows, weaken privacy guarantees, hide failures, make tests unreliable, or create maintenance risk. Avoid generic style commentary unless it points to a concrete project convention that automated tools will not catch.
Comment only when the finding is actionable and tied to changed code. For each finding, state the impact, the condition that triggers it, and the smallest practical fix. Prefer one precise comment over broad advice. Do not ask for refactors outside the PR scope unless the changed code creates the problem.
Review type guidance: - Potential issue: use for correctness bugs, data loss, privacy leaks,
security risks, broken public APIs, invalid config behavior, missing
validation, hidden failures, nondeterministic tests, or CI breakage.

  • Refactor suggestion: use for local maintainability problems introduced
    by the diff when they have clear future cost, such as duplicated setup,
    unclear boundaries, over-mocking, avoidable complexity, or opaque test
    helpers.
  • Nitpick: avoid in chill mode. Do not emit formatting, import-order,
    wording, or style-only comments unless automated tools cannot catch the
    issue and it affects maintainability.

Severity guidance: - Critical: security/privacy leaks, data loss, training/test/holdout
contamination, or broken release/package/core pipeline execution.

  • Major: incorrect generation/training/evaluation behavior, broken
    CLI/SDK public API, invalid config defaults or validators, or GPU/vLLM
    cleanup and process-isolation bugs likely to fail CI or production
    runs.
  • Minor: localized bugs, missing focused tests for changed behavior, or
    bad test patterns that weaken regression coverage.
  • Trivial: small cleanup with no behavior impact. Usually suppress in
    chill mode.
  • Info: context only. Avoid unless it helps reviewers understand risk.
    Safe-Synthesizer-specific review focus: - Data ...

Files:

  • CONTRIBUTING.md
  • cuda_deps.toml
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/*.{py,sh,yaml,yml,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{py,sh,yaml,yml,md}: All source files with .py, .sh, .yaml, .yml, or .md extensions must include SPDX copyright headers.
Use the repository's pinned mise tasks and formatting checks rather than relying on locally installed tool versions.

Files:

  • CONTRIBUTING.md
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
.agents/skills/**

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Store skills in canonical location .agents/skills/ with each skill containing a SKILL.md file and optional references/

Files:

  • .agents/skills/uv-build/SKILL.md
**/*.toml

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Use spaces around =, comment dependency pins inline, and follow the prescribed pyproject.toml section order.

Files:

  • cuda_deps.toml
  • pyproject.toml
cuda_deps.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changes to cuda_deps.toml require regenerated CUDA metadata and lockfile validation via mise run lock-check.

Files:

  • cuda_deps.toml
.mise/tasks/**/*.toml

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Keep declarative Mise tasks under .mise/tasks/, provide descriptions for public tasks, and add usage metadata where arguments need validation or help.

Files:

  • .mise/tasks/quality.toml
.mise/tasks/*

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Keep shared shell helpers in .mise/tasks/_lib.sh and make that file non-executable.

Files:

  • .mise/tasks/quality.toml
pyproject.toml

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Configure package metadata, dependencies, extras (cpu/cu129/engine), and uv configuration in pyproject.toml

Keep generated CUDA metadata and the uv lockfile synchronized when changing pyproject.toml or cuda_deps.toml; validate drift with mise run lock-check.

Files:

  • pyproject.toml

⚙️ CodeRabbit configuration file

Treat pyproject.toml as high-risk. Check package metadata, uv indexes, dependency groups, optional extras, Python version bounds, hatch config, ty config, script entry points, dependency consistency, and whether changes require regenerating uv.lock.

Files:

  • pyproject.toml
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Place durable implementation guidance in function and class docstrings for public contracts and source comments for local invariants
Target Python 3.11–3.13 with modern syntax (X | Y, list[str], Self). Python 3.14+ is not supported

**/*.py: Use American English spelling in Python code, documentation, and messages.
Use Field(description=...) for every Pydantic model field.
Use assignment-style Field() by default; use Annotated only for additional metadata such as validators, constrained aliases, or discriminated unions.
Use @dataclass(frozen=True) for immutable value objects and validators; use mutable dataclasses only for builders, accumulators, and pipeline state.
Use field(default_factory=list) instead of mutable list defaults.
Use StrEnum for string-valued configuration or serialization enums and plain Enum for internal constants.
Obtain loggers with observability.get_logger(__name__); do not call logging.getLogger() or structlog.get_logger() directly.
Use .runtime, .user, and .system category loggers appropriately.
Do not use print() for operational library output; use the approved logger, click.echo(), or sys.stdout.write() where appropriate.
Use extra={} for machine-queryable logging data and f-strings only for human-readable context.
Raise errors from the custom Safe Synthesizer error hierarchy, using the documented dual inheritance for user and internal errors.
Keep shared package code compatible with Python 3.11; do not use Python 3.12-only syntax such as PEP 695 type statements or bracketed generic parameters.
Prefer X | Y, built-in collection generics, and Self over Optional, Union, and legacy typing collections.
Use collection ABCs for function arguments and concrete collection types for return values.
Use Protocol for structural subtyping and avoid Any when object, generics, or protocols are suitable.
Use TYPE_CHECKING guards for heavy imports such as pandas, torch, and transformers.
...

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/test_*.py

📄 CodeRabbit inference engine (AGENTS.md)

Use the unit marker instead of the deprecated unit_test marker for test identification

Files:

  • tests/test_gen_cuda_deps.py
tests/**

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

tests/**: Mirror src/ directory structure in tests/ directory for test organization
Auto-mark tests by directory: tests/e2e/e2e, tests/smoke/smoke, otherwise default to unit

Mirror source code directory structure in tests directory (e.g., tests/training/, tests/generation/ parallel to source structure)

Files:

  • tests/test_gen_cuda_deps.py
tests/**/*.py

📄 CodeRabbit inference engine (tests/TESTING.md)

tests/**/*.py: Auto-mark tests based on file path: tests under /e2e/ get e2e marker, tests under /smoke/ get smoke marker, all others get unit marker (only if no category marker already present)
Every test should have exactly one category marker: unit, smoke, or e2e
Use pytest.mark.requires_gpu modifier on tests that need CUDA hardware
Use pytest.mark.vllm on tests using vLLM generation backend and ensure each vLLM test file runs in its own process for GPU memory isolation
Use pytest.mark.slow on long-running tests
Use pytest.mark.smollm2 for SmolLM2 Hub download tests to enable process isolation
Use pytest.mark.noautouse to skip autouse fixtures for specific tests
Use load_test_dataset(filename) helper to load test datasets from tests/stub_datasets/ as HuggingFace Dataset objects
Use load_test_dataframe(filename) helper to load test data files from tests/stub_datasets/ as pandas DataFrames
Convert pandas columns to nullable dtypes (pd.Int64Dtype(), pd.BooleanDtype()) before assigning np.nan values
Use fake.seed_instance(seed) and random.seed(seed) together for Faker-based test data reproducibility
When sharing methods across multiple test files, define them in conftest.py and import them using relative imports (e.g., from .conftest import train_with_sdk); note that importing from other test files like tests/cli/helpers.py does not work
Use fixture_mock_processor or fixture_mock_processor_without_valid_records for mocking ParsedResponse objects with valid_records, invalid_records, errors, and prompt_number fields
Use pytest.importorskip to gate tests on optional dependencies that require specific extras (e.g., sentence_transformers, vllm)
Run vLLM tests with separate pytest invocations (one per file) using -n 0 (single process) for GPU memory isolation, or use staged mise tasks for CI visibility
Print statements are allowed in tests (ruff T201 is suppressed for tests/ directory) and should...

Files:

  • tests/test_gen_cuda_deps.py

⚙️ CodeRabbit configuration file

Review tests against tests/TESTING.md. Check marker usage, fixture naming, tmp_path usage, determinism, and GPU/vLLM process-isolation requirements. Flag slop tests that only check that code runs, assert result is not None when stronger invariants exist, over-mock internal implementation details, patch around the bug instead of reproducing it, or add broad snapshot/golden churn without a clear contract. Flag change detector tests that fail on harmless refactors, formatting, record ordering, incidental wording, or private implementation details without demonstrating a behavior regression. Prefer existing fixtures or focused new fixtures for repeated setup; keep tests DRY when reasonable without making the behavior under test opaque. print() is allowed in tests.

Files:

  • tests/test_gen_cuda_deps.py
tests/test_*.py

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Name test files test_*.py, classes Test*, and functions test_<module>_<expected_behavior>.

Files:

  • tests/test_gen_cuda_deps.py
tools/**

⚙️ CodeRabbit configuration file

Review tools as developer and CI infrastructure. Check that scripts use uv or Makefile wrappers instead of ad hoc python/pip commands, preserve read-only behavior for check targets, fail with clear messages, avoid hidden network or filesystem side effects, and stay consistent with STYLE_GUIDE.md and CONTRIBUTING.md. Tooling may use print() when it is a standalone script or intentional CLI output.

Files:

  • tools/gen_cuda_deps.py
🧠 Learnings (1)
📚 Learning: 2026-05-27T22:20:37.354Z
Learnt from: kendrickb-nvidia
Repo: NVIDIA-NeMo/Safe-Synthesizer PR: 520
File: tests/generation/test_vllm_backend.py:556-587
Timestamp: 2026-05-27T22:20:37.354Z
Learning: In NVIDIA-NeMo/Safe-Synthesizer, `tests/conftest.py`’s `pytest_collection_modifyitems` hook applies pytest category markers automatically based on each test file’s path: tests under `/e2e/` get `pytest.mark.e2e`, tests under `/smoke/` get `pytest.mark.smoke`, and all other tests get `pytest.mark.unit`. Therefore, when reviewing pytest tests outside `tests/e2e/` and `tests/smoke/`, do not flag missing explicit `pytest.mark.unit` decorators on test classes/functions as an issue (the hook will add them during collection). If a new test directory/category is introduced, ensure the hook is updated so it’s categorized correctly.

Applied to files:

  • tests/test_gen_cuda_deps.py
🪛 LanguageTool
.agents/skills/uv-build/SKILL.md

[grammar] ~70-~70: Use a hyphen to join words.
Context: ...ock`. Pre-commit verifies the lock is up to date. The generated CPU/CUDA sections of...

(QB_NEW_EN_HYPHEN)

🔇 Additional comments (7)
cuda_deps.toml (1)

1-59: LGTM!

Also applies to: 64-112

tools/gen_cuda_deps.py (1)

1-4: LGTM!

Also applies to: 6-13, 22-223, 238-983

pyproject.toml (1)

113-244: LGTM!

Also applies to: 252-331

tests/test_gen_cuda_deps.py (1)

1-3: LGTM!

Also applies to: 9-149, 155-340

.mise/tasks/quality.toml (1)

24-25: LGTM!

Also applies to: 27-29

.agents/skills/uv-build/SKILL.md (1)

64-74: LGTM!

CONTRIBUTING.md (1)

596-596: LGTM!

Comment thread .mise/tasks/quality.toml Outdated
Comment thread cuda_deps.toml Outdated
Comment thread tools/gen_cuda_deps.py Outdated
Comment thread tools/gen_cuda_deps.py
Comment thread tools/gen_cuda_deps.py Outdated
binaryaaron added a commit that referenced this pull request Jul 16, 2026
Addresses PR #655 review comments: scope CPU torch/torchaudio/torchvision
sources to Linux, skip rewriting an unchanged pyproject.toml, drop unused
structlog dependency and dead GenStatus.error, use Pydantic's frozen model
config instead of mixing in @DataClass, match the script's Python range to
the repo, and run the lock-check generator call offline.

Also simplifies tools/gen_cuda_deps.py: drop the PEP 723 inline-script
metadata block in favor of running against the repo venv, fix a marker
duplication bug in the generated-block stripping logic (surfaced while
dropping that block), fold single-caller helpers into their only callers
(_render_template, GeneratedBlocks' position finders), derive the uv source
marker from sys_platform/arch instead of hand-duplicating it in
cuda_deps.toml, and move CudaVariantUvRouter's index-resolution methods onto
CudaVariantContext to remove multi-hop reaches through it. Reworks the test
fixtures to use structural TOML mutation instead of brittle string-replace
against a shared blob, and extracts duplicated expected-output constants.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 16e068a0-3deb-47ca-bcc3-03870e2efcf0

📥 Commits

Reviewing files that changed from the base of the PR and between ae95473 and cff9c9c.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock, !uv.lock
📒 Files selected for processing (5)
  • .mise/tasks/quality.toml
  • cuda_deps.toml
  • pyproject.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • .mise/tasks/quality.toml
  • pyproject.toml
  • cuda_deps.toml
📜 Review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: Unit Tests (3.12)
  • GitHub Check: Unit Tests (3.11)
  • GitHub Check: Unit Tests (3.13)
  • GitHub Check: Smoke Tests
  • GitHub Check: End-user Wheel Install
  • GitHub Check: Greptile Review
  • GitHub Check: Analyze (Python)
  • GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{md,markdown,py}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown,py}: Avoid decorative bold (**text**) in list items, body text, and docstrings; use structural cues (headers, list markers, colons, backticks) for emphasis instead
Use backticks for code identifiers, paths, and CLI commands in markdown and docstrings

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Place durable implementation guidance in function and class docstrings for public contracts and source comments for local invariants
Target Python 3.11–3.13 with modern syntax (X | Y, list[str], Self). Python 3.14+ is not supported

**/*.py: Use American English spelling in Python code, documentation, and messages.
Use Field(description=...) for every Pydantic model field.
Use assignment-style Field() by default; use Annotated only for additional metadata such as validators, constrained aliases, or discriminated unions.
Use @dataclass(frozen=True) for immutable value objects and validators; use mutable dataclasses only for builders, accumulators, and pipeline state.
Use field(default_factory=list) instead of mutable list defaults.
Use StrEnum for string-valued configuration or serialization enums and plain Enum for internal constants.
Obtain loggers with observability.get_logger(__name__); do not call logging.getLogger() or structlog.get_logger() directly.
Use .runtime, .user, and .system category loggers appropriately.
Do not use print() for operational library output; use the approved logger, click.echo(), or sys.stdout.write() where appropriate.
Use extra={} for machine-queryable logging data and f-strings only for human-readable context.
Raise errors from the custom Safe Synthesizer error hierarchy, using the documented dual inheritance for user and internal errors.
Keep shared package code compatible with Python 3.11; do not use Python 3.12-only syntax such as PEP 695 type statements or bracketed generic parameters.
Prefer X | Y, built-in collection generics, and Self over Optional, Union, and legacy typing collections.
Use collection ABCs for function arguments and concrete collection types for return values.
Use Protocol for structural subtyping and avoid Any when object, generics, or protocols are suitable.
Use TYPE_CHECKING guards for heavy imports such as pandas, torch, and transformers.
...

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/test_*.py

📄 CodeRabbit inference engine (AGENTS.md)

Use the unit marker instead of the deprecated unit_test marker for test identification

Files:

  • tests/test_gen_cuda_deps.py
tests/**

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

tests/**: Mirror src/ directory structure in tests/ directory for test organization
Auto-mark tests by directory: tests/e2e/e2e, tests/smoke/smoke, otherwise default to unit

Mirror source code directory structure in tests directory (e.g., tests/training/, tests/generation/ parallel to source structure)

Files:

  • tests/test_gen_cuda_deps.py
tests/**/*.py

📄 CodeRabbit inference engine (tests/TESTING.md)

tests/**/*.py: Auto-mark tests based on file path: tests under /e2e/ get e2e marker, tests under /smoke/ get smoke marker, all others get unit marker (only if no category marker already present)
Every test should have exactly one category marker: unit, smoke, or e2e
Use pytest.mark.requires_gpu modifier on tests that need CUDA hardware
Use pytest.mark.vllm on tests using vLLM generation backend and ensure each vLLM test file runs in its own process for GPU memory isolation
Use pytest.mark.slow on long-running tests
Use pytest.mark.smollm2 for SmolLM2 Hub download tests to enable process isolation
Use pytest.mark.noautouse to skip autouse fixtures for specific tests
Use load_test_dataset(filename) helper to load test datasets from tests/stub_datasets/ as HuggingFace Dataset objects
Use load_test_dataframe(filename) helper to load test data files from tests/stub_datasets/ as pandas DataFrames
Convert pandas columns to nullable dtypes (pd.Int64Dtype(), pd.BooleanDtype()) before assigning np.nan values
Use fake.seed_instance(seed) and random.seed(seed) together for Faker-based test data reproducibility
When sharing methods across multiple test files, define them in conftest.py and import them using relative imports (e.g., from .conftest import train_with_sdk); note that importing from other test files like tests/cli/helpers.py does not work
Use fixture_mock_processor or fixture_mock_processor_without_valid_records for mocking ParsedResponse objects with valid_records, invalid_records, errors, and prompt_number fields
Use pytest.importorskip to gate tests on optional dependencies that require specific extras (e.g., sentence_transformers, vllm)
Run vLLM tests with separate pytest invocations (one per file) using -n 0 (single process) for GPU memory isolation, or use staged mise tasks for CI visibility
Print statements are allowed in tests (ruff T201 is suppressed for tests/ directory) and should...

Files:

  • tests/test_gen_cuda_deps.py

⚙️ CodeRabbit configuration file

Review tests against tests/TESTING.md. Check marker usage, fixture naming, tmp_path usage, determinism, and GPU/vLLM process-isolation requirements. Flag slop tests that only check that code runs, assert result is not None when stronger invariants exist, over-mock internal implementation details, patch around the bug instead of reproducing it, or add broad snapshot/golden churn without a clear contract. Flag change detector tests that fail on harmless refactors, formatting, record ordering, incidental wording, or private implementation details without demonstrating a behavior regression. Prefer existing fixtures or focused new fixtures for repeated setup; keep tests DRY when reasonable without making the behavior under test opaque. print() is allowed in tests.

Files:

  • tests/test_gen_cuda_deps.py
tests/test_*.py

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Name test files test_*.py, classes Test*, and functions test_<module>_<expected_behavior>.

Files:

  • tests/test_gen_cuda_deps.py
**/*

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

**/*: Every source file requires the SPDX copyright and license header appropriate to its file format.
End files with a newline, remove trailing whitespace, use one space between sentences, and keep code, comments, and docstrings within 120 characters.

**/*: Commits merged to main must use Conventional Commits format: <type>(<scope>): <description> or <type>: <description>, with a valid lowercase type and a description of at most 100 characters.
All contributions must include a DCO Signed-off-by trailer, and commits must also have a verified cryptographic signature.
Branches other than main must follow the lowercase <author>/<description> convention, optionally including an issue ID and one of the approved type prefixes.
Before submitting a pull request, run the repository's formatting, quality checks, and tests (mise run format, mise run check, and mise run test).

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py

⚙️ CodeRabbit configuration file

**/*: Review as a senior maintainer for NeMo Safe Synthesizer. Prioritize issues that can change behavior, break user workflows, weaken privacy guarantees, hide failures, make tests unreliable, or create maintenance risk. Avoid generic style commentary unless it points to a concrete project convention that automated tools will not catch.
Comment only when the finding is actionable and tied to changed code. For each finding, state the impact, the condition that triggers it, and the smallest practical fix. Prefer one precise comment over broad advice. Do not ask for refactors outside the PR scope unless the changed code creates the problem.
Review type guidance: - Potential issue: use for correctness bugs, data loss, privacy leaks,
security risks, broken public APIs, invalid config behavior, missing
validation, hidden failures, nondeterministic tests, or CI breakage.

  • Refactor suggestion: use for local maintainability problems introduced
    by the diff when they have clear future cost, such as duplicated setup,
    unclear boundaries, over-mocking, avoidable complexity, or opaque test
    helpers.
  • Nitpick: avoid in chill mode. Do not emit formatting, import-order,
    wording, or style-only comments unless automated tools cannot catch the
    issue and it affects maintainability.

Severity guidance: - Critical: security/privacy leaks, data loss, training/test/holdout
contamination, or broken release/package/core pipeline execution.

  • Major: incorrect generation/training/evaluation behavior, broken
    CLI/SDK public API, invalid config defaults or validators, or GPU/vLLM
    cleanup and process-isolation bugs likely to fail CI or production
    runs.
  • Minor: localized bugs, missing focused tests for changed behavior, or
    bad test patterns that weaken regression coverage.
  • Trivial: small cleanup with no behavior impact. Usually suppress in
    chill mode.
  • Info: context only. Avoid unless it helps reviewers understand risk.
    Safe-Synthesizer-specific review focus: - Data ...

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
**/*.{py,sh,yaml,yml,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All Python, shell, YAML, YML, and Markdown source files must include SPDX copyright headers, except files listed in .copyrightignore.

Files:

  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
tools/**

⚙️ CodeRabbit configuration file

Review tools as developer and CI infrastructure. Check that scripts use uv or Makefile wrappers instead of ad hoc python/pip commands, preserve read-only behavior for check targets, fail with clear messages, avoid hidden network or filesystem side effects, and stay consistent with STYLE_GUIDE.md and CONTRIBUTING.md. Tooling may use print() when it is a standalone script or intentional CLI output.

Files:

  • tools/gen_cuda_deps.py
🧠 Learnings (1)
📚 Learning: 2026-05-27T22:20:37.354Z
Learnt from: kendrickb-nvidia
Repo: NVIDIA-NeMo/Safe-Synthesizer PR: 520
File: tests/generation/test_vllm_backend.py:556-587
Timestamp: 2026-05-27T22:20:37.354Z
Learning: In NVIDIA-NeMo/Safe-Synthesizer, `tests/conftest.py`’s `pytest_collection_modifyitems` hook applies pytest category markers automatically based on each test file’s path: tests under `/e2e/` get `pytest.mark.e2e`, tests under `/smoke/` get `pytest.mark.smoke`, and all other tests get `pytest.mark.unit`. Therefore, when reviewing pytest tests outside `tests/e2e/` and `tests/smoke/`, do not flag missing explicit `pytest.mark.unit` decorators on test classes/functions as an issue (the hook will add them during collection). If a new test directory/category is introduced, ensure the hook is updated so it’s categorized correctly.

Applied to files:

  • tests/test_gen_cuda_deps.py
🔇 Additional comments (2)
tools/gen_cuda_deps.py (1)

1-42: LGTM!

Also applies to: 171-223, 252-540, 761-783, 899-937

tests/test_gen_cuda_deps.py (1)

33-204: LGTM!

Also applies to: 235-369

Comment thread tests/test_gen_cuda_deps.py
Comment thread tools/gen_cuda_deps.py Outdated
Comment thread tools/gen_cuda_deps.py
Comment thread tools/gen_cuda_deps.py
mckornfield
mckornfield previously approved these changes Jul 24, 2026

@mckornfield mckornfield left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I believe I reviewed this at one point, and though I'm sure it's changed a bit, felt like that other version was gtg. Might be worth addressing the CR reviews, though they're not that great from what I can see lol

updated = generator.apply_cuda_fragment_to_pyproject(PYPROJECT, generated)
parsed = tomllib.loads(updated)

assert "# >>> BEGIN GENERATED CUDA RUNTIME EXTRAS - DO NOT EDIT <<<" in updated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol these assertions are fun

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They earned their keep here. I added more exact convergence and formatting coverage while wiring in dprint.

@zywind zywind 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.

I wonder if there's a way to not generate pyproject.toml. After all, the lock file is supposed to be the generated version.

Comment thread pyproject.toml Outdated
[
{extra = "cpu"},
{extra = "cu129"},
],

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.

NIT: The indentation here is a bit weird. Given that many of the changes here are formatting changes, it's worth adding a toml formatter

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's time. i'm adding dprint for toml; we can use it for more if we want later.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in 7cf5c589. dprint’s TOML plugin is versioned and checksummed, dprint fmt and dprint check run through the existing mise format/check tasks, and all tracked TOML is normalized. mise run validate passes.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 2026
7 tasks
@coderabbitai coderabbitai Bot added refactor Internal restructuring with no behavior change and removed feature New feature or request labels Jul 29, 2026

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ff32eaac-15aa-4b90-a7de-3d7288e87e5f

📥 Commits

Reviewing files that changed from the base of the PR and between cff9c9c and 7cf5c58.

📒 Files selected for processing (18)
  • .agents/skills/uv-build/SKILL.md
  • .github/workflows/README.md
  • .mise.toml
  • .mise/tasks/docs.toml
  • .mise/tasks/quality.toml
  • .mise/tasks/setup.toml
  • .mise/tasks/tests.toml
  • AGENTS.md
  • CONTRIBUTING.md
  • README.md
  • STYLE_GUIDE.md
  • cuda_deps.toml
  • docs/developer-guide/docker.md
  • dprint.json
  • pyproject.toml
  • ruff.toml
  • tests/test_gen_cuda_deps.py
  • tools/gen_cuda_deps.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • .agents/skills/uv-build/SKILL.md
  • .mise/tasks/quality.toml
  • cuda_deps.toml
  • tools/gen_cuda_deps.py
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (20)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: If AGENTS.local.md exists, read it and give its instructions top priority.
Do not commit changes unless the user asks for a commit or PR work.
When committing, require DCO sign-off and GPG signing using git commit --signoff --gpg-sign (or -s -S); never manually add Signed-off-by or use --no-gpg-sign.

End files with a newline, remove trailing whitespace, use one space between sentences, and keep code, comments, and docstrings within 120 characters.

Files:

  • dprint.json
  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
  • pyproject.toml
  • ruff.toml
  • tests/test_gen_cuda_deps.py

⚙️ CodeRabbit configuration file

**/*: Review as a senior maintainer for NeMo Safe Synthesizer. Prioritize issues that can change behavior, break user workflows, weaken privacy guarantees, hide failures, make tests unreliable, or create maintenance risk. Avoid generic style commentary unless it points to a concrete project convention that automated tools will not catch.
Comment only when the finding is actionable and tied to changed code. For each finding, state the impact, the condition that triggers it, and the smallest practical fix. Prefer one precise comment over broad advice. Do not ask for refactors outside the PR scope unless the changed code creates the problem.
Review type guidance: - Potential issue: use for correctness bugs, data loss, privacy leaks,
security risks, broken public APIs, invalid config behavior, missing
validation, hidden failures, nondeterministic tests, or CI breakage.

  • Refactor suggestion: use for local maintainability problems introduced
    by the diff when they have clear future cost, such as duplicated setup,
    unclear boundaries, over-mocking, avoidable complexity, or opaque test
    helpers.
  • Nitpick: avoid in chill mode. Do not emit formatting, import-order,
    wording, or style-only comments unless automated tools cannot catch the
    issue and it affects maintainability.

Severity guidance: - Critical: security/privacy leaks, data loss, training/test/holdout
contamination, or broken release/package/core pipeline execution.

  • Major: incorrect generation/training/evaluation behavior, broken
    CLI/SDK public API, invalid config defaults or validators, or GPU/vLLM
    cleanup and process-isolation bugs likely to fail CI or production
    runs.
  • Minor: localized bugs, missing focused tests for changed behavior, or
    bad test patterns that weaken regression coverage.
  • Trivial: small cleanup with no behavior impact. Usually suppress in
    chill mode.
  • Info: context only. Avoid unless it helps reviewers understand risk.
    Safe-Synthesizer-specific review focus: - Data ...

Files:

  • dprint.json
  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
  • pyproject.toml
  • ruff.toml
  • tests/test_gen_cuda_deps.py
**/*.{md,markdown,py}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown,py}: Avoid decorative bold (**text**) in list items, body text, and docstrings; use structural cues (headers, list markers, colons, backticks) for emphasis instead
Use backticks for code identifiers, paths, and CLI commands in markdown and docstrings

Files:

  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
  • tests/test_gen_cuda_deps.py
**/*.{md,markdown}

📄 CodeRabbit inference engine (.cursor/rules/agent-markdown-style.mdc)

**/*.{md,markdown}: Bold is acceptable only in markdown tables where it's the conventional way to mark header-like cells in the body
Use ## headers to segment markdown sections instead of bold text
Use -- (em-dash) instead of - (hyphen) for asides in markdown

Files:

  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
AGENTS.md

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Maintain agent guide with module map and conventions in AGENTS.md

Files:

  • AGENTS.md
**/*.{py,sh,yaml,yml,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

All source files with extensions .py, .sh, .yaml, .yml, and .md require SPDX copyright headers.

Every source file requires the repository SPDX copyright and license header, using hash comments for Python, shell, and YAML and HTML comments or frontmatter comments for Markdown.

Files:

  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
  • tests/test_gen_cuda_deps.py
**/*.md

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Do not use decorative bold in body text; use single backticks for identifiers, paths, and commands, and use -- for asides.

Files:

  • AGENTS.md
  • STYLE_GUIDE.md
  • README.md
  • docs/developer-guide/docker.md
  • CONTRIBUTING.md
.github/**

⚙️ CodeRabbit configuration file

Review GitHub configuration for branch protection expectations, CODEOWNERS alignment, least privilege permissions, pinned actions where practical, and consistency with CONTRIBUTING.md.

Files:

  • .github/workflows/README.md
README.md

⚙️ CodeRabbit configuration file

Treat README.md as the project overview. Check that setup, usage, and links stay consistent with CONTRIBUTING.md, Makefile, and docs/.

Files:

  • README.md
.mise/tasks/**/*.toml

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Keep declarative mise tasks under .mise/tasks/, provide description for public TOML tasks, and use usage for arguments requiring validation or help.

Files:

  • .mise/tasks/setup.toml
  • .mise/tasks/docs.toml
  • .mise/tasks/tests.toml
.mise/tasks/*

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Use #MISE description=... and #USAGE in public file tasks; place shared non-executable shell helpers in .mise/tasks/_lib.sh.

Files:

  • .mise/tasks/setup.toml
  • .mise/tasks/docs.toml
  • .mise/tasks/tests.toml
docs/**/*.md

📄 CodeRabbit inference engine (.cursor/rules/writing-docs.mdc)

docs/**/*.md: Use MkDocs Material admonition syntax (!!! note, !!! warning, ??? tip) for highlighting important information and collapsible sections in documentation
Use MkDocs Material tabs syntax (=== "Label") to present alternative views or language-specific examples in documentation
Use code block syntax with title and highlight line parameters (title="filename", hl_lines="2 3") for code examples in documentation
Use Mermaid diagram syntax (```mermaid flowchart, etc.) for visualizations in documentation

Documentation pages must be placed under the appropriate docs/ Diataxis subdirectory and added to the nav: section of mkdocs.yml.

Classify documentation pages using Diátaxis and use MkDocs Material syntax such as admonitions, tabs, and titled or highlighted code blocks.

Files:

  • docs/developer-guide/docker.md
docs/**

⚙️ CodeRabbit configuration file

Review documentation as MkDocs Material content. Check Diataxis fit, accurate commands, internal links, code fences, and markdown style from STYLE_GUIDE.md.

Files:

  • docs/developer-guide/docker.md
pyproject.toml

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Configure package metadata, dependencies, extras (cpu/cu129/engine), and uv configuration in pyproject.toml

Never hand-edit generated # >>> BEGIN GENERATED ... <<< blocks; modify cuda_deps.toml, regenerate with tools/gen_cuda_deps.py, then run uv lock.

Keep generated CUDA metadata and the uv lock file synchronized; lock drift is checked when pyproject.toml or cuda_deps.toml changes.

Files:

  • pyproject.toml

⚙️ CodeRabbit configuration file

Treat pyproject.toml as high-risk. Check package metadata, uv indexes, dependency groups, optional extras, Python version bounds, hatch config, ty config, script entry points, dependency consistency, and whether changes require regenerating uv.lock.

Files:

  • pyproject.toml
**/*.toml

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Format TOML with the repository formatter, use spaces around =, four spaces for multiline arrays, and follow the prescribed pyproject.toml section order.

Files:

  • pyproject.toml
  • ruff.toml
.mise.toml

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Keep the root task include under [task_config].

Files:

  • .mise.toml

⚙️ CodeRabbit configuration file

Treat .mise.toml as toolchain supply-chain configuration. Check pinned tool choices, install cadence, platform coverage, environment settings, and whether changes require regenerating mise.lock.

Files:

  • .mise.toml
ruff.toml

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

Configure ruff linting and formatting rules in ruff.toml

Files:

  • ruff.toml

⚙️ CodeRabbit configuration file

Review Ruff configuration against STYLE_GUIDE.md. Check selected rules, ignores, per-file ignores, Python target version, line length, and whether changes hide real defects or conflict with Makefile targets.

Files:

  • ruff.toml
tests/**

📄 CodeRabbit inference engine (.cursor/rules/repo-navigation.mdc)

tests/**: Mirror src/ directory structure in tests/ directory for test organization
Auto-mark tests by directory: tests/e2e/e2e, tests/smoke/smoke, otherwise default to unit

Mirror source code directory structure in tests directory (e.g., tests/training/, tests/generation/ parallel to source structure)

Files:

  • tests/test_gen_cuda_deps.py
tests/**/*.py

📄 CodeRabbit inference engine (tests/TESTING.md)

tests/**/*.py: Auto-mark tests based on file path: tests under /e2e/ get e2e marker, tests under /smoke/ get smoke marker, all others get unit marker (only if no category marker already present)
Every test should have exactly one category marker: unit, smoke, or e2e
Use pytest.mark.requires_gpu modifier on tests that need CUDA hardware
Use pytest.mark.vllm on tests using vLLM generation backend and ensure each vLLM test file runs in its own process for GPU memory isolation
Use pytest.mark.slow on long-running tests
Use pytest.mark.smollm2 for SmolLM2 Hub download tests to enable process isolation
Use pytest.mark.noautouse to skip autouse fixtures for specific tests
Use load_test_dataset(filename) helper to load test datasets from tests/stub_datasets/ as HuggingFace Dataset objects
Use load_test_dataframe(filename) helper to load test data files from tests/stub_datasets/ as pandas DataFrames
Convert pandas columns to nullable dtypes (pd.Int64Dtype(), pd.BooleanDtype()) before assigning np.nan values
Use fake.seed_instance(seed) and random.seed(seed) together for Faker-based test data reproducibility
When sharing methods across multiple test files, define them in conftest.py and import them using relative imports (e.g., from .conftest import train_with_sdk); note that importing from other test files like tests/cli/helpers.py does not work
Use fixture_mock_processor or fixture_mock_processor_without_valid_records for mocking ParsedResponse objects with valid_records, invalid_records, errors, and prompt_number fields
Use pytest.importorskip to gate tests on optional dependencies that require specific extras (e.g., sentence_transformers, vllm)
Run vLLM tests with separate pytest invocations (one per file) using -n 0 (single process) for GPU memory isolation, or use staged mise tasks for CI visibility
Print statements are allowed in tests (ruff T201 is suppressed for tests/ directory) and should...

Files:

  • tests/test_gen_cuda_deps.py

⚙️ CodeRabbit configuration file

Review tests against tests/TESTING.md. Check marker usage, fixture naming, tmp_path usage, determinism, and GPU/vLLM process-isolation requirements. Flag slop tests that only check that code runs, assert result is not None when stronger invariants exist, over-mock internal implementation details, patch around the bug instead of reproducing it, or add broad snapshot/golden churn without a clear contract. Flag change detector tests that fail on harmless refactors, formatting, record ordering, incidental wording, or private implementation details without demonstrating a behavior regression. Prefer existing fixtures or focused new fixtures for repeated setup; keep tests DRY when reasonable without making the behavior under test opaque. print() is allowed in tests.

Files:

  • tests/test_gen_cuda_deps.py
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use uv for Python environment management and execution; use uv run instead of raw python or pip.
Support Python 3.11–3.13 and use modern syntax such as X | Y, list[str], and Self; do not target Python 3.14+.
Run repository mise tasks or wrapper scripts in tools/ instead of invoking ruff or ty directly.

**/*.py: Keep Python source compatible with Python 3.11; do not use Python 3.12-only syntax such as PEP 695 type statements or bracketed generic parameters.
Use the repository's pinned Ruff and ty tooling through the mise tasks for Python formatting, linting, and type checking.

**/*.py: Use American English spelling in Python code and documentation; new code must follow the conventions even where legacy deviations remain.
Always provide Field(description=...) for Pydantic model fields; use assignment-style Field() by default and use Annotated only for additional metadata such as validators, reusable constraints, or discriminated unions.
Use field(default_factory=list) rather than mutable list defaults, and prefer frozen dataclasses for immutable value objects and validators.
Use StrEnum for string-valued enums used in configuration or serialization, and plain Enum for internal-only named constants.
Obtain loggers with observability.get_logger(__name__); do not call logging.getLogger() or structlog.get_logger() directly.
Never use print() for operational library output; use the repository logger, click.echo() for CLI output, or sys.stdout.write() for raw tool output.
Use extra={} for structured data that downstream tools should query or aggregate, such as metrics, counts, and durations.
Raise known failures through the custom error hierarchy: SafeSynthesizerError, UserError, DataError, ParameterError, GenerationError, and InternalError, using dual inheritance where specified.
Keep shared package code compatible with Python 3.11; do not use Python 3.12-only syntax such as PEP 695 type statement...

Files:

  • tests/test_gen_cuda_deps.py
tests/test_*.py

📄 CodeRabbit inference engine (STYLE_GUIDE.md)

Name test files test_*.py, classes Test*, and functions test_<module>_<expected_behavior>; use fixture_ prefixes and one-line fixture docstrings.

Files:

  • tests/test_gen_cuda_deps.py
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T15:01:31.552Z
Learning: All merged commits must use Conventional Commits syntax: `<type>(<scope>): <description>` or `<type>: <description>`, with a lowercase valid type and a description of at most 100 characters.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T15:01:31.552Z
Learning: Every contribution must include a DCO `Signed-off-by` trailer, and commits must also have a verified cryptographic signature.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T15:01:31.552Z
Learning: Never move a published release tag; if code changes, create and validate the next release-candidate tag.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T15:01:31.552Z
Learning: Promote a stable release tag only after candidate validation, and ensure it points to the same tested commit SHA.
Learnt from: CR
Repo: NVIDIA-NeMo/Safe-Synthesizer

Timestamp: 2026-07-29T15:01:31.552Z
Learning: Use `mise run` tasks with the pinned tool versions for formatting, checking, testing, validation, and release operations instead of invoking repository tooling directly where a mise task exists.
📚 Learning: 2026-05-27T22:20:37.354Z
Learnt from: kendrickb-nvidia
Repo: NVIDIA-NeMo/Safe-Synthesizer PR: 520
File: tests/generation/test_vllm_backend.py:556-587
Timestamp: 2026-05-27T22:20:37.354Z
Learning: In NVIDIA-NeMo/Safe-Synthesizer, `tests/conftest.py`’s `pytest_collection_modifyitems` hook applies pytest category markers automatically based on each test file’s path: tests under `/e2e/` get `pytest.mark.e2e`, tests under `/smoke/` get `pytest.mark.smoke`, and all other tests get `pytest.mark.unit`. Therefore, when reviewing pytest tests outside `tests/e2e/` and `tests/smoke/`, do not flag missing explicit `pytest.mark.unit` decorators on test classes/functions as an issue (the hook will add them during collection). If a new test directory/category is introduced, ensure the hook is updated so it’s categorized correctly.

Applied to files:

  • tests/test_gen_cuda_deps.py
📚 Learning: 2026-07-27T22:07:22.590Z
Learnt from: binaryaaron
Repo: NVIDIA-NeMo/Safe-Synthesizer PR: 673
File: tests/pii_replacer/test_edit.py:327-327
Timestamp: 2026-07-27T22:07:22.590Z
Learning: When tests read structured logging context from Python `logging.LogRecord` instances, don’t access `record.ctx` directly (it isn’t declared on `LogRecord` and will break static typing). Instead, use `getattr(record, "ctx", default)` (or an appropriate fallback) to safely handle cases where `ctx` may or may not be attached. This applies even if Ruff rule `B009` isn’t enabled in the repo.

Applied to files:

  • tests/test_gen_cuda_deps.py
🔇 Additional comments (16)
pyproject.toml (1)

12-79: LGTM!

Also applies to: 171-184, 231-291, 341-342

tests/test_gen_cuda_deps.py (2)

1-174: LGTM!

Also applies to: 191-213


235-308: LGTM!

Also applies to: 354-364, 389-452

.github/workflows/README.md (1)

121-122: LGTM!

Also applies to: 137-137

AGENTS.md (1)

32-32: LGTM!

CONTRIBUTING.md (1)

33-33: LGTM!

Also applies to: 560-567, 593-597

docs/developer-guide/docker.md (1)

60-61: LGTM!

ruff.toml (1)

30-30: LGTM!

Also applies to: 42-44, 61-76, 91-93

dprint.json (1)

1-11: LGTM!

STYLE_GUIDE.md (1)

828-829: LGTM!

README.md (1)

43-43: LGTM!

.mise.toml (1)

9-10: LGTM!

Also applies to: 29-30, 38-44

.mise/tasks/docs.toml (1)

18-19: LGTM!

.mise/tasks/setup.toml (1)

7-10: LGTM!

.mise/tasks/tests.toml (2)

31-37: LGTM!

Also applies to: 73-77, 88-90, 96-98, 103-118, 132-143


92-92: 🎯 Functional Correctness

No duplicate TOML table headers here.
["test:e2e:dp"], ["test:e2e:collect"], and ["test:nss-config-dataset"] each appear once, so this file should still parse normally.

			> Likely an incorrect or invalid review comment.

Comment thread pyproject.toml
Comment thread tests/test_gen_cuda_deps.py Outdated
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
binaryaaron and others added 3 commits July 29, 2026 15:16
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
Addresses PR #655 review comments: scope CPU torch/torchaudio/torchvision
sources to Linux, skip rewriting an unchanged pyproject.toml, drop unused
structlog dependency and dead GenStatus.error, use Pydantic's frozen model
config instead of mixing in @DataClass, match the script's Python range to
the repo, and run the lock-check generator call offline.

Also simplifies tools/gen_cuda_deps.py: drop the PEP 723 inline-script
metadata block in favor of running against the repo venv, fix a marker
duplication bug in the generated-block stripping logic (surfaced while
dropping that block), fold single-caller helpers into their only callers
(_render_template, GeneratedBlocks' position finders), derive the uv source
marker from sys_platform/arch instead of hand-duplicating it in
cuda_deps.toml, and move CudaVariantUvRouter's index-resolution methods onto
CudaVariantContext to remove multi-hop reaches through it. Reworks the test
fixtures to use structural TOML mutation instead of brittle string-replace
against a shared blob, and extracts duplicated expected-output constants.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
…tion

pyproject.toml's CPU/CUDA sections are now generated from cuda_deps.toml,
but AGENTS.md never mentioned this, docs/developer-guide/docker.md still
told contributors to hand-edit pyproject.toml for a new variant, and
.agents/skills/uv-build/SKILL.md contradicted its own generated-section
warning with a stale "edit extras manually in pyproject.toml" convention
and a --script invocation that no longer works now that the generator
dropped its inline PEP 723 metadata.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
Comment thread cuda_deps.toml
Comment on lines +95 to +98
[cuda_indexes.flashinfer]
name = "flashinfer-jit-cache"
url = "https://flashinfer.ai/whl/{extra}"
explicit = true

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.

P1 The flashinfer index has a static name but a per-variant url template. With only cu129 today this is fine, but the moment a second CUDA variant is added in the stacked PRs (#656, #657), _add_index will raise Conflicting uv index definition for 'flashinfer-jit-cache' because cu129 maps the name to https://flashinfer.ai/whl/cu129 and the new variant would map the same name to a different URL. The test fixture correctly uses name = "flashinfer-{extra}" for the multi-variant case; the real config should match that pattern.

Suggested change
[cuda_indexes.flashinfer]
name = "flashinfer-jit-cache"
url = "https://flashinfer.ai/whl/{extra}"
explicit = true
[cuda_indexes.flashinfer]
name = "flashinfer-jit-cache-{extra}"
url = "https://flashinfer.ai/whl/{extra}"
explicit = true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4e0d64a3. The default FlashInfer index name now includes {extra}, producing flashinfer-jit-cache-cu129 and unique names for future variants. I regenerated pyproject.toml and added repository-config assertions for the source mapping and URL.

Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
@binaryaaron
binaryaaron force-pushed the binaryaaron/cuda13/dependency-manifest branch from 7cf5c58 to 1abd6df Compare July 29, 2026 15:36
@coderabbitai coderabbitai Bot added feature New feature or request and removed refactor Internal restructuring with no behavior change labels Jul 29, 2026
mckornfield
mckornfield previously approved these changes Jul 29, 2026
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
@coderabbitai coderabbitai Bot added refactor Internal restructuring with no behavior change and removed feature New feature or request labels Jul 29, 2026
@binaryaaron
binaryaaron added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 3c2cc62 Jul 29, 2026
25 checks passed
@binaryaaron
binaryaaron deleted the binaryaaron/cuda13/dependency-manifest branch July 29, 2026 18:04
andrewwhitecdw pushed a commit to andrewwhitecdw/Safe-Synthesizer that referenced this pull request Aug 13, 2026
# Summary

Removes two `[[indexes]]` entries from `cuda_deps.toml` (and the
regenerated
`pyproject.toml` block) that the resolver cannot reach:

- `nv-shared-pypi-local` ->
`https://urm.nvidia.com/artifactory/api/pypi/nv-shared-pypi-local/simple`
- `nvidia-pypi-public` -> `https://pypi.nvidia.com`

Both have been declared since the initial commit, carried over when the
project
moved off NVIDIA's internal GitLab, and copied verbatim into
`cuda_deps.toml`
by NVIDIA-NeMo#655.

## Why they are inert

Both are `explicit = true`, which in uv means the index is consulted
*only* for
packages that name it in `[tool.uv.sources]`. No package names either
one:

```
index -> packages bound via [tool.uv.sources]
  pytorch-cu129                ['-', 'cu129']
  flashinfer-jit-cache-cu129   ['cu129']
  pytorch-cpu                  ['cpu']
  nv-shared-pypi-local         NOT IN SOURCES
  nvidia-pypi-public           NOT IN SOURCES
  flashinfer-cubin             ['cpu', 'cu129']
  vllm-v0-26-0-cu129           ['cu129']
```

Every `nvidia-*` package in the lock resolves from PyPI or
`download.pytorch.org` instead.

## This does not stop pypi.nvidia.com being used

Worth stating explicitly, since it looks contradictory in the lock:
`nvidia-cublas-cu12` is resolved from the PyTorch cu129 index but its
wheels are
*hosted* on `pypi.nvidia.com` — PyTorch's index links to NVIDIA's host
rather
than rehosting the artifacts.

```toml
[[package]]
name = "nvidia-cublas-cu12"
source = { registry = "https://download.pytorch.org/whl/cu129" }
wheels = [
    { url = "https://pypi.nvidia.com/nvidia-cublas-cu12/..." },
]
```

That download follows the URL recorded in `uv.lock` and is unaffected by
whether the index is declared here.

## Verification

Regenerating and relocking leaves `uv.lock` **byte-identical** across
all 356
packages — the strongest available evidence that neither index
participated in
resolution:

```
$ python tools/gen_cuda_deps.py cuda_deps.toml --pyproject pyproject.toml
$ uv lock
Resolved 356 packages in 2ms
$ git diff --quiet uv.lock && echo "byte-identical"
byte-identical
```

- `mise run lock-check` passes
- `mise run format-check` passes
- `pytest tests/test_gen_cuda_deps.py` -- 19 passed

## Notes for reviewers

Two places still mention these names; neither is affected, but flagging
so a
grep does not cause confusion:

- `CONTRIBUTING.md:870` documents that the internal NMP service pulls
`nemo-safe-synthesizer` *from* `nv-shared-pypi-local`. That is about how
NMP
consumes this package, not how this project resolves its own
dependencies, so
  it is unaffected.
- `tests/test_gen_cuda_deps.py` uses `nvidia-pypi-public` in inline
fixture data
to exercise the generator's `index =` binding support. The generator
still
  supports it; the real config just does not use it. If binding
`nvidia-cublas` to that index was intended at some point, that would be
a
deliberate change (re-adding `index = "nvidia-pypi-public"` to the
cublas
  entry) rather than a reason to keep an orphaned declaration.

## Pre-Review Checklist

- [x] `mise run format && mise run check`
- [x] `mise run test` passes locally (targeted:
`tests/test_gen_cuda_deps.py`)

## Other Notes

Config-only change. No dependency versions change and `uv.lock` is
untouched.

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

## Summary by CodeRabbit

* **Chores**
* Updated package installation configuration by removing two obsolete
package sources.
* Existing package indexes and CUDA-related configuration remain
unchanged.
  * No user-facing functionality or public APIs were changed.

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

Signed-off-by: Yunfeng Zhang <yunzhang@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build-dist area:ci area:dev-ex Affects build or dev experience area:docs area:tests refactor Internal restructuring with no behavior change test Test-only addition or change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants