-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
296 lines (255 loc) · 8.27 KB
/
pyproject.toml
File metadata and controls
296 lines (255 loc) · 8.27 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
[project]
name = "m4-2-sql-to-arc"
dynamic = ["version"]
description = "The FAIRagro SQL-to-ARC client"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"sql_to_arc",
]
[dependency-groups]
dev = [
"httpx>=0.28.1",
"pylint>=4.0.4",
"pytest>=9.0.2",
"pytest-asyncio>=1.1.0",
"pytest-cov>=7.0.0",
"pytest-env>=1.2.0",
"pytest-mock>=3.10.0",
"mypy>=1.19.0",
"bandit>=1.7.0",
"ruff>=0.15.10",
"pre-commit>=4.0.0",
"respx>=0.20.0",
"fastapi>=0.135.3",
"uvicorn>=0.42.0",
]
[tool.uv.sources]
sql_to_arc = { workspace = true }
api_client = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/api_client" }
shared = { git = "https://github.com/fairagro/m4.2_advanced_middleware_api.git", branch = "main", subdirectory = "middleware/shared" }
[tool.uv.workspace]
members = [
"middleware/sql_to_arc",
]
[tool.ruff]
# Exclude directories from linting and formatting
exclude = [
".venv",
"venv",
".git",
"__pycache__",
"*.egg-info",
".pytest_cache",
".mypy_cache",
".ruff_cache",
"build",
"dist",
]
# Welche Regel-Sets aktiviert sind:
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort (import sorting)
"C90", # mccabe (Komplexität)
"N", # pep8-naming
"D", # pydocstyle (Docstrings)
"UP", # pyupgrade
"B", # bugbear
"SIM", # flake8-simplify
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"BLE", # flake8-blind-except (fängt zu generische Exceptions ab)
"PLR", # Pylint Refactor (inkl. complexity rules wie too-many-return-statements)
"SLF", # flake8-self (Private member access)
]
# Muss für PLR0917 aktiviert sein
preview = true
# Maximale Zeilenlänge wie in pylint (Standard: 100)
line-length = 120
# Formatierungs-Einstellungen (konsistent mit Black)
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
# Für cyclomatic complexity, entspricht pylint's R1260 etc.
[tool.ruff.lint.mccabe]
max-complexity = 10
# Import sorting (replaces isort)
[tool.ruff.lint.isort]
known-first-party = ["middleware"]
force-single-line = false
combine-as-imports = true
[tool.ruff.lint.per-file-ignores]
"middleware/*/tests/**/*.py" = ["SLF001"]
# Black and isort replaced by ruff format - configurations removed to avoid conflicts
[tool.mypy]
python_version = "3.12"
mypy_path = "middleware/sql_to_arc/src"
namespace_packages = true
explicit_package_bases = true
strict = true
plugins = ["pydantic.mypy"]
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
explicit_package_bases = true
namespace_packages = true
# Exclude directories from type checking
exclude = [
".venv",
"venv",
".git",
"__pycache__",
"build",
"dist",
".pytest_cache",
".mypy_cache",
".ruff_cache",
]
# arctrl has no type stubs and no py.typed marker — suppress the resulting noise.
# The Fable-transpiled internals live under arctrl.py.* so both patterns are needed.
[[tool.mypy.overrides]]
module = ["arctrl", "arctrl.*"]
ignore_missing_imports = true
# Docstring-Regeln aktivieren, damit es wie pylint C0114/15/16 meckert
[tool.ruff.lint.pydocstyle]
convention = "pep257" # oder "numpy", oder "google"
[tool.pytest.ini_options]
# Test discovery
testpaths = ["middleware/*/tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# Output and behavior
addopts = [
"-v", # Verbose output
"--strict-markers", # Treat unregistered markers as errors
"--tb=short", # Shorter traceback format
"--cov=middleware", # Enable coverage for middleware packages
"--cov-report=term-missing", # Show missing lines in terminal
"--cov-report=html", # Generate HTML coverage report
"--cov-report=xml", # Generate XML coverage report (for CI)
"--cov-fail-under=80", # Fail if coverage is below 80%
]
# Asyncio mode
asyncio_mode = "auto"
# Custom markers
markers = [
"asyncio: marks tests as async",
"unit: marks tests as unit tests",
"integration: marks tests as integration tests",
"system: marks tests as system tests",
]
[tool.coverage.run]
# Coverage measurement settings
source = ["middleware"]
omit = [
"*/tests/*",
"*/__pycache__/*",
"*/.venv/*",
"*/venv/*",
"*/.pytest_cache/*",
"*/build/*",
"*/dist/*",
"*/*.egg-info/*",
]
branch = true # Measure branch coverage
[tool.coverage.report]
# Coverage reporting settings
precision = 2
show_missing = true
skip_covered = false
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
"@abc.abstractmethod",
]
[tool.coverage.html]
directory = "htmlcov"
[tool.pylint.format]
max-line-length = 120
[tool.pylint.master]
# Ignore directories
ignore = [".venv", "venv", ".git", "__pycache__", "build", "dist"]
ignore-patterns = ["^\\..*", ".*\\.egg-info"]
# Fail if the score is below 8.0
fail-under = 8.0
[tool.pylint.messages_control]
# Disable checks that are already covered by ruff
disable = [
# Docstring checks (covered by ruff pydocstyle D-series)
"C0114", # missing-module-docstring -> ruff D100
"C0115", # missing-class-docstring -> ruff D101
"C0116", # missing-function-docstring -> ruff D103
# Import checks (covered by ruff pyflakes F, isort I)
"C0411", # wrong-import-order -> ruff I001
"C0412", # ungrouped-imports -> ruff I001
"C0413", # wrong-import-position -> ruff E402
"W0611", # unused-import -> ruff F401
"W0614", # unused-wildcard-import -> ruff F403, F405
# Code style checks (covered by ruff pycodestyle E/W)
"C0303", # trailing-whitespace -> ruff W291
"C0304", # missing-final-newline -> ruff W292
"C0305", # trailing-newlines -> ruff W391
"C0321", # multiple-statements -> ruff E701, E702
"C0325", # superfluous-parens -> ruff UP034
"W0311", # bad-indentation -> ruff E111, E117
"W0301", # unnecessary-semicolon -> ruff E703
# Naming checks (covered by ruff pep8-naming N-series)
"C0103", # invalid-name -> ruff N801-N807
# Complexity checks (covered by ruff mccabe C90)
"R0912", # too-many-branches -> ruff C901
"R0915", # too-many-statements -> ruff C901
# Bugbear/pyflakes checks (covered by ruff bugbear B, pyflakes F)
"W0101", # unreachable -> ruff F401
"W0102", # dangerous-default-value -> ruff B006
"W0107", # unnecessary-pass -> ruff PIE790
"W0125", # using-constant-test -> ruff B015
"W0511", # TODO comment found
"W0612", # unused-variable -> ruff F841
"W0613", # unused-argument -> ruff ARG001-005
"W0621", # redefined-outer-name -> ruff F811
"W0622", # redefined-builtin -> ruff A001-A003
# Simplification checks (covered by ruff flake8-simplify SIM)
"R1705", # no-else-return -> ruff SIM103
"R1714", # consider-using-in -> ruff SIM118
"R1715", # consider-using-get -> ruff SIM401
"R1720", # no-else-raise -> ruff SIM102
"R1724", # no-else-continue -> ruff SIM114
"R1728", # consider-using-generator -> ruff C417
# Pyupgrade checks (covered by ruff pyupgrade UP)
"R1711", # useless-return -> ruff UP034
"C0206", # consider-using-dict-items -> ruff UP015
# Additional opinionated/style checks often handled by formatters
"R0903", # too-few-public-methods (opinionated, often not relevant)
"R0913", # too-many-arguments (opinionated, case-by-case basis)
"R0917", # too-many-positional-arguments (handled by ruff PLR0917)
"C0301", # line-too-long (handled by ruff formatter)
"R0801", # duplicate-code (can be noisy in tests)
"R0914", # too-many-locals (handled by ruff PLR0914)
# Exception checks (covered by ruff BLE001)
"W0718", # broad-exception-caught
"W0703", # broad-except
# Private member access
"W0212", # protected-access
]
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.targets.wheel]
include = ["README.md"]
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"