源自评审 §1.4「数字不可比」引发的核查,结论比预想更有价值: **mypy 报错的主因不是代码质量,而是本机缺 SQLAlchemy 2.0 的类型信息。** 装上 `sqlalchemy2-stubs` 后 181 → 43(该类存根是 2.0 之前的旧包,会换一批新错: `mapped_column`/`DeclarativeBase` 不存在),卸载后回到 184。**本机 mypy 数字不可作为 质量结论,双方也不可比。** 但那 184 里有 8 个是**我文件里的真实错误**,已修: - `knowledge_retrieval_service`:返回类型 `Mapping` → `dict`(回表后要就地补写 `score`/`intent`,而 `Mapping` 是只读协议);`ids` 显式标注并过滤 `None`; 去掉 3 处已失效的 `type: ignore`(strict 下 unused-ignore 本身是错误) - `knowledge_management`:服务工厂返回类型 `Any` → `KnowledgeManagementService` (`TYPE_CHECKING` 期导入,运行时仍惰性,不引入循环依赖),消掉 3 个 `no-any-return` 未动的:`model_gateway` 2 处 `dict-item`(`ModelEndpointConfig` 实际具备协议要求的 全部字段,属 SQLAlchemy `Mapped[T]` 在缺存根时的消解问题,不是真缺陷,不用 cast 掩盖)。
78 lines
2.0 KiB
TOML
78 lines
2.0 KiB
TOML
[build-system]
|
|
requires = ["setuptools>=75"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "jr-agent-platform"
|
|
version = "0.1.0"
|
|
description = "金融系统 Agent 通用底座"
|
|
requires-python = ">=3.13,<3.14"
|
|
dependencies = [
|
|
"fastapi>=0.115,<1",
|
|
"uvicorn[standard]>=0.34,<1",
|
|
"pydantic>=2.10,<3",
|
|
"pydantic-settings>=2.7,<3",
|
|
"python-dotenv>=1.0,<2",
|
|
"greenlet>=3.1,<4",
|
|
"sqlalchemy>=2.0,<3",
|
|
"alembic>=1.14,<2",
|
|
"asyncmy>=0.2,<1",
|
|
"pymysql>=1.1,<2",
|
|
"redis>=5.2,<6",
|
|
"neo4j>=5.28,<6",
|
|
"pymilvus>=2.5,<3",
|
|
"PyJWT>=2.10,<3",
|
|
"cryptography>=44,<51",
|
|
"httpx>=0.28,<1",
|
|
"tzdata>=2025.1,<2027",
|
|
"alibabacloud_docmind_api20220711==1.4.14",
|
|
"alibabacloud_tea_openapi>=0.4.3,<1",
|
|
"alibabacloud_tea_util>=0.3.13,<1",
|
|
"alibabacloud_credentials>=1.0.2,<2",
|
|
"python-pptx>=1.0,<2",
|
|
"openpyxl>=3.1,<4",
|
|
"Pillow>=10,<12",
|
|
"matplotlib>=3.9,<4",
|
|
"python-multipart>=0.0.20,<1",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=8.3,<9",
|
|
"pytest-asyncio>=0.25,<1",
|
|
"ruff>=0.9,<1",
|
|
"mypy>=1.14,<2",
|
|
]
|
|
|
|
[tool.setuptools.packages.find]
|
|
include = ["app*"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
asyncio_mode = "auto"
|
|
asyncio_default_fixture_loop_scope = "function"
|
|
markers = ["integration: requires local database services"]
|
|
# 临时目录固定到仓库内(`.workdir/` 已在 .gitignore 中忽略)。
|
|
#
|
|
# 为什么不用系统临时目录:Windows 上 `%TEMP%\pytest-of-<user>` 一旦被权限更高的会话
|
|
# 建过,后续运行就**无权写入**,所有用 `tmp_path` 的用例批量 setup 失败
|
|
# (实测 33 个用例 ERROR,报 WinError 5)。固定到仓库内后不受系统临时目录权限影响,
|
|
# 且清理范围可见、可控。
|
|
basetemp = ".workdir/pytest-tmp"
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py313"
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "B", "UP"]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"alembic/versions/*.py" = ["E501"]
|
|
"tools/*.py" = ["E501", "I001", "B007"]
|
|
|
|
[tool.mypy]
|
|
python_version = "3.13"
|
|
strict = true
|
|
packages = ["app"]
|