Skip to content

fix: align Python public API declarations - #1625

Merged
ericevans-nv merged 1 commit into
NVIDIA:release/0.11from
ericevans-nv:fix/python-public-declarations
Nov 3, 2026
Merged

ericevans-nv merged 1 commit into
NVIDIA:release/0.11from
ericevans-nv:fix/python-public-declarations

Conversation

@ericevans-nv

@ericevans-nv ericevans-nv commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Python’s type declarations reject supported logging calls, file-sink configuration, and request-property access while allowing an unsupported stream await. Align the declarations with the existing API so valid code type-checks and unsupported stream awaiting is caught before execution.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Declare the six public logging helpers with their existing signatures.
  • Accept both endpoint and file configurations in the OpenTelemetrySubscriber constructor declaration.
  • Declare thirteen existing AnnotatedLLMRequest properties with getter and setter types, including support for clearing values to None.
  • Remove unsupported LlmStream.__await__ and clarify stream creation, iteration, and awaited close.
  • Add five consumer-typing regression cases covering supported calls and rejection of an extra stream await.

The changes preserve execution behavior.

Validation passed:

  • Focused consumer regressions: 5 passed.
  • just test-python: 86 native tests, 1,337 Python tests, and 24 example tests passed.
  • All applicable commit hooks passed, including formatting, type checking, documentation link checking, and dependency audits.

Where should the reviewer start?

Start with the consumer regressions, then compare the public logging declarations and native API declarations.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

Summary by CodeRabbit

  • New Features
    • Expanded Python type support for logging helpers, request options, and OpenTelemetry subscriber configurations.
  • Updates
    • Stream typing now reflects managed streaming execution and async iteration; directly awaiting a stream is no longer supported by the declared type contract.
  • Tests
    • Added type-contract checks for logging, request properties, telemetry configurations, and stream usage.

@ericevans-nv
ericevans-nv requested review from a team as code owners November 3, 2026 20:32
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The Python type stubs now describe six logging helpers, thirteen request properties, both subscriber configuration types, and supported stream operations. Consumer type-check tests cover valid calls and reject awaiting a stream.

Changes

Python API type contracts

Layer / File(s) Summary
Align public declarations with supported APIs
python/nemo_relay/__init__.pyi, python/nemo_relay/_native.pyi, python/tests/test_public_type_contracts.py
The stubs add logging and request-property declarations, accept endpoint and file-sink subscriber configurations, and remove the LlmStream.__await__ declaration. Consumer tests check supported calls and properties, stream iteration and closure, and rejection of awaiting a stream.

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to c5e9b

