-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
pyproject.toml
236 lines (224 loc) · 9.14 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
[tool.black]
target-version = ["py37"]
line-length = 79
skip-string-normalization = true
# https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html
preview = true
enable-unstable-feature = ["hug_parens_with_braces_and_square_brackets", "multiline_string_handling", "string_processing", "wrap_long_dict_values_in_parens"]
[tool.ruff]
# https://beta.ruff.rs/docs/settings/
target-version = "py37"
line-length = 79
[tool.ruff.lint]
preview = true
select = [
# To get a list of all values: `python3 -m ruff linter`.
"ALL",
"D200", # [*] One-line docstring should fit on one line
"D204", # [*] 1 blank line required after class docstring
"D209", # [*] Multi-line docstring closing quotes should be on a separate line
"D212", # [*] Multi-line docstring summary should start at the first line
"D301", # Use `r"""` if any backslashes in a docstring
"D403", # [*] First word of the first line should be capitalized
"PERF102", # [*] When using only the keys of a dict use the `keys()` method
"RET502", # [*] Do not implicitly `return None` in function able to return non-`None` value
"RET506", # [*] Unnecessary `else` after `raise` statement
"RET507", # Unnecessary `elif` after `continue` statement
"S113", # Probable use of requests call without timeout
"S602", # `subprocess` call with `shell=True` identified, security issue
]
ignore = [
"A", # flake8-builtins (shadowing of builtins like all, any, ...)
"ANN", # flake8-annotations
"ARG001", # unused-function-argument
"ARG002", # unused-method-argument
"B007", # Loop control variable `x` not used within loop body
"C4", # flake8-comprehensions
"C90", # mccabe (function `X` is too complex)
"COM812", # Trailing comma missing
"D", # pydocstyle
"DOC", # various docstring warnings
"DTZ", # flake8-datetimez
"ERA001", # Found commented-out code
"FBT", # flake8-boolean-trap (makes zero sense)
"FIX", # Line contains TODO / XXX / ..., consider resolving the issue
"FLY002", # static-join-to-f-string / Consider {expression} instead of string join
"FURB101", # `open` and `read` should be replaced by `Path(src).read_text()`
"FURB103", # `open` and `write` should be replaced by `Path(src).write_text()`
"FURB113", # Use `ls.extend(...)` instead of repeatedly calling `ls.append()`
"FURB116", # [*] Replace `hex` call with `f"{start:x}"`
"FURB118", # [*] Use `operator.add` instead of defining a lambda
"FURB140", # [*] Use `itertools.starmap` instead of the generator
"INP", # flake8-no-pep420
"N801", # Class name `async_chat` should use CapWords convention (ASYNCORE COMPAT)
"N802", # Function name X should be lowercase.
"N806", # Variable X in function should be lowercase.
"N818", # Exception name `FooBar` should be named with an Error suffix
"PERF", # Perflint
"PLC0415", # `import` should be at the top-level of a file
"PLC2701", # Private name import `x` from external module `y`
"PLR0904", # Too many public methods (x > y)
"PLR0911", # Too many return statements (8 > 6)
"PLR0912", # Too many branches (x > y)
"PLR0913", # Too many arguments in function definition (x > y)
"PLR0914", # Too many local variables (x/y)
"PLR0915", # Too many statements (x > y)
"PLR0917", # Too many positional arguments (x/y)
"PLR1702", # Too many nested blocks (x > y)
"PLR1704", # Redefining argument with the local name `type_`
"PLR2004", # Magic value used in comparison, consider replacing X with a constant variable
"PLR6301", # Method `x` could be a function, class method, or static method
"PLW0603", # Using the global statement to update `lineno` is discouraged
"PLW1514", # `open` in text mode without explicit `encoding` argument
"PLW2901", # `for` loop variable `x` overwritten by assignment target
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi (python types stuff)
"Q000", # Single quotes found but double quotes preferred
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RET504", # Unnecessary assignment to `result` before `return` statement
"RET505", # [*] Unnecessary `else` after `return` statement
"RUF005", # Consider iterable unpacking instead of concatenation
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF022", # `__all__` is not sorted
"RUF028", # This suppression comment is invalid
"RUF031", # [*] Avoid parentheses for tuples in subscripts
"S", # flake8-bandit
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM105", # Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF", # flake8-self
"TD", # all TODOs, XXXs, etc.
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
"UP032", # [*] Use f-string instead of `format` call
]
[tool.ruff.lint.per-file-ignores]
# EM101 == raw-string-in-exception
# EM102 == f-string-in-exception
# EM103 == dot-format-in-exception
# T201 == print()
# T203 == pprint()
# TRY003 == raise-vanilla-args
# B904 == Use `raise from` to specify exception cause
# PLC1901 == `x == ""` can be simplified to `not x` as an empty string is falsey
".github/workflows/*" = ["B904", "EM101", "EM102", "EM103", "T201", "T203"]
"psutil/tests/*" = ["B904", "EM101", "EM102", "EM103", "PLC1901", "TRY003"]
"scripts/*" = ["B904", "EM101", "EM102", "EM103", "T201", "T203"]
"scripts/internal/*" = ["B904", "EM101", "EM102", "EM103", "T201", "T203", "TRY003"]
"setup.py" = [
"B904", # Use ` raise from` to specify exception cause (PYTHON2.7 COMPAT)
"C4", # flake8-comprehensions (PYTHON2.7 COMPAT)
"FLY", # flynt (PYTHON2.7 COMPAT)
"FURB145", # [*] Prefer `copy` method over slicing (PYTHON2.7 COMPAT)
"T201",
"T203",
"UP009", # [*] UTF-8 encoding declaration is unnecessary (PYTHON2.7 COMPAT)
"UP010", # [*] Unnecessary `__future__` import `print_function` (PYTHON2.7 COMPAT)
"UP024", # [*] Replace aliased errors with `OSError` (PYTHON2.7 COMPAT)
"UP025", # [*] Remove unicode literals from strings (PYTHON2.7 COMPAT)
"UP028", # [*] Replace `yield` over `for` loop with `yield from` (PYTHON2.7 COMPAT)
"UP032", # [*] Use f-string instead of `format` call (PYTHON2.7 COMPAT)
"UP036", # Version block is outdated for minimum Python version
]
[tool.ruff.lint.isort]
# https://beta.ruff.rs/docs/settings/#isort
force-single-line = true # one import per line
lines-after-imports = 2
[tool.coverage.report]
exclude_lines = [
"except ImportError:",
"globals().update",
"if BSD",
"if FREEBSD",
"if LINUX",
"if LITTLE_ENDIAN:",
"if MACOS",
"if NETBSD",
"if OPENBSD",
"if SUNOS",
"if WINDOWS",
"if _WINDOWS:",
"if __name__ == .__main__.:",
"if ppid_map is None:",
"if sys.platform.startswith",
"pragma: no cover",
"raise NotImplementedError",
]
omit = [
"psutil/tests/*",
"setup.py",
]
[tool.pylint.messages_control]
# Important ones:
# undefined-all-variable, invalid-envvar-default, reimported, raising-format-tuple, simplifiable-if-expression, useless-object-inheritance
disable = [
"broad-except", # except Exception:
"consider-using-dict-comprehension",
"consider-using-f-string",
"consider-using-set-comprehension",
"consider-using-with",
"disallowed-name",
"fixme",
"global-statement",
"import-error",
"import-outside-toplevel",
"inconsistent-return-statements",
"invalid-name",
"missing-class-docstring",
"missing-function-docstring",
"no-else-raise",
"no-else-return",
"protected-access",
"raise-missing-from",
"redefined-builtin",
"super-with-arguments",
"too-few-public-methods",
"too-many-arguments",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-public-methods",
"too-many-return-statements",
"too-many-statements",
"ungrouped-imports",
"unspecified-encoding",
"wrong-import-position",
]
[tool.vulture]
exclude = [
"docs/conf.py",
"psutil/tests/",
"scripts/internal/winmake.py",
]
ignore_decorators = [
"@_common.deprecated_method",
"@atexit.register",
"@pytest.fixture",
]
[tool.rstcheck]
ignore_messages = [
"Duplicate explicit target name",
"Duplicate implicit target name",
"Hyperlink target \".*?\" is not referenced",
]
[tool.tomlsort]
in_place = true
no_sort_tables = true
sort_inline_arrays = true
spaces_before_inline_comment = 2
spaces_indent_inline_array = 4
trailing_comma_inline_array = true
[tool.cibuildwheel]
skip = [
"*-musllinux*",
"cp313-win*", # pywin32 is not available on cp313 yet
"cp3{7,8,9,10,11,12}-*linux_{aarch64,ppc64le,s390x}", # Only test cp36/cp313 on qemu tested architectures
"pp*",
]
[tool.cibuildwheel.macos]
archs = ["arm64", "x86_64"]
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=43"]