-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
326 lines (308 loc) · 6.78 KB
/
pyproject.toml
File metadata and controls
326 lines (308 loc) · 6.78 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
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
log_level = "INFO"
testpaths = ["tests"]
python_classes = []
python_files = ["test_*.py"]
timeout = 300
asyncio_default_fixture_loop_scope = "function"
filterwarnings = [
'''ignore:pkg_resources is deprecated as an API''',
'''ignore:Deprecated call to `pkg_resources\.declare_namespace\('.*'\):DeprecationWarning''',
# potential issue for future upgrades
# unfortunately it's not possible to filter escape sequence warnings in
# specific modules, but we should be covered by Ruff for our own code
'''ignore:"[^"]+" is an invalid escape sequence:::''',
'''ignore:'crypt':DeprecationWarning:passlib.*:''',
# Until pysaml2 is compatible with newer versions of xmlschema
# we are stuck with this DeprecationWarning
# See: https://github.com/IdentityPython/pysaml2/issues/947
'''ignore:pathlib\.PurePath\.as_uri\(\) is deprecated:DeprecationWarning:xmlschema.*:''',
# See: https://github.com/amol-/depot/issues/90
'''ignore:datetime\.datetime\.utcnow\(\) is deprecated:DeprecationWarning:depot.*:''',
# fixed upstream
'''ignore:(tagMap|typeMap) is deprecated:DeprecationWarning:ldap3.*:''',
]
[tool.coverage.run]
data_file = "/tmp/.coverage"
include = ["*/onegov/*"]
omit = ["*/tests/*"]
[tool.coverage.report]
ignore_errors = true
skip_covered = true
skip_empty = true
exclude_lines = [
"pragma: no cover",
"pragma: unreachable",
"assert_never[(]",
"@overload",
"raise NotImplementedError",
"raise AssertionError[(].unreachable.[)]",
"if TYPE_CHECKING:",
"if __name__ == .__main__.",
'''\A(?s:.*# pragma: exclude file.*)\Z'''
]
[tool.mypy]
python_version = "3.14"
follow_imports = "silent"
namespace_packages = true
explicit_package_bases = true
strict = true
implicit_reexport = true
warn_unreachable = true
warn_return_any = false
untyped_calls_exclude = "icalendar,pycurl,selenium.webdriver.chrome.webdriver"
mypy_path = "$MYPY_CONFIG_FILE_DIR/src:$MYPY_CONFIG_FILE_DIR/stubs"
[[tool.mypy.overrides]]
# ignore missing imports for packages that have no stubs available
module = [
# FIXME: Do we really need this? We have this implemented ourselves
# in OCQMS, so we could just copy that code over... plus the
# standard lib technically supports some ISO-8601 formats as well
"isodate.*",
# FIXME: Remove after https://github.com/lipoja/URLExtract/issues/164
"urlextract.*",
# FIXME: Remove after https://github.com/jmcnamara/XlsxWriter/issues/1123
"xlsxwriter.*"
]
ignore_missing_imports = true
[tool.bandit]
exclude_dirs = [
"tests",
"*/**/upgrade.py",
"*/**/upgrades.py"
]
skips = [
# ignore asserts
"B101",
# ignore meta-codes, we are aware of the implications
"B403",
"B404",
"B405",
]
[tool.ruff]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
src = ["src", "test", "stubs"]
include = [
"pyproject.toml",
"src/**/*.py",
"tests/**/*.py",
"stubs/**/*.pyi"
]
line-length = 79
indent-width = 4
target-version = "py314"
[tool.ruff.lint]
select = [
"A005",
"ASYNC",
"B0",
"B904",
"B909",
"C4",
"COM818",
"D2",
"D301",
"D4",
"E",
"F",
"FLY002",
"FURB",
"G010",
"G2",
"I002",
"ISC",
"LOG",
"N",
"PERF",
"PGH004",
"PGH005",
"PIE",
"PYI",
"Q",
"RUF",
"SIM",
"SLOT",
"T",
"TRY",
"UP",
"W"
]
ignore = [
"B007",
"C420",
"D200",
"D201",
"D202",
"D204",
"D205",
"D209",
"D210",
"D211",
"D400",
"D401",
"D412",
"E226",
"E402",
"E711",
"E712",
"E741",
"FURB101",
"FURB103",
"FURB110",
# NOTE: We should probably enable this, but we use repeated appends
# as a stylistic choice in some cases, extend would add another
# level of indentation.
"FURB113",
"FURB145",
"FURB140",
"FURB156",
"FURB157",
"FURB180",
"FURB189",
"LOG002",
"N818",
"PYI019",
"PYI041",
"RUF012",
"RUF013",
"RUF021",
"RUF022",
"RUF023",
"RUF031",
"RUF052",
"RUF056",
# TODO: Brings lots of violations, needs cleanup in all __init__.py files
"RUF067",
# TODO: We would like to enable SIM102, but it has a ton of
# violations, so it's a big job to clean it up
"SIM102",
"SIM103",
"SIM105",
"SIM108",
"SIM110",
"SIM118",
"SIM210",
"SIM910",
"TRY003",
"TRY300",
# NOTE: It probably makes sense to enable this, but the refactor
# will take a bit of effort.
"TRY301",
"UP009",
"UP012",
"UP032",
]
unfixable = []
external = ["TC"]
allowed-confusables = ["×"]
preview = true
[tool.ruff.lint.extend-per-file-ignores]
"src/onegov/core/types.py" = ["B018"]
"reportlab_settings.py" = ["N", "I002"]
"*/__init__.py" = ["I002"]
"*.pyi" = [
"E501",
"FURB",
"N",
"Q",
# NOTE: We would prefer to set a different target version instead
# but there's no per-file-target-version
"UP",
]
"src/onegov/*/upgrade.py" = [
"T2",
]
"tests/**/*.py" = [
"B018",
"C4",
"D",
"E301",
"E302",
"E303",
"E304",
"E305",
"E306",
"F841",
"FLY002",
"FURB",
"ISC",
"N",
"Q",
"PERF",
"PGH004",
"PIE",
"PYI",
"RUF",
"SIM",
"T",
"TRY",
"UP",
]
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.pep8-naming]
extend-ignore-names = [
"afterFlowable",
"HSTORE",
"sortKey",
"URL",
"UUID"
]
classmethod-decorators = [
# NOTE: We can potentially get rid some of these with SQLAlchemy 2.0
# since they should cleanly combine with classmethod
"declared_attr",
"expression",
"comparator",
]
[tool.ruff.lint.pydocstyle]
convention = "pep257"
ignore-decorators = ["typing.overload"]
[tool.ruff.lint.flake8-quotes]
avoid-escape = true
docstring-quotes = "double"
inline-quotes = "single"
multiline-quotes = "double"
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true
[tool.ruff.lint.ruff]
extend-markup-names = ["chameleon.utils.Markup"]
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ["attr.attrib"]
[tool.ruff.format]
quote-style = "single"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = true
docstring-code-line-length = "dynamic"