-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpyproject.toml
331 lines (295 loc) · 8.25 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
329
330
331
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "numtype"
version = "2.2.4.0.dev0"
description = "Experimental Typing Stubs for NumPy"
readme = "README.md"
authors = [
{name = "Joren Hammudoglu", email = "[email protected]"},
]
maintainers = [
{name = "NumPy Developers", email = "[email protected]"},
]
license = "BSD-3-Clause"
keywords = ["numpy", "typing", "stubs"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Stubs Only",
"Typing :: Typed",
]
packages = [
{include = "src/_numtype"},
{include = "src/numpy-stubs"},
{include = "src/numtype"},
]
requires-python = ">=3.10"
dependencies = []
[project.optional-dependencies]
numpy = ["numpy>=2.2.4,<2.3"]
[project.urls]
Homepage = "https://numpy.org/"
Repository = "https://github.com/numpy/numtype/"
Issues = "https://github.com/numpy/numtype/issues"
Changelog = "https://github.com/numpy/numtype/releases"
[dependency-groups]
numpy = ["numtype[numpy]"]
lint = ["ruff>=0.11.4"]
pytest = [
{include-group = "numpy"},
"pytest>=8.3.5",
"typing_extensions>=4.13.1",
]
list_and_test = [
{include-group = "lint"},
{include-group = "pytest"},
]
types = [
{include-group = "pytest"},
"types-setuptools>=78.1.0.20250329",
"types-tabulate>=0.9.0.20241207",
]
basedpyright = [
{include-group = "numpy"},
{include-group = "types"},
"basedpyright>=1.28.4",
]
mypy = [
{include-group = "types"},
"mypy[faster-cache]>=1.15.0",
]
typecheck = [
{include-group = "basedpyright"},
{include-group = "mypy"},
]
docs = [
"mkdocs-material>=9.6.11",
"mkdocs-awesome-nav>=3.1.1",
"markdown-callouts>=0.4.0",
"mkdocs-include-markdown-plugin>=7.1.5",
"mkdocs-minify-plugin>=0.8.0",
"mkdocstrings[python]>=0.29.1",
"pygments>=2.19.1",
]
dev = [
{include-group = "list_and_test"},
{include-group = "typecheck"},
{include-group = "docs"},
]
[tool.hatch.build]
exclude = [
"**/@test",
"**/*.yml",
"**/.*",
"/docs",
"/tool",
"CONTRIBUTING.md",
"uv.lock",
]
skip-excluded-dirs = true
[tool.hatch.build.targets.wheel]
packages = ["src/_numtype", "src/numtype", "src/numpy-stubs"]
[tool.mypy]
mypy_path = "src"
strict = true
strict_bytes = true
strict_concatenate = true
local_partial_types = true
enable_error_code = ["ignore-without-code", "truthy-bool"]
disable_error_code = ["explicit-override"]
enable_incomplete_feature = ["PreciseTupleTypes"]
disallow_any_explicit = false
disallow_any_expr = false
disallow_any_decorated = false
warn_incomplete_stub = true
warn_unreachable = false
# needed for stubtest, see https://github.com/python/mypy/issues/18744
disable_bytearray_promotion = true
disable_memoryview_promotion = true
# basedmypy/mypy compat
# bare_literals = false
# default_return = false
[tool.pyright]
include = ["src", "tool"]
ignore = [".venv"]
exclude = [
".cache",
".git",
".github",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".tox",
".vscode",
"docs",
"site",
]
stubPath = "src"
pythonPlatform = "All"
typeCheckingMode = "strict"
deprecateTypingAliases = true
disableBytesTypePromotions = true
enableTypeIgnoreComments = false
enableReachabilityAnalysis = false
reportCallInDefaultInitializer = true
reportImportCycles = true
reportImplicitOverride = true
reportInvalidStubStatement = false # required for type-testing
reportMissingSuperCall = false
reportPrivateUsage = false
reportPropertyTypeMismatch = false
reportSelfClsParameterName = false
reportShadowedImports = false # causes a ~35% slowdown
reportUninitializedInstanceVariable = true
reportUnnecessaryTypeIgnoreComment = true
reportUnusedExpression = false
reportUnusedParameter = false
reportUnusedVariable = true
# basedpyright only
failOnWarnings = true
reportIgnoreCommentWithoutRule = true
reportImplicitAbstractClass = true
reportImplicitRelativeImport = true
reportImplicitStringConcatenation = false
reportInvalidCast = true
reportPrivateLocalImportUsage = true
reportUnannotatedClassAttribute = false
strictGenericNarrowing = true
[tool.ruff]
src = ["src", "tool"]
extend-exclude = [".git", ".mypy_cache", ".tox", ".venv"]
force-exclude = true
# https://typing.python.org/en/latest/guides/writing_stubs.html#maximum-line-length
line-length = 130
preview = true
[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"FBT", # flake8-boolean-trap
"CPY", # flake8-copyright
"EM", # flake8-errmsg
"FIX", # flake8-fixme
"ANN401", # flake8-annotations: any-type
"PYI041", # flake8-pyi: redundant-numeric-union
]
[tool.ruff.lint.per-file-ignores]
"*.pyi" = [
"N", # pep8-naming
"TD", # flake8-todo
"COM812", # flake8-commas: missing-trailing-comma
"PYI054", # flake8-pyi: numeric-literal-too-long
"PLC2701", # pylint/C: import-private-name
]
[tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = ["random"]
[tool.ruff.lint.flake8-import-conventions]
banned-from = [
"abc",
"basedtyping",
"ctypes",
"datetime",
"os",
"sys",
"numpy",
"numpy.typing",
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
"ctypes" = "ct"
"datetime" = "dt"
"numpy" = "np"
"numpy.typing" = "npt"
"numtype" = "nt"
"_numtype" = "_nt"
[tool.ruff.lint.isort]
case-sensitive = true
combine-as-imports = true
extra-standard-library = ["_typeshed", "typing_extensions"]
known-first-party = ["numpy", "numtype", "_numtype"]
split-on-trailing-comma = true
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.pylint]
allow-dunder-method-names = ["__array__", "__array_ufunc__"]
[tool.pytest.ini_options]
minversion = "8.0"
addopts = ["-ra", "--strict-config", "--strict-markers"]
filterwarnings = ["error"]
log_cli_level = "INFO"
xfail_strict = true
# install tox with `uv tool install tox --with tox-uv --upgrade`
# and run with `uvx tox p`
[tool.tox]
min_version = "4"
requires = ["tox-uv>=1"]
env_list = [
"ruff",
"pytest",
"basedpyright",
"mypy",
"3.10",
"3.11",
"3.12",
"3.13",
]
[tool.tox.env_run_base]
description = "stubtest ({base_python})"
commands = [
[
"uv",
"run",
"-q",
"-p={base_python}",
"--active",
"tool/stubtest.py",
"--concise",
],
]
[tool.tox.env.ruff]
description = "ruff"
runner = "uv-venv-lock-runner"
dependency_groups = ["dev"]
commands = [
["ruff", "check", "--show-fixes"],
["ruff", "format", "--check"],
]
[tool.tox.env.pytest]
description = "pytest"
runner = "uv-venv-lock-runner"
dependency_groups = ["dev", "numpy"]
commands = [["pytest"]]
[tool.tox.env.basedpyright]
description = "basedpyright"
runner = "uv-venv-lock-runner"
dependency_groups = ["dev"]
commands = [["basedpyright", {replace = "posargs", default = [], extend = true}]]
[tool.tox.env.mypy]
description = "mypy"
runner = "uv-venv-lock-runner"
dependency_groups = ["dev", "orjson", "types"]
commands = [
[
"mypy",
"--no-incremental",
"--cache-dir=/dev/null",
"--soft-error-limit=-1",
{replace = "posargs", default = ["."], extend = true},
],
]
[tool.typos]
[tool.typos.default]
extend-ignore-identifiers-re = ['ND|nd|nin|NIN|TYP']
[tool.typos.files]
extend-exclude = ["*.pyi", ".mypyignore"]