Skip to content

fix(python): avoid a runtime typing_extensions dependency - #705

Merged
ayushag-nv merged 1 commit into
mainfrom
nachiketb/fix-python-server-import
Sep 15, 2026
Merged

ayushag-nv merged 1 commit into
mainfrom
nachiketb/fix-python-server-import

Conversation

@nachiketb-nvidia

@nachiketb-nvidia nachiketb-nvidia commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What

  • Load typing_extensions.Self only while type checking.
  • Make the existing slim-install and release-wheel smoke checks import the native Server entry point.

Why

A clean default install has no typing_extensions runtime dependency, but switchyard_rust.server imported it unconditionally. This made the supported server entry point fail before the native module could load.

Validation

  • Clean isolated install and Server import on Python 3.10 with typing_extensions absent.
  • Clean isolated install and Server import on Python 3.14 with typing_extensions absent.
  • uv run ruff check switchyard_rust/server.py
  • uv run mypy switchyard_rust/server.py
  • Repository pre-commit hooks.

Fixes SWITCH-1425.

Summary by CodeRabbit

  • Bug Fixes
    • Improved runtime loading for the server component by avoiding an unnecessary typing-related dependency during execution.
  • Tests
    • Expanded installation and wheel smoke tests to verify that the server component can be imported successfully across supported Python versions.

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia requested a review from a team as a code owner September 15, 2026 18:52
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: 62a6cc3c-2795-4972-988f-55da166817fb

📥 Commits

Reviewing files that changed from the base of the PR and between 3807ff0 and 28c3c39.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml
  • switchyard_rust/server.py

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


Walkthrough

The change removes the runtime typing_extensions import from server.py. Slim-install and wheel smoke tests now import and print switchyard_rust.server.Server for Python 3.10 and 3.14.

Changes

Server import validation

Layer / File(s) Summary
Runtime import handling
switchyard_rust/server.py
load_native is imported unconditionally. Self is imported from typing_extensions only during type checking.
Smoke-test Server checks
.github/workflows/ci.yml, .github/workflows/publish.yml
Slim-install and wheel smoke tests import and print switchyard_rust.server.Server for Python 3.10 and 3.14.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 28c3c

The supported Server entry point avoids the runtime typing dependency and is covered by matching slim-install and wheel smoke checks.

🚥 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 clearly and concisely describes the main change: removing the runtime dependency on typing_extensions from the Python server import path.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.

A rabbit checks the server door
Imports hop cleanly as before
Slim wheels print the class with pride
Type hints wait on the checking side
Four small tests now spring outside

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

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

Lgtm

@ayushag-nv
ayushag-nv merged commit cbb0257 into main Sep 15, 2026
18 checks passed
@ayushag-nv
ayushag-nv deleted the nachiketb/fix-python-server-import branch September 15, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants