-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathpyproject.toml
More file actions
131 lines (119 loc) · 3.33 KB
/
pyproject.toml
File metadata and controls
131 lines (119 loc) · 3.33 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ncatbot5"
version = "5.5.2.post3"
description = "NcatBot, NapCat Python SDK"
readme = "README.md"
license = { text = "MIT" }
authors = [ { name = "木子", email = "lyh_02@qq.com" }, { name = "huan-yp", email = "huan_yp@qq.com"} ]
urls = { "Source" = "https://github.com/ncatbot/ncatbot", "Bug Reports" = "https://github.com/ncatbot/ncatbot/issues", "Documentation" = "https://github.com/ncatbot/ncatbot/wiki" }
requires-python = ">=3.12"
dependencies = [
# 数据模型
"pydantic>=2.0",
# 定时任务
"schedule",
# 配置文件
"pyyaml>=6.0",
# 网络通信
"aiohttp>=3.13.4",
"httpx>=0.27",
"websockets",
# 版本解析
"packaging",
# 终端输出
"tqdm>=4.60",
# QR 码生成
"qrcode",
# CLI
"click>=8.1",
"ruff>=0.14.10",
"pre-commit>=4.5.1",
"tox>=4.33.0",
]
[project.scripts]
ncatbot = "ncatbot.cli:main"
[project.optional-dependencies]
# 测试依赖
test = [
"pytest>=7.0",
"pytest-asyncio>=0.21",
"pytest-cov>=4.0",
"pytest-html>=4.0",
"litellm>=1.83.0",
]
# 开发依赖。使用 uv sync --extra dev 安装(包含测试依赖)
dev = [
"ncatbot5[test]",
"build>=1.4.0",
"twine>=6.2.0",
"tox>=4.0",
"tox-uv",
"pre-commit",
"ruff",
"mypy",
]
[tool.setuptools.packages.find]
where = ["."]
include = ["ncatbot", "ncatbot.*"]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
# 只收集 Test 开头的类作为测试类,排除 E2ETestSuite 等工具类
python_classes = ["Test*"]
markers = []
[tool.coverage.run]
source = ["ncatbot"]
branch = true
omit = [
# 版本文件(自动生成)
"ncatbot/_version.py",
# 测试文件
"ncatbot/**/test_*.py",
# MCP 模块(Model Context Protocol 服务端,需要外部 MCP 客户端测试)
"ncatbot/mcp/*",
# 网络 I/O(需要真实网络环境)
"ncatbot/utils/network_io.py",
# NapCat 适配器(需要真实 NapCat 服务和文件系统操作)
"ncatbot/core/adapter/nc/*",
# 模板插件(静态资源)
"ncatbot/utils/assets/*",
# 日志格式化(视觉效果代码)
"ncatbot/utils/logger.py",
# 废弃的线程池工具
"ncatbot/utils/thread_pool.py",
# 测试基础设施(不需要测试自身)
"ncatbot/utils/testing/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
"raise NotImplementedError",
"@abstractmethod",
]
show_missing = true
skip_covered = false
[tool.coverage.html]
directory = "htmlcov"
[tool.uv]
# 安全约束:修复间接依赖中的已知漏洞
constraint-dependencies = [
"virtualenv>=20.36.2", # TOCTOU 符号链接攻击 (CWE-362, CWE-59)
"filelock>=3.20.3", # SoftFileLock TOCTOU 漏洞 (CWE-362, CWE-367)
"cryptography>=46.0.5", # SECT 曲线子群验证缺失
"urllib3>=2.6.3", # HTTP 重定向解压缩炸弹绕过 (CWE-409)
]
[tool.codespell]
ignore-words-list = "ans,fo,therefrom,lke"
[tool.ruff]
# docs/ 是 Git submodule,不进行 lint
extend-exclude = ["docs"]
[tool.ruff.lint.per-file-ignores]
# legacy 代码正在重构替换,不再维护 lint
"ncatbot_legacy/**" = ["F401", "F405", "F841", "E402"]
# 示例代码允许未使用的 import(教学用途)
"docs/docs/examples/**" = ["F401"]