Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
216 lines (181 loc) · 5.49 KB
/
Copy pathpyproject.toml
File metadata and controls
216 lines (181 loc) · 5.49 KB
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
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt
[build-system]
requires = ['setuptools']
build-backend = 'setuptools.build_meta'
## MYPY
[tool.mypy]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
follow_imports = "silent"
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true
exclude = """(?x)(
^tests/.*_plugin\\.py$ # not part of our test suite.
)"""
## PYLINT
[tool.pylint.basic]
no-docstring-rgx = "__.*__|test[A-Z_].*|setUp|_decorator|_wrapper|_.*__.*"
[tool.pylint.classes]
defining-attr-methods = [
"__init__",
"__new__",
"__post_init__",
"setUp",
"reset",
"_reset",
]
[tool.pylint.design]
max-args = 15
max-attributes = 40
max-bool-expr = 5
max-branches = 50
max-locals = 50
max-parents = 12
max-public-methods = 500
max-returns = 20
max-statements = 150
min-public-methods = 0
[tool.pylint.main]
extension-pkg-whitelist = ["greenlet"]
[tool.pylint."messages control"]
enable = [
"useless-suppression",
]
disable = [
"spelling",
# Messages that are just silly:
"locally-disabled",
"exec-used",
"global-statement",
"broad-except",
"no-else-return",
"subprocess-run-check",
"use-dict-literal",
# Messages that may be silly:
"no-member",
"using-constant-test",
"too-many-nested-blocks",
"too-many-ancestors",
"unnecessary-pass",
"no-else-break",
"no-else-continue",
# Questionable things, but it's ok, I don't need to be told:
"import-outside-toplevel",
"self-assigning-variable",
"consider-using-with",
"missing-timeout",
"too-many-lines",
"use-implicit-booleaness-not-comparison",
"too-many-positional-arguments",
"unnecessary-ellipsis",
# Formatting stuff
"superfluous-parens",
"line-too-long",
# Messages that are noisy for now, eventually maybe we'll turn them on:
"invalid-name",
"protected-access",
"unspecified-encoding",
"consider-using-f-string",
"duplicate-code",
"cyclic-import",
]
[tool.pylint.reports]
score = false
[tool.pylint.variables]
dummy-variables-rgx = "_|unused|.*_unused"
ignored-argument-names = "_|unused|.*_unused"
## PYTEST
[tool.pytest]
minversion = "9.0.0"
addopts = [
"-q",
"-n", "auto",
"--dist", "loadgroup",
"-p", "no:legacypath",
"--no-flaky-report",
"-rfEX",
"--failed-first",
]
python_classes = ["*Test"]
strict = true
### pytest.mark.xdist_group() values, and why:
# "virtualenv_test": because of an expensive session-scoped fixture
# "compare_test": Because of shared-file manipulations (~/tests/actual/testing)
# "get_zip_bytes_test": no idea why this one fails if run on separate workers
# How come these warnings are suppressed successfully here, but not in conftest.py??
filterwarnings = [
# Sample 'ignore':
# "ignore:the imp module is deprecated in favour of importlib:DeprecationWarning",
# Note: when writing the regex for the message, it's matched with re.match,
# so it has to match the beginning of the message. Add ".*" to make it
# match something in the middle of the message.
## Pytest warns if it can't collect things that seem to be tests. This should be an error.
"error::pytest.PytestCollectionWarning",
]
verbosity_assertions = "5"
## Scriv
[tool.scriv]
changelog = "tmp/only-changes.md"
ghrel_template = """
## {{title}}
{{body}}
:arrow_right:\u00a0 PyPI page: [coverage {{version}}](https://pypi.org/project/coverage/{{version}}).
:arrow_right:\u00a0 To install: `python3 -m pip install coverage=={{version}}`
"""
## CHECK-MANIFEST
[tool.check-manifest]
# Use our own explicit rules.
ignore-default-rules = true
ignore = [
# Files that package building creates and aren't expected in git.
"PKG-INFO",
"*.egg-info",
"*.egg-info/*",
"setup.cfg",
# Files that we create during packaging.
"a1_coverage.pth",
]
## UV
[tool.uv.exclude-newer-package]
# We trust sphinx-linklint, so it needs no cooldown.
sphinx-linklint = "P0D"
## RUFF
# We are using ruff for formatting, but not for linting.
[tool.ruff]
# PYVERSION
target-version = "py310" # Can't use [project]
line-length = 100
[tool.ruff.lint]
ignore = [
# Temporary while we gradually fix ruff concerns
"UP031", # TEMP: Use format specifiers instead of percent format
# Rules I want to suppress. I know when I have done these things.
"BLE001", # Do not catch blind exception: `Exception`
"C408", # Unnecessary `dict()` call (rewrite as a literal)
"PLC0414", # Import alias does not rename original package
"SIM", # Many "simplifying" rules that mask my intent.
"S102", # Use of `exec` detected
"YTT201", # Checking `sys.version_info[0] == 3`
]
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|[a-zA-Z0-9_]+_unused)$"
[tool.ruff.lint.isort]
combine-as-imports = true
[tool.ruff.lint.per-file-ignores]
"tests/**.py" = [
"PT031", # `pytest.warns()` block should contain a single simple statement
# Lots of tests have global lists of expected values
"RUF012", # Mutable default value for class attribute
"RUF024", # Do not pass mutable objects as values to `dict.fromkeys`
]