psutil

Форк
0
/
pyproject.toml 
227 строк · 8.9 Кб
1
[tool.black]
2
target-version = ["py37"]
3
line-length = 79
4
skip-string-normalization = true
5
# https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html
6
preview = true
7
enable-unstable-feature = ["hug_parens_with_braces_and_square_brackets", "multiline_string_handling", "string_processing", "wrap_long_dict_values_in_parens"]
8

9
[tool.ruff]
10
# https://beta.ruff.rs/docs/settings/
11
target-version = "py37"
12
line-length = 79
13

14
[tool.ruff.lint]
15
preview = true
16
select = [
17
    # To get a list of all values: `python3 -m ruff linter`.
18
    "ALL",
19
    "D200",  # [*] One-line docstring should fit on one line
20
    "D204",  # [*] 1 blank line required after class docstring
21
    "D209",  # [*] Multi-line docstring closing quotes should be on a separate line
22
    "D212",  # [*] Multi-line docstring summary should start at the first line
23
    "D301",  # Use `r"""` if any backslashes in a docstring
24
    "D403",  # [*] First word of the first line should be capitalized
25
    "PERF102",  # [*] When using only the keys of a dict use the `keys()` method
26
    "RET507",  # Unnecessary `elif` after `continue` statement
27
    "S113",  # Probable use of requests call without timeout
28
    "S602",  # `subprocess` call with `shell=True` identified, security issue
29
]
30
ignore = [
31
    "A",  # flake8-builtins (shadowing of builtins like all, any, ...)
32
    "ANN",  # flake8-annotations
33
    "ARG001",  # unused-function-argument
34
    "ARG002",  # unused-method-argument
35
    "B007",  # Loop control variable `x` not used within loop body
36
    "B904",  # Within an `except` clause, raise exceptions with `raise ... from err` (PYTHON2.7 COMPAT)
37
    "B904",  # Use `raise from` to specify exception cause (PYTHON2.7 COMPAT)
38
    "C4",  # flake8-comprehensions (PYTHON2.7 COMPAT)
39
    "C90",  # mccabe (function `X` is too complex)
40
    "COM812",  # Trailing comma missing
41
    "D",  # pydocstyle
42
    "DTZ",  # flake8-datetimez
43
    "ERA001",  # Found commented-out code
44
    "FBT",  # flake8-boolean-trap (makes zero sense)
45
    "FIX",  # Line contains TODO / XXX / ..., consider resolving the issue
46
    "FLY",  # flynt (PYTHON2.7 COMPAT)
47
    "FURB101",  # `open` and `read` should be replaced by `Path(src).read_text()`
48
    "FURB103",  # `open` and `write` should be replaced by `Path(...).write_text(...)`
49
    "FURB113",  # Use `x.extend(('a', 'b', 'c'))` instead of repeatedly calling `x.append()`
50
    "FURB116",  # [*] Replace `hex` call with `f"{start:x}"`
51
    "FURB118",  # [*] Use `operator.add` instead of defining a lambda
52
    "FURB140",  # [*] Use `itertools.starmap` instead of the generator
53
    "FURB145",  # [*] Prefer `copy` method over slicing (PYTHON2.7 COMPAT)
54
    "FURB192",  # [*] Prefer `min` over `sorted()` to compute the minimum value in a sequence
55
    "INP",  # flake8-no-pep420
56
    "N801",  # Class name `async_chat` should use CapWords convention (ASYNCORE COMPAT)
57
    "N802",  # Function name X should be lowercase.
58
    "N806",  # Variable X in function should be lowercase.
59
    "N818",  # Exception name `FooBar` should be named with an Error suffix
60
    "PERF",  # Perflint
61
    "PGH004",  # Use specific rule codes when using `noqa`
62
    "PLC0415",  # `import` should be at the top-level of a file
63
    "PLC2701",  # Private name import `x` from external module `y`
64
    "PLR0904",  # Too many public methods (x > y)
65
    "PLR0911",  # Too many return statements (8 > 6)
66
    "PLR0912",  # Too many branches (x > y)
67
    "PLR0913",  # Too many arguments in function definition (x > y)
68
    "PLR0914",  # Too many local variables (x/y)
69
    "PLR0915",  # Too many statements (x > y)
70
    "PLR0917",  # Too many positional arguments (x/y)
71
    "PLR1702",  # Too many nested blocks (x > y)
72
    "PLR1704",  # Redefining argument with the local name `type_`
73
    "PLR2004",  # Magic value used in comparison, consider replacing X with a constant variable
74
    "PLR5501",  # Use `elif` instead of `else` then `if`, to reduce indentation
75
    "PLR6201",  # Use a `set` literal when testing for membership
76
    "PLR6301",  # Method `x` could be a function, class method, or static method
77
    "PLW0603",  # Using the global statement to update `lineno` is discouraged
78
    "PLW1514",  # `open` in text mode without explicit `encoding` argument
79
    "PLW2901",  # `for` loop variable `x` overwritten by assignment target
80
    "PT",  # flake8-pytest-style
81
    "PTH",  # flake8-use-pathlib
82
    "PYI",  # flake8-pyi (python types stuff)
83
    "Q000",  # Single quotes found but double quotes preferred
84
    "RET",  # flake8-return
85
    "RUF",  # Ruff-specific rules
86
    "S",  # flake8-bandit
87
    "SIM102",  # Use a single `if` statement instead of nested `if` statements
88
    "SIM105",  # Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
89
    "SIM115",  # Use context handler for opening files
90
    "SIM117",  # Use a single `with` statement with multiple contexts instead of nested `with` statements
91
    "SLF",  # flake8-self
92
    "TD",  # all TODOs, XXXs, etc.
93
    "TRY300",  # Consider moving this statement to an `else` block
94
    "TRY301",  # Abstract `raise` to an inner function
95
    "UP009",  # [*] UTF-8 encoding declaration is unnecessary (PYTHON2.7 COMPAT)
96
    "UP010",  # [*] Unnecessary `__future__` import `print_function` for target Python version (PYTHON2.7 COMPAT)
97
    "UP024",  # [*] Replace aliased errors with `OSError` (PYTHON2.7 COMPAT)
98
    "UP025",  # [*] Remove unicode literals from strings (PYTHON2.7 COMPAT)
99
    "UP028",  # [*] Replace `yield` over `for` loop with `yield from` (PYTHON2.7 COMPAT)
100
    "UP031",  # [*] Use format specifiers instead of percent format
101
    "UP032",  # [*] Use f-string instead of `format` call (PYTHON2.7 COMPAT)
102
]
103

