Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust

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

nachiketb-nvidiacbb0257a44f2
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4c81b7493..0a87ffcca 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -215,10 +215,10 @@ jobs:
run: |
uv run --isolated --no-project --python 3.10 \
--with "${SWITCHYARD_DEFAULT_PACKAGE}" \
- python -c "import switchyard; print('import OK, version:', switchyard.__version__)"
+ python -c "import switchyard; from switchyard_rust.server import Server; print('import OK, version:', switchyard.__version__, 'server:', Server)"
uv run --isolated --no-project --python 3.14 \
--with "${SWITCHYARD_DEFAULT_PACKAGE}" \
- python -c "import switchyard; print('import OK, version:', switchyard.__version__)"
+ python -c "import switchyard; from switchyard_rust.server import Server; print('import OK, version:', switchyard.__version__, 'server:', Server)"
- name: Assert heavy packages absent from slim install
working-directory: /tmp
run: |
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 10998f2d3..d3c631681 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -272,10 +272,12 @@ jobs:
import switchyard
import switchyard_rust
from switchyard_rust import _switchyard_rust
+ from switchyard_rust.server import Server
print("switchyard", switchyard.__version__)
print("switchyard_rust", switchyard_rust.__file__)
print("rust extension", _switchyard_rust.__name__)
+ print("server", Server)
PY
- uses: actions/setup-python@v5
if: ${{ matrix.smoke }}
@@ -299,10 +301,12 @@ jobs:
import switchyard
import switchyard_rust
from switchyard_rust import _switchyard_rust
+ from switchyard_rust.server import Server
print("switchyard", switchyard.__version__)
print("switchyard_rust", switchyard_rust.__file__)
print("rust extension", _switchyard_rust.__name__)
+ print("server", Server)
PY
- uses: actions/upload-artifact@v4
with:
diff --git a/switchyard_rust/server.py b/switchyard_rust/server.py
index 87b67320d..23824a664 100644
--- a/switchyard_rust/server.py
+++ b/switchyard_rust/server.py
@@ -6,11 +6,10 @@
from os import PathLike
from typing import TYPE_CHECKING, Any, final
-from typing_extensions import Self
-
from switchyard_rust._native import load_native
if TYPE_CHECKING:
+ from typing_extensions import Self
class ServerConfigError(RuntimeError):
"""Raised when a native server deployment configuration is invalid."""