You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
The API declaration changes align with the supported runtime behavior and introduce no established merge-blocking risk.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
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
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
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
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
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bugissue describes bug; PR fixes buglang:pythonPR changes/introduces Python codesize:MPR is medium
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Details
OpenTelemetrySubscriberconstructor declaration.AnnotatedLLMRequestproperties with getter and setter types, including support for clearing values toNone.LlmStream.__await__and clarify stream creation, iteration, and awaited close.The changes preserve execution behavior.
Validation passed:
just test-python: 86 native tests, 1,337 Python tests, and 24 example tests passed.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