-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathpyproject.toml
More file actions
217 lines (192 loc) · 6.9 KB
/
Copy pathpyproject.toml
File metadata and controls
217 lines (192 loc) · 6.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
[build-system]
requires = ["maturin>=1.9,<2.0"]
build-backend = "maturin"
[project]
name = "nemo-switchyard"
version = "0.1.0"
description = "Typed, composable LLM routing with request/response translation and multi-backend orchestration"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.12"
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.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
]
# Core dependencies — minimal set for the foundation library (core/ + recipes/).
# No server, CLI, ML, GPU, or orchestrator packages.
# Users install extras based on their use case:
# pip install nemo-switchyard # Core + recipes only
# pip install nemo-switchyard[server] # Add FastAPI/Uvicorn for e2e
# pip install nemo-switchyard[cli] # Add prompt-toolkit for CLI
# pip install nemo-switchyard[all] # Everything
dependencies = [
"openai>=2.34.0,<3.0",
"anthropic>=0.99.0,<1.0",
"httpx>=0.28.1,<1.0",
"pydantic>=2.13.3,<3.0",
]
[project.optional-dependencies]
# Server dependencies — FastAPI + Uvicorn for e2e users who want to run
# switchyard as a proxy. Not needed for library-only usage.
server = [
"fastapi>=0.136.1,<1.0",
"uvicorn[standard]>=0.46.0,<1.0",
"sse-starlette>=3.4.1,<4.0",
]
# CLI dependencies — prompt-toolkit for Claude Code launcher and ShellTUI.
# Only needed for users running the switchyard CLI.
cli = [
"prompt-toolkit>=3.0.52,<4.0",
]
# Tracing — ddtrace for Datadog APM spans on the proxy routing path
# Optional: ``switchyard.lib.tracing`` no-ops when ddtrace is not
# importable, so the default install and non-Datadog deployments are unaffected
# and pay no overhead.
tracing = [
"ddtrace>=2.9,<4",
]
# Intake — NeMo Platform SDK required by IntakeClient for telemetry capture.
# Only needed when --intake-enabled is passed to ``switchyard launch``.
# Install with: pip install nemo-switchyard[intake]
intake = [
"nemo-platform>=0.1.0,<1.0",
]
# Shared session-affinity pin store. redis-py ships ``redis.asyncio`` natively,
# so no separate async client is needed. Lazy-imported by
# ``switchyard.lib.redis_pin_store`` — the default install never pulls it in.
# Floor 5.0.1: first release with ``aclose()`` on async clients, which the
# store's shutdown path calls.
affinity-redis = [
"redis>=5.0.1,<6",
]
# Everything — all optional dependencies for full-featured deployment.
all = [
"nemo-switchyard[server,cli,tracing,intake,affinity-redis]",
]
# 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` or any of the user-facing extras above.
#
# 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",
"pytest-cov>=7.1.0,<8.0",
"pytest-mock>=3.15.1,<4.0",
"pytest-timeout>=2.4.0,<3.0",
"respx>=0.23.1,<1.0",
"ruff>=0.15.12,<1.0",
"mypy>=1.20.2,<2.0",
"httpx>=0.28.1,<1.0",
"socksio>=1.0.0,<2.0",
"prometheus-client>=0.21.0,<1.0",
# Harbor is needed for local evaluation runs and supports the package floor.
# Package users still do not see it in published metadata.
"harbor @ git+https://github.com/harbor-framework/harbor.git@v0.6.4 ; python_version >= '3.12'",
"nemo-switchyard[server]",
"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.scripts]
switchyard = "switchyard.cli.switchyard_cli:main"
[project.urls]
Homepage = "https://github.com/NVIDIA-NeMo/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",
"lib/processors/prompts/*.md",
"lib/processors/stage_router/prompts/*.md",
]
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" },
]
[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 --no-x to override)
[tool.mypy]
python_version = "3.12"
strict = true
files = ["switchyard", "switchyard_rust"]
warn_return_any = true
warn_unused_configs = true
warn_unreachable = true
ignore_missing_imports = true
# Problem 2 scoreboard: every `data: Any` annotation is a tracked error.
# 303 violations today — each one fixed = one step toward typed chain.
# Disabled for open-source release; can be re-enabled as part of gradual typing effort.
# disallow_any_explicit = true
# Readability
pretty = true
show_error_codes = true
show_column_numbers = true
# TODO: enable after Phase 6 migration (3,271 violations today)
# disallow_any_expr = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[tool.pyright]
include = ["switchyard"]
exclude = [
".agents",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".venv",
".worktrees",
"build",
"tests",
]
pythonVersion = "3.12"
[tool.ruff]
line-length = 100
target-version = "py312"
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]
known-first-party = ["switchyard"]