104
[tool.ruff.lint.per-file-ignores]
105
# T201 == print(), T203 == pprint()
106
# EM101 == raw-string-in-exception
107
# TRY003 == raise-vanilla-args
108
".github/workflows/*" = ["T201", "T203"]
109
"psutil/_compat.py" = ["PLW0127"]  # self-assigning-variable
110
"psutil/tests/*" = ["EM101", "TRY003"]
111
"psutil/tests/runner.py" = ["T201", "T203"]
112
"scripts/*" = ["T201", "T203"]
113
"scripts/internal/*" = ["EM101", "T201", "T203", "TRY003"]
114
"setup.py" = ["T201", "T203"]
115

116
[tool.ruff.lint.isort]
117
# https://beta.ruff.rs/docs/settings/#isort
118
force-single-line = true  # one import per line
119
lines-after-imports = 2
120

121
[tool.coverage.report]
122
exclude_lines = [
123
    "enum.IntEnum",
124
    "except ImportError:",
125
    "globals().update",
126
    "if BSD",
127
    "if FREEBSD",
128
    "if LINUX",
129
    "if LITTLE_ENDIAN:",
130
    "if MACOS",
131
    "if NETBSD",
132
    "if OPENBSD",
133
    "if PY3:",
134
    "if SUNOS",
135
    "if WINDOWS",
136
    "if _WINDOWS:",
137
    "if __name__ == .__main__.:",
138
    "if enum is None:",
139
    "if enum is not None:",
140
    "if has_enums:",
141
    "if ppid_map is None:",
142
    "if sys.platform.startswith",
143
    "import enum",
144
    "pragma: no cover",
145
    "raise NotImplementedError",
146
]
147
omit = [
148
    "psutil/_compat.py",
149
    "psutil/tests/*",
150
    "setup.py",
151
]
152

153
[tool.pylint.messages_control]
154
# Important ones:
155
# undefined-all-variable, invalid-envvar-default, reimported, raising-format-tuple, simplifiable-if-expression, useless-object-inheritance
156
disable = [
157
    "broad-except",  # except Exception:
158
    "consider-using-dict-comprehension",
159
    "consider-using-f-string",
160
    "consider-using-set-comprehension",
161
    "consider-using-with",
162
    "disallowed-name",
163
    "fixme",
164
    "global-statement",
165
    "import-error",
166
    "import-outside-toplevel",
167
    "inconsistent-return-statements",
168
    "invalid-name",
169
    "missing-class-docstring",
170
    "missing-function-docstring",
171
    "no-else-raise",
172
    "no-else-return",
173
    "protected-access",
174
    "raise-missing-from",
175
    "redefined-builtin",
176
    "super-with-arguments",
177
    "too-few-public-methods",
178
    "too-many-arguments",
179
    "too-many-branches",
180
    "too-many-instance-attributes",
181
    "too-many-lines",
182
    "too-many-locals",
183
    "too-many-public-methods",
184
    "too-many-return-statements",
185
    "too-many-statements",
186
    "ungrouped-imports",
187
    "unspecified-encoding",
188
    "wrong-import-position",
189
]
190

191
[tool.rstcheck]
192
ignore_messages = [
193
    "Duplicate explicit target name",
194
    "Duplicate implicit target name",
195
    "Hyperlink target \".*?\" is not referenced",
196
]
197

198
[tool.tomlsort]
199
in_place = true
200
no_sort_tables = true
201
sort_inline_arrays = true
202
spaces_before_inline_comment = 2
203
spaces_indent_inline_array = 4
204
trailing_comma_inline_array = true
205

206
[tool.cibuildwheel]
207
skip = [
208
    "*-musllinux*",
209
    "cp313-win*",  # pywin32 is not available on cp313 yet
210
    "cp3{7,8,9,10,11,12}-*linux_{aarch64,ppc64le,s390x}",  # Only test cp36/cp313 on qemu tested architectures
211
    "pp*",
212
]
213
test-command = [
214
    "env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/runner.py",
215
    "env PYTHONWARNINGS=always PYTHONUNBUFFERED=1 PSUTIL_DEBUG=1 PSUTIL_SCRIPTS_DIR={project}/scripts python {project}/psutil/tests/test_memleaks.py",
216
]
217
test-extras = "test"
218

219
[tool.cibuildwheel.macos]
220
archs = ["arm64", "x86_64"]
221

222
[tool.cibuildwheel.linux]
223
before-all = "yum install -y net-tools"
224

225
[build-system]
226
build-backend = "setuptools.build_meta"
227
requires = ["setuptools>=43", "wheel"]
228

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.