Skip to content

feat(lint): Upgrade ty - #543

Merged
matthewgrossman merged 8 commits into
mainfrom
mgrossman/GENERIC2-crud-aircore-827-migrate-first-plugin-to-nemoclient-typed-http-client-files-
Jul 2, 2026
Merged

feat(lint): Upgrade ty#543
matthewgrossman merged 8 commits into
mainfrom
mgrossman/GENERIC2-crud-aircore-827-migrate-first-plugin-to-nemoclient-typed-http-client-files-

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Matthew Grossman mgrossman@nvidia.com

This includes astral-sh/ruff#26479, which helps my nemoclient efforts greatly!

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores
    • Updated the pinned development type-checking tool version.
    • Refreshed the CI-only type-check suppression list to align with the updated tool and existing known issues.
    • Updated the CI type-check command to tolerate warnings (without breaking the pipeline).
  • Type Safety
    • Improved generic type preservation for logging decorators to keep the wrapped class type.
  • Tests
    • Adjusted type-check suppressions in several tests; runtime behavior and assertions are unchanged.

@matthewgrossman
matthewgrossman requested review from a team as code owners July 1, 2026 23:27
@github-actions github-actions Bot added the feat label Jul 1, 2026
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the mgrossman/GENERIC2-crud-aircore-827-migrate-first-plugin-to-nemoclient-typed-http-client-files- branch from 7d134ed to 55d16ef Compare July 1, 2026 23:28
@coderabbitai

coderabbitai Bot commented Jul 1, 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
📝 Walkthrough

Walkthrough

Updates ty to 0.0.56, changes CI lint handling for warnings, and revises inline type-check ignores plus a few typing annotations across SDK, plugins, tests, and services.

Changes

ty Upgrade and CI Linting

Layer / File(s) Summary
ty version and CI linting
pyproject.toml, tools/lint/lint-python-types.sh
ty is bumped in dev dependencies, the CI suppression list is revised, and the lint command adds --exit-zero-on-warning.

SDK Resilience and Tests

Layer / File(s) Summary
Evaluator resilience annotations
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/resilience/api.py, packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/resilience/scheduler.py, packages/nemo_evaluator_sdk/tests/metrics/test_llm_judge.py, packages/nemo_evaluator_sdk/tests/test_agent_inference.py
ty ignores are added to resilience parameter annotations and matching evaluator test call sites.
Platform plugin typing fixes
packages/nemo_platform_plugin/src/nemo_platform_plugin/_spec_flags.py, packages/nemo_platform_plugin/src/nemo_platform_plugin/function.py, packages/nemo_platform_plugin/tests/test_dispatcher.py, packages/nemo_platform_plugin/tests/test_function_context.py, packages/nemo_platform_plugin/tests/test_inference_middleware.py, packages/nemo_platform_plugin/tests/test_job_context.py
Helper functions, decorator metadata, and test call sites expand or add type-ignore comments, with the decorator schema declaration keeping its existing type shape.
Testing client and container import ignores
packages/nmp_testing/src/nmp/testing/client.py, plugins/nemo-agents/src/nemo_agents_plugin/container/builder.py, plugins/nemo-agents/src/nemo_agents_plugin/container/metadata.py, plugins/nemo-agents/src/nemo_agents_plugin/container/publisher.py, tools/mcp-dev-tools/nmp_dev_mcp.py
Generator yields and unresolved imports pick up ty suppressions in the test client, container helpers, and MCP tool import.
Typed logging and service class vars
plugins/nemo-anonymizer/src/nemo_anonymizer_plugin/sdk/logging.py, plugins/nemo-data-designer/src/nemo_data_designer_plugin/sdk/logging.py, plugins/nemo-data-designer/src/nemo_data_designer_plugin/cli/renderers.py, services/studio/src/nmp/studio/service.py
Two logging decorators switch to TypeVar-preserved class typing, renderer calls add extra ignore codes, and StudioService.dependencies becomes a ClassVar.
Docker deployment test ignores
plugins/nemo-deployments/tests/integration/backends/docker/test_docker_backend.py, plugins/nemo-deployments/tests/integration/test_reconcile_docker.py, plugins/nemo-deployments/tests/unit/backends/docker/docker_helpers.py, plugins/nemo-deployments/tests/unit/backends/docker/test_probes.py
Docker deployment configs and probe constructions add unknown-argument suppressions in unit and integration tests.

Possibly related PRs

Suggested labels: fix

Suggested reviewers: mckornfield

🚥 Pre-merge checks | ✅ 5
✅ 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 accurately summarizes the main change: upgrading ty for lint tooling.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mgrossman/GENERIC2-crud-aircore-827-migrate-first-plugin-to-nemoclient-typed-http-client-files-

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

The ty upgrade from 0.0.17 to 0.0.56 catches additional pre-existing
type violations. Add these new error categories to the CI ignore list
with counts, matching the existing pattern for incremental cleanup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 22513/29630 76.0% 60.9%
Integration Tests 13004/28310 45.9% 19.4%

ty 0.0.56 exits non-zero on warnings (unsupported-base,
unused-type-ignore-comment, redundant-cast). Add
--exit-zero-on-warning so only errors fail CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@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.

🧹 Nitpick comments (1)
tools/lint/lint-python-types.sh (1)

38-38: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

--exit-zero-on-warning silences all warnings, not just the three cited.

