-
Notifications
You must be signed in to change notification settings - Fork 22
/
pyproject.toml
293 lines (271 loc) · 9.87 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
[project]
name = "basedpyright"
description = "static type checking for Python (but based)"
dynamic = ["version"]
authors = [
{ name = "detachhead", email = "detachhead@users.noreply.github.com" },
]
readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"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",
]
requires-python = ">=3.8"
dependencies = [
# required by the basedpyright cli & langserver wrapper scripts. only binaries are required (no cli)
# since the user shouldn't have a node/npm binary unknowingly added to their PATH
"nodejs-wheel-binaries>=20.13.1",
]
[dependency-groups]
dev = [
"pylint>=3.0.0a7",
"ruff>=0.2.2",
# cli is needed for development if node is not installed globally
"nodejs-wheel>=20.13.1",
"pdm-backend>=2.3.0",
"typing_extensions>=4.12.2",
"pytest>=8.2.2",
"pytest-github-actions-annotate-failures>=0.2.0",
"basedtyping>=0.1.4",
"mkdocs-material>=9.5.37",
"mkdocs-awesome-pages-plugin>=2.9.2",
"mike>=2.1.3",
"mkdocs-macros-plugin>=1.2.0",
]
docstubs = [
# these deps are also needed in build-system.requires. see https://github.com/pdm-project/pdm/issues/2947
"docify>=1.0.0",
]
lochelper = ["rich>=13.0", "textual>=0.70.0"]
[build-system]
build-backend = "pdm.backend"
requires = [
"pdm-backend>=2.3.0",
# required for building the pyright npm package to be bundled in the pypi package.
# cli is required due to dependencies with install scripts that assume node/npm is in the path
"nodejs-wheel>=20.13.1",
# used in pdm_build.py:
"typing_extensions>=4.12.2",
"docify>=1.0.0",
]
[project.urls]
repository = "https://github.com/detachhead/basedpyright"
[project.scripts]
basedpyright = 'basedpyright.pyright:main'
basedpyright-langserver = 'basedpyright.langserver:main'
[tool.pyprojectx]
lock-python-version = "3.8"
main = ["uv"]
[tool.uv]
default-groups = ["dev", "docstubs", "lochelper"]
[tool.pdm.version]
source = "call"
getter = "based_build.get_version:get_version"
[tool.pdm.build]
excludes = ["tests/", "pdm_build.py"]
source-includes = [
"build",
"based_build",
"docstubs",
"packages/pyright",
"packages/pyright-internal",
"package.json",
"package-lock.json",
"tsconfig.json",
]
[tool.pylint.MASTER]
fail-on = "I"
bad-names = ["foo", "bar", "baz", "retval"]
load-plugins = [
# we don't use all of these but enabling them all for completeness since there's no error if a rule is not found
"pylint.extensions.bad_builtin",
"pylint.extensions.broad_try_caluse",
"pylint.extensions.check_elif",
"pylint.extensions.code_style",
"pylint.extensions.comparetozero",
"pylint.extensions.comparison_placement",
"pylint.extensions.confusing_elif",
"pylint.extensions.consider_refactoring_into_while_condition",
"pylint.extensions.consider_ternary_expression",
"pylint.extensions.dict_init_mutate",
"pylint.extensions.docparams",
"pylint.extensions.docstyle",
"pylint.extensions.dunder",
"pylint.extensions.empty_comment",
"pylint.extensions.emptystring",
"pylint.extensions.eq_without_hash",
"pylint.extensions.for_any_all",
"pylint.extensions.magic_value",
"pylint.extensions.no_self_use",
"pylint.extensions.overlapping_exceptions",
"pylint.extensions.private_import",
"pylint.extensions.redefined_loop_name",
"pylint.extensions.redefined_variable_type",
"pylint.extensions.set_membership",
"pylint.extensions.typing",
"pylint.extensions.while_used",
]
[tool.pylint."MESSAGE CONTROL"]
disable = ["R", "C", "E", "F", "W", "I"]
enable = [
"useless-suppression",
# rules that have not yet been implemented in ruff. once all of these are implemented in ruff, we should remove pylint
# (see https://github.com/astral-sh/ruff/issues/970):
"access-member-before-definition",
"assignment-from-none",
"dict-iter-missing-items",
"invalid-bool-returned",
"invalid-getnewargs-ex-returned",
"invalid-getnewargs-returned",
"invalid-length-hint-returned",
"invalid-slice-index",
"invalid-slice-step",
"invalid-slots",
"invalid-slots-object",
"invalid-unicode-codec",
"logging-format-truncated",
"logging-unsupported-format",
"method-hidden",
"modified-iterating-dict",
"potential-index-error",
"relative-beyond-top-level",
"abstract-method",
"arguments-out-of-order",
"attribute-defined-outside-init",
"confusing-with-statement",
"deprecated-decorator",
"deprecated-module",
"differing-param-doc",
"global-variable-undefined",
"missing-param-doc",
"modified-iterating-list",
"multiple-constructor-doc",
"non-parent-init-called",
"overlapping-except",
"preferred-module",
"raising-format-tuple",
"redefined-outer-name",
"redefined-slots-in-subclass",
"redundant-returns-doc",
"redundant-yields-doc",
"useless-param-doc",
"useless-parent-delegation",
"useless-type-doc",
"using-constant-test",
"bad-file-encoding",
"dict-init-mutate",
"use-implicit-booleaness-not-comparison",
"chained-comparison",
"confusing-consecutive-elif",
"consider-using-augmented-assign",
"consider-using-join",
"consider-using-max-builtin",
"consider-using-min-builtin",
"consider-using-namedtuple-or-dataclass",
"consider-using-tuple",
"simplifiable-condition",
"simplify-boolean-expression",
]
[tool.pylint.REPORTS]
reports = "no"
output-format = "colorized"
score = "no"
[tool.pylint.FORMAT]
max-line-length = 200
[tool.basedpyright]
pythonVersion = "3.8"
include = ["basedpyright", "based_build", "pdm_build.py", "tests"]
# https://github.com/DetachHead/basedpyright/issues/31
ignore = ["pw", "basedpyright/dist", "packages", "build", "docstubs"]
exclude = ["pw", "basedpyright/dist", "packages", "build", "docstubs"]
reportImplicitStringConcatenation = false # conflicts with ruff formatter
# currently commented out due to https://github.com/DetachHead/basedpyright/issues/570
# only seem to be needed when using pycharm, which i dont really care about anyway because pycharm sucks
# venvPath = "."
# venv = ".venv"
[tool.ruff]
target-version = "py38"
respect-gitignore = true
line-length = 100
preview = true
unsafe-fixes = true
extend-exclude = [
"pw",
"packages/pyright-internal/typeshed-fallback",
"docstubs",
"packages/pyright-internal/src/tests/samples",
"build",
]
[tool.ruff.lint]
extend-select = ["ALL"]
ignore = [
# conflicts with or covered by another tool:
"ANN", # flake8-annotations (covered by basedpyright)
"PLE0605", # Invalid format for `__all__`, must be `tuple` or `list` (covered by basedpyright)
"RUF013", # PEP 484 prohibits implicit Optional (covered by basedpyright)
"RUF016", # Slice in indexed access to type (covered by basedpyright)
"D418", # Function/Method decorated with @overload shouldn't contain a docstring (basedpyright supports it)
"ISC001", # single-line-implicit-string-concatenation (conflicts with formatter)
"COM812", # missing-trailing-comma (conflicts with formatter)
"PLC0414", # Import alias does not rename original package (used by basedpyright for explicit re-export)
# rules i disabled because i don't like them:
"EM", # flake8-errmsg
"FIX", # flake8-fixme
"PLR0913", # Too many arguments to function call
"PLR0912", # Too many branches
"PLR0915", # Too many statements
"PLR2004", # Magic value used in comparison
"PLR1722", # Use `sys.exit()` instead of `exit`
"PLW2901", # `for` loop variable overwritten by assignment target
"PLR0911", # Too many return statements
"PLW0603", # Using the global statement is discouraged
"PLC0105", # `TypeVar` name does not reflect its covariance
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"D10", # Missing docstring
"D203", # 1 blank line required before class docstring
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"D400", # First line should end with a period
"D401", # First line should be in imperative mood
"D403", # First word of the first line should be properly capitalized
"D404", # First word of the docstring should not be `This`
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D415", # First line should end with a period, question mark, or exclamation point
"PT013", # Found incorrect import of pytest, use simple import pytest instead (only for bad linters that can't check the qualname)
"TD002", # Missing author in TODO
"CPY001", # missing-copyright-notice
"C901", # max-complexity
"DOC402", # docstring-missing-yields
"DOC201", # docstring-missing-returns
]
[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true
[tool.ruff.lint.per-file-ignores]
"*.pyi" = ["A001", "A002", "N"] # we don't control names in 3rd party modules
"{tests,based_build}/**/*.py" = [
"S", # none of these security focused rules are relevant for tests/build scripts
"T201",
]
"based_build/**/*.py" = [
"T201", # print
]
[tool.ruff.lint.isort]
combine-as-imports = true
required-imports = ["from __future__ import annotations"]
split-on-trailing-comma = false
[tool.ruff.format]
skip-magic-trailing-comma = true
[tool.pytest.ini_options]
xfail_strict = true
addopts = ['--strict-markers']
markers = [
'needs_all_docstubs', # indicates that the test needs to run after the docstubs are built, rather than during validation
]