6b5f53a0fd
交付文件: - config.py: 配置管理 (SidecarConfig + load_config),修复 PEP 563 类型推断 bug - rate_limiter.py: 令牌桶 (TokenBucket) + 网关识别 (is_nvidia_gateway) - priority_queue.py: 四级优先级队列,修复 PASSTHROUGH 语义 bug - server.py: FastAPI 代理主入口,修复 worker_loop 重试悬挂 bug - __init__.py: 包声明与公开导出 - pyproject.toml: 依赖声明 + mypy 配置 - README.md: 快速启动指南 + 环境变量列表 评审修复: - worker_loop 令牌重试从重入队改为 poll-wait (防止 future 悬挂) - 路由函数 + lifespan 补充返回类型注解 - heapq 重复 import 移到文件顶部 - config.py 清理无用代码行 - types-PyYAML stub 安装 - 新增 README.md 验证: mypy 0 issues, 全量单元测试通过 Co-authored-by: multica-agent <github@multica.ai>
41 lines
874 B
TOML
41 lines
874 B
TOML
[project]
|
|
name = "nvidia_sidecar"
|
|
version = "0.1.0"
|
|
description = "NVIDIA Sidecar 限流代理 — 为 NVIDIA API 提供优先级排队 + 令牌桶限流"
|
|
readme = "README.md"
|
|
license = { text = "MIT" }
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"fastapi>=0.115",
|
|
"uvicorn[standard]>=0.34",
|
|
"httpx>=0.28",
|
|
"PyYAML>=6.0",
|
|
"structlog>=24.4",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.3",
|
|
"pytest-asyncio>=0.24",
|
|
"httpx>=0.28",
|
|
"mypy>=1.14",
|
|
]
|
|
|
|
[project.scripts]
|
|
nvidia-sidecar = "nvidia_sidecar.server:main"
|
|
|
|
[build-system]
|
|
requires = ["setuptools>=75", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["."]
|
|
|
|
[tool.mypy]
|
|
python_version = "3.12"
|
|
strict = true
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
[[tool.mypy.overrides]]
|
|
module = "structlog.*"
|
|
ignore_missing_imports = true |