-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpyproject.toml
311 lines (293 loc) · 9.16 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
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
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[project]
name = "astacus"
authors = [
{ name="Aiven", email="[email protected]" },
]
description = "Astacus, cluster (database) backup tool"
readme = "README.md"
requires-python = ">=3.11"
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development :: Libraries",
]
license = { text = "Apache License 2.0" }
dynamic = ["version"]
dependencies = [
"fastapi",
"httpx",
"msgspec",
"kazoo",
"protobuf < 3.21",
"pydantic < 2",
"pyyaml",
"rohmu >= 2.7.0",
"sentry-sdk",
"starlette",
"tabulate",
"typing-extensions >= 4.7.1; python_version < '3.12'",
"uvicorn",
"wcmatch",
]
[project.optional-dependencies]
cassandra = [
"cassandra-driver == 3.20.2",
]
f39 = [
"cramjam == 2.8.3",
"cryptography == 41.0.7",
"fastapi == 0.103.0",
"h11 == 0.14.0",
"httpcore == 0.17.3",
"httplib2 == 0.21.0",
"httpx == 0.24.1",
"msgspec == 0.18.6",
"kazoo == 2.8.0",
"protobuf == 3.19.6",
"pyasyncore == 1.0.2",
# pydantic on Fedora 39 is actually 1.10.14.
# rohmu requires pydantic >= 1.10.17 because of the "v1" namespace broken compatibility.
"pydantic == 1.10.17",
"pyyaml == 6.0.1",
"requests == 2.28.2",
"starlette == 0.27.0",
"tabulate == 0.9.0",
"uritemplate == 4.1.1",
"urllib3 == 1.26.18",
"uvicorn == 0.23.2",
"wcmatch == 8.4.1",
"zstandard == 0.21.0",
]
f40 = [
"cramjam == 2.8.3",
"cryptography == 41.0.7",
"fastapi == 0.111.1",
"h11 == 0.14.0",
"httpcore == 1.0.2",
"httplib2 == 0.21.0",
"httpx == 0.26.0",
"msgspec == 0.18.6",
"kazoo == 2.8.0",
"protobuf == 3.19.6",
"pyasyncore == 1.0.2",
# pydantic on Fedora 40 is actually v2.
"pydantic == 1.10.17",
"pyyaml == 6.0.1",
"requests == 2.31.0",
"tabulate == 0.9.0",
"uritemplate == 4.1.1",
"uvicorn == 0.23.2",
"wcmatch == 8.5.2",
"zstandard == 0.22.0",
]
dev = [
# Needed by pre-commit to lint and test the project
"pre-commit>=3.7.0",
"anyio==3.5.0",
"pytest-cov==3.0.0",
"pytest-mock==3.10.0",
"pytest-order==1.0.0",
"pytest-timeout==2.1.0",
"pytest-watch==4.2.0",
"pytest==7.2.2",
"mypy==1.11.2",
"ruff>=0.7.0",
# Types for things that don't seem to have them
"types-botocore>=1.0.2",
"types-PyYAML>=6.0.12.2",
"types-requests>=2.28.11.5",
"types-tabulate>=0.9.0.0",
"types-ujson>=5.9.0.0",
"types-urllib3>=1.26.25.4",
# F38
"coverage==7.0.5",
"freezegun>=1.2",
"respx==0.20.1",
]
[project.urls]
"Homepage" = "https://github.com/Aiven-Open/astacus"
"Bug Tracker" = "https://github.com/Aiven-Open/astacus/issues"
[project.scripts]
astacus = "astacus.main:main"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.hooks.vcs]
version-file = "astacus/version.py"
[tool.coverage.run]
# Gather statistics per invocation
parallel = true
# We're only interested about Astacus core, not rohmu/..
#
# (tests is listed here mostly so that we can detect unused utility functions in them)
source = [
"astacus",
"tests"
]
[tool.mypy]
python_version = "3.12"
plugins = ["pydantic.mypy"]
exclude = [
"setup.py",
"vendor/",
"venv/",
"astacus/proto/",
]
show_error_codes = true
warn_unreachable = true
no_implicit_reexport = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_subclassing_any = true
[tool.pydantic-mypy]
# even if Config.extra != forbid, prevent extra args
init_forbid_extra = true
# validate types on __init__, do not go for type coercion
init_typed = true
# We don't want use of indirect population without explicit alias
warn_required_dynamic_aliases = true
[[tool.mypy.overrides]]
module = "cassandra.*,graphlib,kazoo.*,systemd"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "google.protobuf"
ignore_errors = true
[[tool.mypy.overrides]]
module = "astacus.common.cassandra,astacus.coordinator.cassandra,astacus.node.cassandra"
disallow_incomplete_defs = true
disallow_untyped_defs = true
[tool.ruff]
target-version = "py312"
line-length = 125
force-exclude = true
[tool.ruff.lint]
# A list of rule codes or prefixes to enable, in addition to those specified by 'select'.
extend-select = [
# flake8-bugbear
# mutable-argument-default - Do not use mutable data structures for argument defaults.
"B006",
# pydocstyle
"D",
# flake8-datetimez
"DTZ",
# pycodestyle
"E",
# pyflakes
"F",
# flake8-logging-format
# logging-warn - Logging statement uses warn instead of warning.
"G010",
# isort
"I",
# flake8-no-pep420
"INP",
# flake8-pytest-style
"PT",
# Ruff-specific rules
# explicit-f-string-type-conversion - Use explicit conversion flag.
"RUF010",
# unused-noqa - Unused 'noqa' directive.
"RUF100",
# flake8-tidy-imports
"TID",
# pyupgrade
"UP",
# Open file with context handler.
"SIM115",
]
# A list of rule codes or prefixes to ignore.
ignore = [
# pydocstyle
# undocumented-public-module - Missing docstring in public module.
"D100",
# undocumented-public-class - Missing docstring in public class.
"D101",
# undocumented-public-method - Missing docstring in public method.
"D102",
# undocumented-public-function - Missing docstring in public function.
"D103",
# undocumented-public-package - Missing docstring in public package.
"D104",
# undocumented-magic-method - Missing docstring in magic method.
"D105",
# undocumented-public-nested-class - Missing docstring in public nested class.
"D106",
# undocumented-public-init - Missing docstring in __init__.
"D107",
# one-blank-line-before-class - 1 blank line required before class docstring.
# This configuration can't be enabled as it's incompatible with 'D211' (no-blank-line-before-class).
"D203",
# blank-line-after-summary - 1 blank line required between summary line and description.
# This configuration can't be enabled because automatic fix available is minimal.
"D205",
# non-imperative-mood - First line of docstring should be in imperative mood: "{first_line}".
"D401",
# one-blank-line-after-class - 1 blank line required after class docstring.
"D402",
# docstring-starts-with-this - First word of the docstring should not be "This".
"D404",
# multi-line-summary-second-line - Multi-line docstring summary should start at the second line.
# This configuration can't be enabled as it's incompatible with 'D212' (multi-line-summary-first-line).
"D213",
# undocumented-param - Missing argument description in the docstring for {definition}: {name}.
"D417",
# pycodestyle
# bare-except - Do not use bare except.
"E722",
# line-too-long - Line too long ({width} > {limit}).
"E501",
# flake8-pytest-style
# pytest-missing-fixture-name-underscore - Fixture '{function}' does not return anything, add leading underscore.
"PT004",
# pytest-incorrect-fixture-name-underscore - Fixture '{function}' returns a value, remove leading underscore.
"PT005",
# pytest-parametrize-values-wrong-type - Wrong values type in '@pytest.mark.parametrize' expected '{values}' of '{row}'.
"PT007",
# pytest-raises-too-broad - 'pytest.raises({exception})' is too broad, set the 'match' parameter or use a more specific exception.
"PT011",
# pytest-raises-with-multiple-statements - 'pytest.raises()' block should contain a single simple statement.
"PT012",
# pytest-incorrect-pytest-import - Found incorrect import of pytest, use simple 'import pytest' instead.
"PT013",
# pytest-assert-in-except - Found assertion on exception '{name}' in 'except' block, use 'pytest.raises()' instead.
"PT017",
# pytest-fixture-param-without-value - Fixture '{name}' without value is injected as parameter, use '@pytest.mark.usefixtures' instead.
"PT019",
# pyupgrade
# printf-string-formatting - Use format specifiers instead of percent format.
"UP031",
# f-string - Use f-string instead of 'format' call.
# This configuration can't be enabled since certain operations in f-strings are forbidden.
# For further details, refer to: 'ci/check_string_formats.py'.
"UP032",
# non-pep695-type-alias
# Syntax not supported by mypy yet, expect using an experimental flag
"UP040"
]
# A list of rule codes or prefixes for which unsafe fixes should be considered safe.
extend-safe-fixes = [
# pydocstyle
"D"
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
# Combines as imports on the same line.
combine-as-imports = true
# Whether to place import from imports before straight imports when sorting.
from-first = true
# The number of lines to place between "direct" and 'import from' imports.
lines-between-types = 1
# Put all imports into the same section bucket.
# This configuration breaks the Python convention.
no-sections = true
# Order imports by type, which is determined by case, in addition to alphabetically.
order-by-type = false