-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
pyproject.toml
188 lines (179 loc) · 6.9 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
[tool.ruff]
# https://beta.ruff.rs/docs/settings/
target-version = "py37"
line-length = 79
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
"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
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` (PYTHON2.7 COMPAT)
"C4", # flake8-comprehensions (PYTHON2.7 COMPAT)
"C90", # mccabe (function `X` is too complex)
"D", # pydocstyle
"DTZ", # flake8-datetimez
"ERA001", # Found commented-out code
"FBT", # flake8-boolean-trap (makes zero sense)
"FIX", # Line contains TODO / XXX / ..., consider resolving the issue
"FLY", # flynt (PYTHON2.7 COMPAT)
"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
"PGH004", # Use specific rule codes when using `noqa`
"PLR0911", # Too many return statements (8 > 6)
"PLR0912", # Too many branches (x > y)
"PLR0913", # Too many arguments in function definition (x > y)
"PLR0915", # Too many statements (92 > 50)
"PLR2004", # Magic value used in comparison, consider replacing X with a constant variable
"PLR5501", # Use `elif` instead of `else` then `if`, to reduce indentation
"PLW0603", # Using the global statement to update `lineno` is discouraged
"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
"RET", # flake8-return
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM105", # Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
"SIM115", # Use context handler for opening files
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF", # flake8-self
"TD", # all TODOs, XXXs, etc.
"TRY200", # Use `raise from` to specify exception cause (PYTHON2.7 COMPAT)
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
"UP009", # [*] UTF-8 encoding declaration is unnecessary (PYTHON2.7 COMPAT)
"UP010", # [*] Unnecessary `__future__` import `print_function` for target Python version (PYTHON2.7 COMPAT)
"UP024", # [*] Replace aliased errors with `OSError` (PYTHON2.7 COMPAT)
"UP028", # [*] Replace `yield` over `for` loop with `yield from` (PYTHON2.7 COMPAT)
"UP031", # [*] Use format specifiers instead of percent format
"UP032", # [*] Use f-string instead of `format` call (PYTHON2.7 COMPAT)
]
[tool.ruff.per-file-ignores]
# T201 == print(), T203 == pprint()
# EM101 == raw-string-in-exception
# TRY003 == raise-vanilla-args
".github/workflows/*" = ["T201", "T203"]
"psutil/_compat.py" = ["PLW0127"] # self-assigning-variable
"psutil/tests/*" = ["EM101", "TRY003"]
"psutil/tests/runner.py" = ["T201", "T203"]
"scripts/*" = ["T201", "T203"]
"scripts/internal/*" = ["T201", "T203"]
"setup.py" = ["T201", "T203"]
[tool.ruff.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 = [
"enum.IntEnum",
"except ImportError:",
"globals().update",
"if BSD",
"if FREEBSD",
"if LINUX",
"if LITTLE_ENDIAN:",
"if MACOS",
"if NETBSD",
"if OPENBSD",
"if PY3:",
"if SUNOS",
"if WINDOWS",
"if _WINDOWS:",
"if __name__ == .__main__.:",
"if enum is None:",
"if enum is not None:",
"if has_enums:",
"if ppid_map is None:",
"if sys.platform.startswith",
"import enum",
"pragma: no cover",
"raise NotImplementedError",
]
omit = [
"psutil/_compat.py",
"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.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*", "pp*"]
test-command = [
"env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/runner.py",
"env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/test_memleaks.py",
]
test-extras = "test"
[tool.cibuildwheel.macos]
archs = ["arm64", "x86_64"]
[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=43", "wheel"]