-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
162 lines (146 loc) · 5.63 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
[project]
name = "mex-backend"
version = "0.28.0"
description = "Backend server for the RKI metadata exchange."
authors = [{ name = "MEx Team", email = "[email protected]" }]
readme = { file = "README.md", content-type = "text/markdown" }
license = { file = "LICENSE" }
urls = { Repository = "https://github.com/robert-koch-institut/mex-backend" }
requires-python = ">=3.11,<3.13"
dependencies = [
"backoff>=2,<3",
"black>=24,<25",
"fastapi>=0.115,<1",
"httpx>=0.27,<1",
"jinja2>=3,<4",
"mex-common @ git+https://github.com/robert-koch-institut/[email protected]",
"neo4j>=5,<6",
"pydantic>=2,<3",
"starlette>=0.41,<1",
"uvicorn[standard]>=0.30,<1",
]
optional-dependencies.dev = [
"ipdb>=0.13,<1",
"mypy>=1,<2",
"pytest-cov>=6,<7",
"pytest-random-order>=1,<2",
"pytest>=8,<9",
"ruff>=0.9,<1",
"sphinx>=8,<9",
"types-pytz>=2024,<2025",
]
[project.scripts]
backend = "mex.backend.main:main"
[tool.cruft]
template = "https://github.com/robert-koch-institut/mex-template"
skip = ["CHANGELOG.md", "mex", "tests"]
[tool.ipdb]
context = 5
[tool.mypy]
python_version = "3.11"
show_error_codes = true
strict = true
plugins = ["pydantic.mypy"]
[tool.pdm]
distribution = true
[tool.pdm.scripts]
update-all = { cmd = "pdm update --group :all --update-all --save-compatible" }
lock-all = { cmd = "pdm lock --group :all --python='==3.11.*'" }
install-all = { cmd = "pdm install --group :all --frozen-lockfile" }
export-all = { cmd = "pdm export --group :all --no-hashes -f requirements" }
apidoc = { cmd = "pdm run sphinx-apidoc -f -o docs/source mex" }
sphinx = { cmd = "pdm run sphinx-build -aE -b dirhtml docs docs/dist" }
doc = { composite = ["apidoc", "sphinx"] }
wheel = { cmd = "pdm build --no-sdist" }
mypy-daemon = { cmd = "pdm run dmypy run --timeout 7200 -- mex" }
lint = { cmd = "pre-commit run --all-files" }
unit = { cmd = "pdm run pytest -m 'not integration'" }
test = { cmd = "pdm run pytest" }
all = { composite = ["install-all", "lint", "test", "doc"] }
[tool.pydantic-mypy]
warn_untyped_fields = true
[tool.pytest.ini_options]
addopts = [
"--verbose",
"--cov",
"--no-cov-on-fail",
"--cov-report=term-missing:skip-covered",
"--cov-fail-under=95",
"--cov-branch",
"--pdbcls=IPython.terminal.debugger:TerminalPdb",
"--random-order-bucket=global",
]
markers = "integration: mark a test as integration test"
[tool.ruff]
fix = true
line-length = 88
show-fixes = true
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
ignore = [
"AIR", # Disable airflow specific rules (we are not using airflow)
"ANN", # Disable all annotations checks (handled by mypy)
"COM", # Disable flake8-commas checks (let ruff format handle that)
"CPY", # Disable copyright notice checks (we have LICENSE files)
"D100", # Allow missing module docstring (for brevity and speed)
"D104", # Allow missing package docstring (for brevity and speed)
"D203", # Disallow blank line before class docstring (inverse of D211)
"D213", # Disallow multi-line docstring starting at second line (inverse of D212)
"D406", # Allow section name ending with newline (google style compat)
"D407", # Allow missing dashed underline after section (google style compat)
"D413", # Allow missing blank line after last section (google style compat)
"DJ", # Disable django specific checks (we are not using django)
"FBT", # Disable boolean type hint checks (for more flexibility)
"FIX", # Allow committing with open TODOs (don't punish committers)
"ISC001", # Disable checks for implicitly concatenated strings (formatter compat)
"N805", # Allow first argument of a method to be non-self (pydantic compat)
"N815", # Allow mixedCase variables in class scope (model compat)
"PTH123", # Allow using builtin open method (simpler than pathlib)
"RUF012", # Allow mutable class attributes (pydantic compat)
"SIM108", # Allow explicit if-else instead of ternary (easier to read)
"TD003", # Allow TODOs without ticket link (don't punish TODO writers)
"TRY003", # Allow long exception message at the raise site (for pydantic)
]
select = ["ALL"]
[tool.ruff.lint.per-file-ignores]
"mex/backend/logging.py" = [
"A005", # Allow custom logging module to shadow standard-library
]
"mex/backend/types.py" = [
"A005", # Allow custom types module to shadow standard-library
]
"docs/**" = [
"INP001", # Docs folder does not need to be a package
]
"scripts/**" = [
"INP001", # Scripts folder does not need to be a package
]
"**/main.py" = [
"N803", # Allow dromedaryCase query parameters
]
"tests/**" = [
"ARG005", # Allow unused lambda arguments for mocking
"D101", # Allow missing docstring in public class
"D102", # Allow missing docstring in public method
"D103", # Allow missing docstring in public function
"D107", # Allow missing docstring in `__init__`
"E501", # Allow longer lines with test data
"ISC", # Allow implicitly concatenated strings
"N807", # Allow mocking `__init__`
"PLR0915", # Allow functions with many statements
"PLR2004", # Allow comparing with static values
"PT004", # Allow public fixtures without returns
"PT013", # Allow more flexible pytest imports
"S101", # Allow use of `assert` in tests
"SLF", # Allow private member access
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
"reflex" = "rx"
[tool.ruff.lint.isort]
known-first-party = ["mex", "tests"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[build-system]
requires = ["pdm-backend==2.4.3"]
build-backend = "pdm.backend"