-
Notifications
You must be signed in to change notification settings - Fork 4
/
pyproject.toml
193 lines (166 loc) · 4.26 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
[project]
name = "kio"
authors = [
{ name="Anton Agestam", email="anton.agestam@aiven.io" },
]
description = "Python data types for the Apache Kafka® Protocol."
license = {text = "Apache-2.0 license"}
requires-python = ">=3.11"
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Typing :: Typed",
"Topic :: Database",
]
dynamic = ["version", "readme"]
dependencies = [
"typing-extensions>=4.6.0",
]
[project.optional-dependencies]
test = [
"pytest",
"pytest-asyncio",
"pytest-icdiff",
"pytest-random-order",
"hypothesis>=6.61.0",
"coverage",
]
codegen = [
"pydantic>=1.10.4,<2",
"requests",
"pre-commit",
]
all = [
"kio[test]",
"kio[codegen]",
]
[project.urls]
"Source Repository" = "https://github.com/Aiven-Open/kio"
"Documentation" = "https://aiven-open.github.io/kio/"
"Bug Tracker" = "https://github.com/Aiven-Open/kio/issues"
[build-system]
requires = ["setuptools==75.1.0", "setuptools-scm==8.1.0", "wheel==0.44.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true
[tool.setuptools.dynamic]
version = {attr = "kio.__version__"}
readme = {file = "README.md", content-type = "text/markdown; charset=UTF-8"}
[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
[tool.setuptools_scm]
version_file = "src/kio/_version.py"
[tool.check-manifest]
ignore = ["src/kio/_version.py"]
[tool.black]
target-version = ["py311"]
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
addopts = """\
--doctest-modules \
--random-order-bucket=global \
--durations=5 \
"""
asyncio_mode = "auto"
# Promote warnings to errors.
filterwarnings = [
"error",
'ignore: ast\.[A-z]+ is deprecated:DeprecationWarning',
'ignore: Attribute s is deprecated and will be removed:DeprecationWarning',
]
markers = [
"integration: marks tests interacting with a running Apache Kafka® instance",
"roundtrip: marks roundtrip Hypothesis serialization tests",
"java: marks tests validating serialization against a Java process",
]
[tool.ruff]
fix = true
target-version = "py311"
[tool.ruff.lint]
extend-select = [
# bugbear
"B",
# comprehensions
"C4",
# mccabe
"C90",
# bandit
"S",
# blind exception
# Bare excepts are caught without this, but this also catches `except Exception: ...`.
"BLE",
# builtins
"A",
# Enforce valid noqa comments.
"RUF100",
# isort
"I",
# pycodestyle
"W",
# pyupgrade
"UP",
# debugger
"T10",
# print
"T20",
# quotes
"Q",
# simplify
"SIM",
# tidy imports
# We use this to only outlaw relative _parent_ imports, other relative imports are OK.
"TID",
]
extend-ignore = [
# There's no reason to outlaw asserts.
# https://stackoverflow.com/a/68429294/1220706
"S101",
# Ignore line-length. This is enforced by black, but all cases cannot be handled.
# Ideally we'd only suppress this in generated files.
"E501",
# Allow function calls in argument defaults.
"B008",
# Bad advice, builtin syntax is simpler than imports.
"SIM105",
]
[tool.ruff.lint.isort]
lines-between-types = 1
force-single-line = true
known-first-party = ["kio", "tests", "codegen"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
[tool.importlinter]
root_packages = ["kio", "codegen", "tests"]
[[tool.importlinter.contracts]]
name = "kio.schema.* does not depend on kio.serial.*"
type = "forbidden"
source_modules = "kio.schema"
forbidden_modules = "kio.serial"
[[tool.importlinter.contracts]]
name = "kio does not depend on codegen"
type = "forbidden"
source_modules = "kio"
forbidden_modules = "codegen"
[[tool.importlinter.contracts]]
name = "kio does not depend on tests"
type = "forbidden"
source_modules = "kio"
forbidden_modules = "tests"
[[tool.importlinter.contracts]]
name = "codegen does not depend on tests"
type = "forbidden"
source_modules = "codegen"
forbidden_modules = "tests"
[[tool.importlinter.contracts]]
name = "kio.static.primitive is independent"
type = "forbidden"
source_modules = "kio.static.primitive"
forbidden_modules = ["kio.*", "kio.schema.*"]