The API declaration changes align with the supported runtime behavior and introduce no established merge-blocking risk.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title uses the allowed type "fix" with a colon and a 41-character imperative summary, and it matches the changeset, which aligns Python public API declarations (logging helpers, OpenTelemetry subs…
Description check Passed The description follows the repository template: it has an Overview with both checklist items checked, a Details section listing the declaration and test changes, a Where should the reviewer start sec…
Linked Issues check Passed Issue #1624 is the only active direct target. Its requirements are coding requirements (declaration alignment and consumer typing), and they are met by the reviewed head. Evidence: (1) The raw summary…
Out of Scope Changes check Passed The whole-PR merge base is 0ea21a5. Repository history at head shows one PR commit, c5e9bd2 'fix: align Python public API declarations', on top of that base. The earlier out-of-scope changes are no lo…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title uses the allowed type "fix" with a colon and a 41-character imperative summary, and it matches the changeset, which aligns Python public API declarations (logging helpers, OpenTelemetry subscriber config, AnnotatedLLMRequest properties, LlmStream). It has no scope and no breaking-change marker, which the format allows.

Full details: Description check

Explanation

The description follows the repository template: it has an Overview with both checklist items checked, a Details section listing the declaration and test changes, a Where should the reviewer start section with file links, and a Related Issues section using the Closes keyword with issue #1624. It also gives validation results. The template's Overview placeholder is replaced with a clear summary.

Full details: Linked Issues check

Explanation

Issue #1624 is the only active direct target. Its requirements are coding requirements (declaration alignment and consumer typing), and they are met by the reviewed head. Evidence: (1) The raw summary and PR description show six logging helpers (log, trace, debug, info, warn, error) declared in python/nemo_relay/init.pyi with keyword-only target and fields. (2) OpenTelemetrySubscriber.init in python/nemo_relay/_native.pyi accepts OpenTelemetryConfig | OpenTelemetryFileSinkConfig. (3) Thirteen AnnotatedLLMRequest properties (store, previous_response_id, truncation, reasoning, include, user, metadata, service_tier, parallel_tool_calls, max_output_tokens, max_tool_calls, top_logprobs, stream) have getters and setters, and the PR states that setters accept None. (4) LlmStream.await is removed. The test file python/tests/test_public_type_contracts.py was read at head. It runs ty check on consumer files without # ty: ignore suppressions and covers logging helpers, subscriber configurations, request properties, and stream iteration and aclose. A separate test requires awaiting a stream to fail with only an invalid-await diagnostic and exit code 1. Execution behavior is not changed by this commit, which touches only declarations and tests. Limits: the whole-PR text diff could not be read because changed blobs were unavailable. The pyi declarations were verified from the summary and PR description, not from source text. The constructor ordering and requiredness work in #1621 is not in scope, and the commit makes no change to it.

Full details: Out of Scope Changes check

Explanation

The whole-PR merge base is 0ea21a5. Repository history at head shows one PR commit, c5e9bd2 'fix: align Python public API declarations', on top of that base. The earlier out-of-scope changes are no longer in this PR. The finalizer propagation change (#1617, ac5943a), the observability constructor ordering change (#1622, 0ea21a5), and the log context retention change (#1619) are ancestors of the merge base. They are not changes introduced by this PR. The changed files listed in the raw summary are python/nemo_relay/init.pyi, python/nemo_relay/_native.pyi, and python/tests/test_public_type_contracts.py. Each change maps to a #1624 objective: declarations for logging helpers, subscriber configurations, request properties, and stream await rejection, plus consumer regression tests. The previous FAIL findings concerned runtime finalizer changes and observability field ordering from an earlier PR base. They do not apply to the current merge base and head. Limit: the full text diff could not be read, so the file list comes from the AI-generated summary and commit history.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ffb724b and c5e9bd2.

Files selected for processing: 1
  • python/nemo_relay/_native.pyi

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

Recent review details
Context from checks skipped due to timeout: 4
  • GitHub Check: Prepare
  • GitHub Check: Detect docs changes
  • GitHub Check: Apply PR labels
  • GitHub Check: request / require-nvskills-ci / require-nvskills-ci
Additional context used
Code guidelines: 1
CLAUDE.md — configured
Path-based instructions: 2
Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.

CodeRabbit configuration file

Files:

  • python/nemo_relay/_native.pyi
Source excerpt: A public or observable runtime change requires identifying which bindings expose the affected contract.

CodeRabbit inference engine (CLAUDE.md)

Files:

  • python/nemo_relay/_native.pyi
Additional comments: 2
python/nemo_relay/_native.pyi: 2

1261-1263: LGTM!

1425-1426: LGTM!

@github-actions github-actions Bot added size:L PR is large Bug issue describes bug; PR fixes bug lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Nov 3, 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.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread crates/core/src/stream.rs Resolved
@ericevans-nv
ericevans-nv force-pushed the fix/python-public-declarations branch from ffb724b to c5e9bd2 Compare November 3, 2026 20:37
@willkill07 willkill07 added this to the 0.11 milestone Nov 3, 2026
@github-actions github-actions Bot added size:M PR is medium and removed size:L PR is large lang:rust PR changes/introduces Rust code labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ericevans-nv
ericevans-nv merged commit d5c024d into NVIDIA:release/0.11 Nov 3, 2026
46 of 47 checks passed

This branch was previously deployed

1 inactive deployment
fern — c5e9bd27 Deployed Nov 3, 2026 by ericevans-nv via Clean up docs preview #6956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug issue describes bug; PR fixes bug lang:python PR changes/introduces Python code size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants