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
4.7 KB
Raw Blame
[build-system]
requires = ["maturin>=1.9,<2.0"]
build-backend = "maturin"

[project]
name = "nemo-switchyard"
version = "0.4.0a1"
description = "Typed, composable LLM routing with request/response translation and multi-backend orchestration"
readme = "crates/switchyard-py/pypi.md"
license = "Apache-2.0"
requires-python = ">=3.10"
authors = [{ name = "NVIDIA Corporation" }]
maintainers = [{ name = "NVIDIA Corporation" }]
keywords = ["llm", "switchyard", "routing", "openai", "nemo"]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "Operating System :: OS Independent",
    "Programming Language :: Python :: 3 :: Only",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: 3.14",
    "Topic :: Software Development :: Libraries :: Python Modules",
]

dependencies = []

# Dev tooling lives in a PEP 735 dependency group rather than an optional
# extra so it is not advertised in the published wheel's METADATA. This
# keeps pytest / ruff / mypy / pygments-via-pytest out of downstream
# vulnerability scans, since they're never installed by `pip install
# nemo-switchyard`.
#
# Install dev tooling with `uv sync` (the `dev` group is uv's default and
# is installed automatically) or `uv sync --group dev` to be explicit.
# With pip >= 25.1, use `pip install --group dev .` from a checkout.
[dependency-groups]
dev = [
    "maturin>=1.9,<2.0",
    "pytest>=9.0.3,<10.0",
    "pytest-asyncio>=1.3.0,<2.0",
    "pyyaml>=6.0.3,<7.0",
    "pytest-timeout>=2.4.0,<3.0",
    "ruff>=0.15.12,<1.0",
    "mypy>=1.20.2,<2.0",
    "tomli>=2.0,<3.0 ; python_version < '3.11'",
    # Harbor is needed only for local evaluation runs and currently requires Python 3.12.
    # Package users and Python 3.10/3.11 contributors do not install it.
    "harbor @ git+https://github.com/harbor-framework/[email protected] ; python_version >= '3.12'",
    "pytest-markdown-docs>=0.9.2",
]
docs = [
    "mkdocs>=1.6.0,<2.0",
    "mkdocs-material>=9.5.0,<10.0",
    "watchdog>=4.0.0,<5.0",
]

[tool.uv]
managed = true

[project.urls]
Homepage = "https://github.com/NVIDIA-NeMo/Switchyard"
Documentation = "https://nvidia-nemo.github.io/Switchyard/"
Repository = "https://github.com/NVIDIA-NeMo/Switchyard"
Issues = "https://github.com/NVIDIA-NeMo/Switchyard/issues"

[tool.setuptools.packages.find]
where = ["."]
include = ["switchyard*"]

[tool.setuptools.package-data]
switchyard = [
    "py.typed",
]
switchyard_rust = ["py.typed", "*.pyi"]

[tool.maturin]
manifest-path = "crates/switchyard-py/Cargo.toml"
module-name = "switchyard_rust._switchyard_rust"
python-source = "."
python-packages = ["switchyard", "switchyard_rust"]
include = [
    { path = "LICENSE", format = "sdist" },
    { path = "NOTICE", format = "sdist" },
    { path = "rust-toolchain.toml", format = "sdist" },
    { path = "crates/prefill-router/Cargo.toml", format = "sdist" },
    { path = "crates/prefill-router/build.rs", format = "sdist" },
    { path = "crates/prefill-router/python/**/*", format = "sdist" },
    { path = "crates/prefill-router/src/**/*", format = "sdist" },
]

[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
timeout = 120  # Default timeout for all tests (2 minutes)
markers = [
    "integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
    "perf: marks tests as performance benchmarks (deselect with '-m \"not perf\"')",
]
# For integration/production tests, recommend using -x to stop on first failure:
#   pytest tests/offline_production_tests/ -v -x
addopts = "-x"  # Stop on first failure by default (use -o addopts= to override)

[tool.mypy]
python_version = "3.10"
strict = true
files = ["switchyard", "switchyard_rust"]
warn_return_any = true
warn_unused_configs = true
warn_unreachable = true
ignore_missing_imports = true

# Readability
pretty = true
show_error_codes = true
show_column_numbers = true

[tool.pyright]
include = ["switchyard"]
exclude = [
    ".agents",
    ".mypy_cache",
    ".pytest_cache",
    ".ruff_cache",
    ".venv",
    ".worktrees",
    "build",
    "tests",
]
pythonVersion = "3.10"

[tool.ruff]
line-length = 100
target-version = "py310"
exclude = [".agents", ".worktrees"]

[tool.ruff.lint]
select = ["E", "F", "I", "W", "UP", "B", "C4"]
# Keep runtime compatibility aliases and existing generics stable in this
# packaging PR. PEP 695 aliases are not drop-in replacements for public class
# aliases, and `StrEnum` changes enum stringification.
ignore = ["E501", "UP040", "UP042", "UP046", "UP047"]

[tool.ruff.lint.isort]
extra-standard-library = ["tomllib"]
known-first-party = ["switchyard"]