-
Notifications
You must be signed in to change notification settings - Fork 5
/
pyproject.toml
329 lines (297 loc) · 8.22 KB
/
pyproject.toml
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
#:schema https://json.schemastore.org/pyproject.json
[build-system]
requires = ['pdm-backend ~= 2.3']
build-backend = 'pdm.backend'
[project]
name = 'types-lxml'
dynamic = ['version']
description = 'Complete lxml external type annotation'
readme = 'README.md'
requires-python = '>=3.8'
license = {text = 'Apache-2.0'}
dependencies = [
'types-beautifulsoup4 ~= 4.12',
'typing_extensions ~= 4.10; python_version < "3.13"',
'cssselect ~= 1.2' # cssselect uses inline annotation
]
keywords = ['lxml', 'typing', 'stubs', 'annotation']
authors = [
{ name = 'Abel Cheung', email = '[email protected]' }
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Typing :: Stubs Only',
]
[project.urls]
homepage = 'https://github.com/abelcheung/types-lxml'
[project.optional-dependencies]
mypy = ['mypy ~= 1.11']
pyright = ['pyright >= 1.1.351']
# mostly pinned for tox testing except dev group
[dependency-groups]
basic = [
"types-beautifulsoup4 == 4.12.0.20241020",
"typing_extensions == 4.12.2; python_version < '3.13'",
"cssselect == 1.2.0",
]
mypy = ["mypy == 1.11.2"]
pyright = ["pyright == 1.1.387"]
format = ["ruff ~= 0.6"]
stub-test = [
"pytest-mypy-plugins == 3.1.2",
{include-group = "mypy"},
]
rt-test = [
'typeguard == 3.0; python_full_version < "3.12.4"',
'typeguard == 4.3.0; python_full_version >= "3.12.4"',
"pytest == 8.3.3",
"beautifulsoup4 == 4.12.3",
"html5lib == 1.1",
"hypothesis[zoneinfo] == 6.116.0",
{include-group = "mypy"},
{include-group = "pyright"},
]
lxml49 = ["lxml == 4.9.4"]
lxml50 = ["lxml == 5.0.2"]
lxml51 = ["lxml == 5.1.1"]
lxml52 = ["lxml == 5.2.2"]
lxml53 = ["lxml == 5.3.0"]
dev = [
'tox ~= 4.22',
'mypy >= 1.11.2',
# microsoft/pyright#9286 and microsoft/pyright#9296
'pyright >= 1.1.387',
'typeguard >= 3.0; python_full_version < "3.12.4"',
'typeguard >= 4.3.0; python_full_version >= "3.12.4"',
'pytest >= 7.0, < 9',
'html5lib == 1.1',
'pytest-mypy-plugins >= 2.0',
'lxml >= 4.9',
'beautifulsoup4 ~= 4.8',
'hypothesis[zoneinfo] ~= 6.0',
]
[tool.pdm.version]
source = 'scm'
[tool.pdm.build]
includes = ['src']
package-dir = 'src'
excludes = [
'**/__pycache__',
'**/.*',
'**/*.bak',
'**/*.patch',
'/*.py',
]
[tool.setuptools_scm]
[tool.pyright]
stubPath = 'src'
extraPaths = ['tests/runtime']
typeCheckingMode = 'strict'
reportPrivateUsage = false
reportUnnecessaryTypeIgnoreComment = false
# Follows typeshed practice, separate mypy and pyright
# type-ignores
# See https://github.com/python/mypy/issues/12358
enableTypeIgnoreComments = false
[tool.mypy]
mypy_path = '$MYPY_CONFIG_FILE_DIR/src'
packages = "lxml-stubs"
strict = true
show_error_context = true
pretty = true
warn_unused_ignores = false
[tool.ruff]
target-version = "py312"
[tool.ruff.format]
preview = true
[tool.ruff.lint]
select = ["I"]
task-tags = [
"BUG",
"FIXME",
"HACK",
"TODO",
"XXX",
]
[tool.ruff.lint.isort]
# doesn't work
# known-first-party = ["typing_extensions", "_typeshed"]
combine-as-imports = true
[tool.pytest.ini_options]
minversion = "7.0"
addopts = [
"--tb=short",
"--import-mode=importlib",
]
markers = [
"slow: marks tests as slow",
]
[tool.tox]
env_list = [
# No project maintenance related envs here
{replace = 'ref', of = ['tool', 'tox', 'labels', 'typecheck'], extend = true},
{replace = 'ref', of = ['tool', 'tox', 'labels', 'static' ], extend = true},
{replace = 'ref', of = ['tool', 'tox', 'labels', 'runtime' ], extend = true},
]
[tool.tox.labels]
typecheck = [
'pyright',
'mypy',
]
static = [
'py38-stub',
'py39-stub',
'py310-stub',
'py311-stub',
'py312-stub',
'py313-stub',
]
runtime = [
'py310-rt-lxml49',
'py310-rt-lxml50',
'py310-rt-lxml51',
'py310-rt-lxml52',
'py310-rt-lxml53',
'py311-rt-lxml49',
'py311-rt-lxml50',
'py311-rt-lxml51',
'py311-rt-lxml52',
'py311-rt-lxml53',
'py312-rt-lxml49',
'py312-rt-lxml50',
'py312-rt-lxml51',
'py312-rt-lxml52',
'py312-rt-lxml53',
'py313-rt-lxml53',
]
# HACK Taking advantage of tox-gh-actions using
# its own string processing when parsing config,
# therefore works even when migrating tox config
# to TOML. Beware that tox-gh-actions version
# must be hardcoded to 3.2.0
[tool.tox.gh-actions]
python = """
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
"""
[tool.tox.env_run_base.set_env]
PYTHONUTF8 = '1'
[tool.tox.env.mypy]
description = 'Use mypy to check annotation files for error'
package = 'skip'
dependency_groups = [
'basic',
'mypy',
]
commands = [['mypy', {replace = 'posargs', extend = true}]]
[tool.tox.env.pyright]
description = 'Use pyright to check annotation files for error'
package = 'skip'
dependency_groups = [
'basic',
'pyright',
]
commands = [['pyright', {replace = 'posargs', extend = true}, 'src']]
[tool.tox._env_stub]
pass_env = [
'CI',
'TF_BUILD',
]
package = 'wheel'
wheel_build_env = '{package_env}'
dependency_groups = ['stub-test']
commands = [[
'pytest',
'--mypy-ini-file=tests/static/mypy-pytest.ini',
{replace = 'posargs', default = ['tests/static'], extend = true},
]]
[tool.tox._env_rt]
pass_env = [
'CI',
'TF_BUILD',
]
package = 'wheel'
wheel_build_env = '{package_env}'
commands = [[
'pytest',
{replace = 'posargs', default = ['tests/runtime'], extend = true}
]]
commands_pre = [
['pyright', '--level', 'error', 'tests/runtime'],
# HACK Resort to mypy.api since command line doesn't know
# how to dump to file or discard output, and tox doesn't
# support shell semantics.
# Besides, early 1.11.* mypy unconditionally exits uncleanly
# when JSON output is requested. So use text mode here,
# unlike what's actually done in mypy_adapter.py
[
'python', '-c',
'''
from mypy.api import run
r=run(["--config-file=tests/runtime/rttest-mypy.ini","tests/runtime"])
for line in r[0].splitlines():
if ": note:" not in line:
print(line.strip())
exit(r[2])
'''
],
]
[tool.tox._env_lxml49]
dependency_groups = ['rt-test', 'lxml49']
[tool.tox._env_lxml50]
dependency_groups = ['rt-test', 'lxml50']
[tool.tox._env_lxml51]
dependency_groups = ['rt-test', 'lxml51']
[tool.tox._env_lxml52]
dependency_groups = ['rt-test', 'lxml52']
[tool.tox._env_lxml53]
dependency_groups = ['rt-test', 'lxml53']
[tool.tox.env]
py38-stub = {base = ['_env_stub']}
py39-stub = {base = ['_env_stub']}
py310-stub = {base = ['_env_stub']}
py311-stub = {base = ['_env_stub']}
py312-stub = {base = ['_env_stub']}
py313-stub = {base = ['_env_stub']}
py310-rt-lxml49 = {base = ['_env_rt', '_env_lxml49']}
py310-rt-lxml50 = {base = ['_env_rt', '_env_lxml50']}
py310-rt-lxml51 = {base = ['_env_rt', '_env_lxml51']}
py310-rt-lxml52 = {base = ['_env_rt', '_env_lxml52']}
py310-rt-lxml53 = {base = ['_env_rt', '_env_lxml53']}
py311-rt-lxml49 = {base = ['_env_rt', '_env_lxml49']}
py311-rt-lxml50 = {base = ['_env_rt', '_env_lxml50']}
py311-rt-lxml51 = {base = ['_env_rt', '_env_lxml51']}
py311-rt-lxml52 = {base = ['_env_rt', '_env_lxml52']}
py311-rt-lxml53 = {base = ['_env_rt', '_env_lxml53']}
py312-rt-lxml49 = {base = ['_env_rt', '_env_lxml49']}
py312-rt-lxml50 = {base = ['_env_rt', '_env_lxml50']}
py312-rt-lxml51 = {base = ['_env_rt', '_env_lxml51']}
py312-rt-lxml52 = {base = ['_env_rt', '_env_lxml52']}
py312-rt-lxml53 = {base = ['_env_rt', '_env_lxml53']}
py313-rt-lxml53 = {base = ['_env_rt', '_env_lxml53']}
[tool.tox.env.build-normal]
pass_env = ['PDM_BUILD_SCM_VERSION']
deps = ['build']
package = 'skip'
commands = [[
'python', '-m', 'build',
{replace = 'posargs', extend = true},
]]
[tool.tox.env.build-alt]
base = ['env.build-normal']
allowlist_externals = ['git']
commands_pre = [['git', 'apply', 'multi-subclass.patch']]
commands_post = [['git', 'apply', '--reverse', 'multi-subclass.patch']]