5eb01a0096
The thinking matrix had been running inside make ci all along, which is not what the design claimed. It takes seven minutes, spends 137 real calls, and its criteria are statistical, so a network hiccup fails the build for reasons unrelated to the change under test -- one run died on three consecutive network errors exhausting the source. The project already has the mechanism for this: the slow marker, which addopts excludes by default and the config comments describe as "CI runs it on demand". Marking the matrix slow brings make ci back down from seven minutes to ninety seconds while the matrix stays a merge requirement via -m slow. The design also claimed e2e does not run in CI. It does: make test runs pytest over tests/, e2e included, and the existing smoke tests really call the gateway whenever .env has credentials. Only slow-marked tests are excluded. Both documents now say so. Version sources are pyproject and __init__; a test enforces they agree, and it caught the second one being missed.
79 lines
2.5 KiB
TOML
79 lines
2.5 KiB
TOML
[build-system]
|
||
requires = ["setuptools>=68.0"]
|
||
build-backend = "setuptools.build_meta"
|
||
|
||
[project]
|
||
name = "polygateway"
|
||
version = "1.0.6"
|
||
description = "PolyGateway:实验室统一的大语言模型(LLM/VLM/OCR)调度与中转库——多源、限流、重试、熔断、缓存、遥测"
|
||
requires-python = ">=3.11"
|
||
dependencies = [
|
||
"httpx>=0.27",
|
||
"pydantic>=2.8",
|
||
"pydantic-settings>=2.4",
|
||
# 显式声明(2026-07-20 人类确认): config.py 的多源动态键族直接使用 dotenv_values,
|
||
# 不能只依赖 pydantic-settings 的传递安装
|
||
"python-dotenv>=1.0",
|
||
"loguru>=0.7",
|
||
]
|
||
|
||
[project.optional-dependencies]
|
||
redis = ["redis>=5.0"]
|
||
postgres = ["asyncpg>=0.29"]
|
||
structured = ["json-repair>=0.28"]
|
||
sdk = ["openai>=1.30"]
|
||
dev = [
|
||
"pytest>=8.0",
|
||
"pytest-cov>=5.0",
|
||
"pytest-asyncio>=0.23",
|
||
"ruff>=0.6",
|
||
"radon>=6.0",
|
||
"import-linter>=2.0",
|
||
]
|
||
|
||
[tool.setuptools.packages.find]
|
||
where = ["src"]
|
||
|
||
[tool.pytest.ini_options]
|
||
pythonpath = ["src"]
|
||
testpaths = ["tests"]
|
||
asyncio_mode = "auto"
|
||
# slow(真实等待的时间语义变体,单文件 12-15 分钟)默认排除;
|
||
# 显式 `pytest -m slow` 覆盖(CLI 的 -m 后到优先)。M2 T12 全量跑。
|
||
addopts = "-m 'not slow'"
|
||
markers = [
|
||
"requires_redis: 需要可达的 Redis(无则 skip)",
|
||
"requires_llm: 需要真实 LLM 网关(无则 skip,输出落 tests/outputs/)",
|
||
"slow: 慢速测试(CI 按需跑)",
|
||
]
|
||
|
||
[tool.ruff]
|
||
target-version = "py311"
|
||
line-length = 100
|
||
|
||
[tool.ruff.lint]
|
||
select = ["E", "F", "W", "I", "N", "UP", "B", "A", "C4", "SIM", "TCH"]
|
||
ignore = ["E501"]
|
||
|
||
[tool.ruff.lint.isort]
|
||
known-first-party = ["polygateway"]
|
||
|
||
# 依赖纪律(ARCHITECTURE.md §8):ports/types/errors/streaming 为最内层;
|
||
# middleware 只依赖端口;transports/backends/telemetry/structured/providers/sources
|
||
# 只实现端口且互不依赖;client 是唯一组装层。
|
||
# 注:M1 模块落地前 lint-imports 由 Makefile 门控跳过。
|
||
[tool.importlinter]
|
||
root_packages = ["polygateway"]
|
||
|
||
[[tool.importlinter.contracts]]
|
||
name = "洋葱分层:client → config → middleware → 实现层(互不依赖)→ 叶子 → 内核"
|
||
type = "layers"
|
||
layers = [
|
||
"polygateway.client",
|
||
"polygateway.config",
|
||
"polygateway.middleware",
|
||
"polygateway.transports | polygateway.backends | polygateway.telemetry | polygateway.structured",
|
||
"polygateway.providers : polygateway.sources",
|
||
"polygateway.ports : polygateway.types : polygateway.errors : polygateway.streaming",
|
||
]
|