Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
281 lines (262 loc) · 7.43 KB
/
Copy pathpyproject.toml
File metadata and controls
281 lines (262 loc) · 7.43 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
[project]
name = "nonebot-plugin-htmlrender"
version = "0.8.1"
description = "提供 HTML、Markdown、模板渲染与独立栅格场景能力"
readme = "README.md"
authors = [{ name = "kexue", email = "x@kexue-cloud.cn" }]
requires-python = ">=3.10,<4.0"
license = { file = "LICENSE" }
dependencies = [
"anyio>=4.12.0",
"exceptiongroup>=1.3.0",
"jinja2>=3.0.3",
"markdown>=3.10.0",
"nonebot-plugin-localstore>=0.7.4",
"nonebot2>=2.5.0",
"pygments>=2.10.0",
"pymdown-extensions>=11.0",
"python-markdown-math>=0.8",
"typing-extensions>=4.15.0",
]
[project.optional-dependencies]
filehost = [
"py-machineid>=0.8.0",
]
sentry = ["nonebot-plugin-sentry>=2.0.0"]
prometheus = ["nonebot-plugin-prometheus>=0.4.0"]
takumi = ["takumi-py==0.2.0"]
playwright = [
"playwright>=1.60.0",
]
all = [
"nonebot-plugin-htmlkit==0.1.0rc5",
"nonebot-plugin-prometheus>=0.4.0",
"nonebot-plugin-sentry>=2.0.0",
"pillow>=12.0.0",
"playwright>=1.60.0",
"py-machineid>=0.8.0",
"skia-python>=144.0.post2",
"takumi-py==0.2.0",
]
pillow = [
"pillow>=12.0.0",
]
skia = [
"skia-python>=144.0.post2",
]
htmlkit = [
"nonebot-plugin-htmlkit==0.1.0rc5",
]
[project.urls]
"Homepage" = "https://github.com/kexue-z/nonebot-plugin-htmlrender"
"Bug Tracker" = "https://github.com/kexue-z/nonebot-plugin-htmlrender/issues"
[dependency-groups]
dev = [
"nonebot-adapter-onebot>=2.4.6",
"nonebot2[fastapi]>=2.5.0",
"ruff>=0.15.2",
"basedpyright>=1.38.4",
"ty>=0.0.34",
]
docs = [
"zensical>=0.0.51",
"mike @ git+https://github.com/squidfunk/mike.git",
"mkdocstrings-python>=2.0.1",
]
remote-smoke = [
"nonebot2[fastapi]>=2.5.0",
"pillow>=12.0.0",
"playwright>=1.60.0",
"py-machineid>=0.8.0",
]
test = [
"nonebug>=0.4.4",
"pytest-cov>=7.0.0",
"pytest-xdist>=3.8.0",
"pytest-mock>=3.15.1",
"trio>=0.33.0",
"pillow>=12.0.0",
"httpx2>=2.4.0",
]
[tool.pytest.ini_options]
addopts = "-p no:nonebug --cov=nonebot_plugin_htmlrender --cov-report=term-missing"
anyio_mode = "auto"
markers = [
"anyio: run async tests via anyio backend",
"requires_browser: test needs a real Playwright browser",
]
[tool.coverage.run]
omit = [
# Signal & process management (host OS integration, exercised by the
# install smoke matrix rather than unit coverage)
"nonebot_plugin_htmlrender/adapters/playwright/_support/signal.py",
"nonebot_plugin_htmlrender/adapters/playwright/_support/process.py",
# Installation helpers
"nonebot_plugin_htmlrender/adapters/playwright/_support/install.py",
"nonebot_plugin_htmlrender/adapters/playwright/install.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"\\.\\.\\.$",
]
[tool.ruff]
line-length = 88
indent-width = 4
target-version = "py310"
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
[tool.ruff.lint]
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"N", # PEP8-naming
"UP", # pyupgrade
"YTT", # flake8-2020
"ASYNC", # flake8-async
"S", # flake8-bandit
"BLE", # flake8-blind-except
"FBT", # flake8-boolean-trap
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"FA", # flake8-future-annotations
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TC", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
# "ERA", # eradicate
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PL", # pylint
"TRY", # tryceratops
"FLY", # flynt
"FAST", # FastAPI
"PERF", # Perflint
"FURB", # refurb
"RUF", # Ruff-specific rules
]
ignore = [
"E402", # module-import-not-at-top-of-file (needed by nonebot require pattern)
"E501", # 过长的行由 ruff format 处理, 剩余的都是字符串
"UP035", # pyupgrade, 但 typing.Callable 的导入会报错
"TRY003", # 简单异常搞这么复杂
"TRY300", # 和 RET505 冲突了
"TRY301", # 为啥非要把 raise 丢进另外一个 inner fn 里
"BLE001", # except Exception as e
"PGH003", # 要求 `# type: ignore` 提供理由,但 pyright 和 mypy 等都不是统一标准。
"PLC0414", # 用 import-as 表示 re-export
"N818", # 要求所有自定义错误以 Error 作后缀,但我们不这么做
"RET502", # return = return None
"RET503", # 就要 implicit return none
"PLC0105", # 我们已经用 R 表示协变,Q 表示逆变了
"PLR0913", # 参数就那么多的,你用 builder 什么的不是更逆天?
"SIM108", # 迫真 simplicy
"RUF009", # 我不想要额外的全局变量。
"RUF003", # 中文注释里用全角符号怎么你了
"RUF001", # 中文字符串里的全角标点
"RUF002", # 中文 docstring 里的全角标点
"PTH100", # keep os.path for compatibility
"PTH111", # keep os.path for compatibility
"SLOT000", # 动态类型需求,主要是 json5 backend
"PLR0911",
"PLR0912",
"PLR0915", # 复杂度高点怎么你了
"PYI041", # int 和 float 在运行时的类型没有交集(互不成立 issubclass)
"PLW2901", # shallow 怎么你了
"S101", # assert 怎么你了,非要 RuntimeError 吗
"PLR2004", # magic number 怎么你了
"TRY004", # 我要抛啥错误我清楚
"COM812", # 强制尾随逗号
"TID252", # 相对导入
"ISC001", # format warning
"S105", # 硬编码路径也要叫吗
]
flake8-quotes = { inline-quotes = "double", multiline-quotes = "double" }
fixable = ["ALL"]
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"
[tool.ruff.lint.isort]
length-sort = false
force-sort-within-sections = true
known-first-party = ["nonebot_plugin_htmlrender", "tests/*"]
extra-standard-library = ["typing_extensions"]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true
[tool.basedpyright]
pythonVersion = "3.10"
pythonPlatform = "All"
typeCheckingMode = "standard"
include = ["nonebot_plugin_htmlrender", "tests", "examples"]
executionEnvironments = [
{ root = "./tests", extraPaths = ["./"] },
{ root = "./examples", extraPaths = ["./"] },
{ root = "./" },
]
exclude = [
"**/__pycache__",
".venv/**",
]
[tool.ty.rules]
deprecated = "ignore"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.nonebot]
plugins = ["nonebot_plugin_htmlrender"]