Per ty docs, this flag makes ty "Use exit code 0 if there are no error-level diagnostics" — i.e. it suppresses CI failure for any warning-level rule, not only unsupported-base, unused-type-ignore-comment, redundant-cast mentioned in the commit message. Future warning-level regressions (in rules not in ci_ignored_rules) will silently pass CI too. Consider --ignore for just those three rules (or --warn demotion) instead of blanket --exit-zero-on-warning, to keep other warnings failing the build.

[reliability_and_availability]

🤖 Prompt for 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.

In `@tools/lint/lint-python-types.sh` at line 38, The ty invocation in
lint-python-types.sh is using a blanket warning suppression flag that lets every
warning-level diagnostic pass CI, not just the three intended rules. Update the
lint command around uv run and ty check to scope suppression only to
unsupported-base, unused-type-ignore-comment, and redundant-cast, using ty’s
per-rule ignore or warn handling instead of --exit-zero-on-warning, so other
warning-level regressions still fail the build.
🤖 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.

Nitpick comments:
In `@tools/lint/lint-python-types.sh`:
- Line 38: The ty invocation in lint-python-types.sh is using a blanket warning
suppression flag that lets every warning-level diagnostic pass CI, not just the
three intended rules. Update the lint command around uv run and ty check to
scope suppression only to unsupported-base, unused-type-ignore-comment, and
redundant-cast, using ty’s per-rule ignore or warn handling instead of
--exit-zero-on-warning, so other warning-level regressions still fail the build.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 476ff565-c22e-4f0b-b895-9fd6b9a6fe60

📥 Commits

Reviewing files that changed from the base of the PR and between 09fb22b and 602b7f9.

📒 Files selected for processing (1)
  • tools/lint/lint-python-types.sh

matthewgrossman and others added 3 commits July 1, 2026 17:46
Instead of adding blanket suppressions for new error categories,
fix each violation individually:

- Fix with_logging decorator in anonymizer/data-designer to preserve
  class types through TypeVar (invalid-type-form)
- Fix StudioService.dependencies to use ClassVar (invalid-attribute-override)
- Add inline ty: ignore comments for false positives and intentional
  test misuse (invalid-paramspec, call-non-callable, unknown-argument,
  missing-argument, empty-body, too-many-positional-arguments,
  invalid-yield, unresolved-import, invalid-type-form)

No new blanket suppressions added to lint-python-types.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Replace `# type: ignore[rule]  # ty: ignore[rule]` with blanket
`# type: ignore` on lines that need both mypy and ty suppression.
Blanket `# type: ignore` is respected by both checkers, eliminating
the need for separate directives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
This reverts commit cd7b6f6.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Comment thread packages/nemo_evaluator_sdk/tests/metrics/test_llm_judge.py Outdated
matthewgrossman and others added 2 commits July 1, 2026 18:45
This repo uses ty, not mypy. Replace redundant dual comments
(# type: ignore[rule]  # ty: ignore[rule]) with just # ty: ignore[rule]
on the 14 lines we touched for the ty upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Run make vendor and make update-cli to sync the evaluator SDK
vendored files with the ty: ignore comment changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman enabled auto-merge July 2, 2026 02:46
@matthewgrossman
matthewgrossman added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit 12bfaff Jul 2, 2026
52 checks passed
@matthewgrossman
matthewgrossman deleted the mgrossman/GENERIC2-crud-aircore-827-migrate-first-plugin-to-nemoclient-typed-http-client-files- branch July 2, 2026 04:32
arpitsardhana pushed a commit that referenced this pull request Jul 9, 2026
* squash
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(lint): suppress new ty 0.0.56 error categories in CI

The ty upgrade from 0.0.17 to 0.0.56 catches additional pre-existing
type violations. Add these new error categories to the CI ignore list
with counts, matching the existing pattern for incremental cleanup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(lint): add --exit-zero-on-warning for ty 0.0.56

ty 0.0.56 exits non-zero on warnings (unsupported-base,
unused-type-ignore-comment, redundant-cast). Add
--exit-zero-on-warning so only errors fail CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(lint): resolve all new ty 0.0.56 errors at source

Instead of adding blanket suppressions for new error categories,
fix each violation individually:

- Fix with_logging decorator in anonymizer/data-designer to preserve
  class types through TypeVar (invalid-type-form)
- Fix StudioService.dependencies to use ClassVar (invalid-attribute-override)
- Add inline ty: ignore comments for false positives and intentional
  test misuse (invalid-paramspec, call-non-callable, unknown-argument,
  missing-argument, empty-body, too-many-positional-arguments,
  invalid-yield, unresolved-import, invalid-type-form)

No new blanket suppressions added to lint-python-types.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(lint): consolidate duplicate type ignore comments

Replace `# type: ignore[rule]  # ty: ignore[rule]` with blanket
`# type: ignore` on lines that need both mypy and ty suppression.
Blanket `# type: ignore` is respected by both checkers, eliminating
the need for separate directives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* Revert "fix(lint): consolidate duplicate type ignore comments"

This reverts commit cd7b6f6.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* fix(lint): use ty: ignore instead of type: ignore

This repo uses ty, not mypy. Replace redundant dual comments
(# type: ignore[rule]  # ty: ignore[rule]) with just # ty: ignore[rule]
on the 14 lines we touched for the ty upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

* chore: sync vendored SDK and CLI after ty ignore cleanup

Run make vendor and make update-cli to sync the evaluator SDK
vendored files with the ty: ignore comment changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

---------

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants