Ctrl K
ComunidadGuías…

pyproject.toml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"

[project]
name = "scout-agent"
version = "1.0.0.6"
description = "Scout Agent — The self-evolving AI agent that grows with you"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "Apache-2.0"}
authors = [{name = "Scout Agent"}]

dependencies = [
    "openai>=1.30.0",
    "pydantic>=2.0.0",
    "pydantic-settings>=2.0.0",
    "httpx>=0.27.0",
    "rich>=13.0.0",
    "prompt_toolkit>=3.0.0",
    # 核心运行必需(代码顶层 import,缺包即 ImportError)
    "click>=8.0.0",
    "croniter>=1.4,<6",
    "python-dotenv>=1.0.0",
    "cryptography>=41.0.0",
    "fastapi>=0.110.0",
    "uvicorn>=0.27.0",
    "websockets>=12.0",
    "sse-starlette>=2.0.0",
    "numpy>=1.24.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=8.0.0",
    "pytest-asyncio>=0.23.0",
    "pytest-cov>=5.0.0",
    "ruff>=0.3.0",
]
# CI/本地跑单元测试所需的运行期可选依赖 —— 刻意不含 full 组里的重型包
# (playwright/streamlit 等),既拖慢安装又非测试所需。
# Pillow: test_gui_cost_optimizations 的截图合成;pywinpty: 让 Windows ConPTY
# 测试在 CI 上真实执行(否则整组 skip,Windows 主平台 PTY 无回归覆盖)。
# aiohttp: scout/voice/asr/openai_asr.py 顶层 import(导入期硬依赖),
#          缺失会让 tests/unit/test_voice.py 在 pytest 收集阶段直接报错。
test = [
    "Pillow>=10.0.0",
    "aiohttp>=3.9.0",
    "pywinpty>=2.0.0; sys_platform == 'win32'",
]
# 高可用基础设施与常用可选功能(与 requirements.txt 全量清单一致;
# 缺包时对应路由/工具/适配器会被按需跳过)
full = [
    "playwright>=1.40.0",
    "psutil>=5.9.0",
    "requests>=2.31.0",
    "streamlit>=1.30.0",
    "aiohttp>=3.9.0",
    "asyncpg>=0.29.0",
    "redis>=5.0.0",
    "nats-py>=2.6.0",
    # 桌面自动化工具(Windows GUI 操控)
    "pywinauto>=0.6.8",
    "Pillow>=10.0.0",
    # PTY 交互式终端 Windows 支持(ConPTY 绑定;仅 Windows,缺失则降级 persistent cmd)
    "pywinpty>=2.0.0; sys_platform == 'win32'",
]
# 平台适配器依赖(可选,按需安装对应渠道)
platforms = [
    "discord.py>=2.3.0",
    # 企业微信/公众号 AES 加解密由主依赖 cryptography 覆盖
    # 个人微信: wechaty / itchat(二选一)
]

[project.scripts]
scout = "scout.cli:main"

[tool.setuptools.packages.find]
include = ["scout*"]

[tool.ruff]
target-version = "py311"
line-length = 100
# 打包产物与第三方资源不纳入 lint(否则 ruff check . 会扫进 build/dist 的副本)
extend-exclude = ["build", "dist", "frontend/node_modules", "scout/web/static/vendor"]

[tool.ruff.lint]
# ── 已验证「当前零违规」的高信号规则集(CI 阻断级)──
# 选规则的原则:能抓真 bug、且存量已清零,避免用噪声规则淹没 CI 信号。
#   E7  语句级问题:裸 except(E722)/分号连写(E702)/歧义变量名(E741,见 ignore)
#   E9  语法与未定义名(E9x 含 E902 编译错误)
#   F   pyflakes:未定义名(F821)、重复定义(F811)、f-string 无占位(F541)、未用变量(F841)
#   B   bugbear:zip 缺 strict、可变默认参、循环变量闭包等常见陷阱
select = ["E7", "E9", "F", "B"]
ignore = [
    # ── 存量债务(暂不阻断,逐步收敛;每类括号内为 2026-09-24 实测条数)──
    "F401",  # (206) 未用导入:__init__.py 多为有意 re-export,按 ruff --fix 批量删会破坏公共 API
    "E741",  # (3)   歧义变量名 l/I/O:改名涉及调用点,需人工确认
    "B023",  # (26)  闭包捕获循环变量:async 编排里闭包在同轮内定义即调用,非真晚绑定 bug
    "B905",  # (6)   zip() 未显式 strict:需逐个判断两侧长度语义,误加 strict 会引入异常
    "B904",  # (2)   except 内 raise 未带 from:影响的是异常链可读性,非行为错误
    "B008",  # (0)   函数调用作默认参数:FastAPI Query/File 等框架惯例,不禁则大量误报
    "B017",  # (1)   测试内 assertRaises(Exception) 宽断言:测试专用风格问题
]

# 注:pytest 配置统一在 pytest.ini(asyncio_mode 等),此处不再重复声明,
# 避免 pytest 报 "ignoring pytest config in pyproject.toml" 警告。