forked from mlrun/mlrun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
186 lines (167 loc) · 4.37 KB
/
pyproject.toml
File metadata and controls
186 lines (167 loc) · 4.37 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
[build-system]
requires = [
"setuptools>=80.9.0",
]
[tool.ruff]
target-version = "py311"
required-version = ">=0.15.2"
[tool.ruff.lint]
extend-select = [
"F", # pyflakes
"W", # pycodestyle
"E", # pycodestyle
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"CPY", # flake8-copyright
"B006", # mutable default arguments
"RUF013", # forbid implicit `Optional` type hints
]
# Ignoring UP007 for now. See ticket ML-11573 for investigating runtime-safety of converting certain type
# annotations to PEP 604 (`X | Y`) syntax.
ignore = ["UP007"]
explicit-preview-rules = true
[tool.ruff.lint.isort]
known-first-party = ["mlrun", "mlrun_pipelines"]
known-local-folder = ["services", "framework"]
[tool.ruff.lint.pycodestyle]
max-line-length = 120
[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = ["F401"]
"docs/**.py" = ["CPY001"]
"*.ipynb" = ["ALL"] # TODO: enable linting rules on Jupyter notebooks
[tool.ruff.lint.flake8-copyright]
author = "Iguazio"
[tool.ruff.format]
docstring-code-format = true
[tool.uv]
required-version = ">=0.7.14"
[tool.uv.pip]
python-version = "3.11"
generate-hashes = true
universal = true
[tool.pytest.ini_options]
addopts = "-v -rf --disable-warnings --import-mode=importlib"
pythonpath = "./server/py" # This allows running server side tests from the project root directory
python_files = [
"tests/*/test_*.py",
"tests/test_*.py",
"server/py/*/tests/unit/test_*.py",
"server/py/*/tests/unit/*/test_*.py",
]
timeout = 1800 # 30 minutes per test
log_cli = true
log_level = "DEBUG"
asyncio_mode = "auto"
markers = [
"collect_pod_logs: collect pod logs on test failure for debugging",
]
[tool.importlinter]
root_packages = [
"mlrun",
"tests",
"server.py.services",
"server.py.framework",
]
include_external_packages = true
[[tool.importlinter.contracts]]
name = "Common modules shouldn't import other mlrun utilities"
type = "forbidden"
source_modules = [
"mlrun.common",
]
forbidden_modules = [
"mlrun.artifacts",
"mlrun.data_types",
"mlrun.datastore",
"mlrun.db",
"mlrun.feature_store",
"mlrun.frameworks",
"mlrun.launcher",
"mlrun.model_monitoring",
"mlrun.package",
"mlrun.platforms",
"mlrun.projects",
"mlrun.runtimes",
"mlrun.serving",
"mlrun.track",
"mlrun.execution",
"mlrun.features",
"mlrun.k8s_utils",
"mlrun.lists",
"mlrun.model",
"mlrun.render",
"mlrun.run",
"mlrun.secrets",
]
ignore_imports = [
"mlrun.config -> mlrun.db",
"mlrun.utils.clones -> mlrun",
"mlrun.utils.helpers -> mlrun",
]
[[tool.importlinter.contracts]]
name = "MLRun should not directly import kfp [use mlrun_pipelines instead]"
type = "forbidden"
source_modules = [
"mlrun",
"services",
"framework",
"server.py.services",
"server.py.framework",
]
forbidden_modules = [
"kfp",
]
[[tool.importlinter.contracts]]
name = "MLRun server may import mlrun but not the way around"
type = "layers"
layers = [
"server.py.services",
"services",
"framework",
"mlrun",
]
[[tool.importlinter.contracts]]
name = "MLRun tests shouldn't import server code"
type = "forbidden"
source_modules = [
"tests",
]
forbidden_modules = [
"services",
"framework",
"server.py.services",
"server.py.framework",
]
# Ignore integration tests until we have service specific integration tests infrastructure
ignore_imports = [
"tests.integration.sdk_api.alerts.test_alerts -> framework",
]
[[tool.importlinter.contracts]]
name = "MLRun common server code should not import specific services"
type = "forbidden"
source_modules = [
"server.py.framework",
]
forbidden_modules = [
"services",
]
# TODO: Remove when crud moves to framework
ignore_imports = [
"server.py.framework.api.utils -> services",
"server.py.framework.rundb.sqldb -> services",
"server.py.framework.utils.projects.* -> services",
"server.py.framework.utils.notifications -> services",
"server.py.framework.tests.unit.common_fixtures -> services",
"server.py.framework.tests.unit.db.common_fixtures -> services",
]
[tool.coverage.run]
# TODO Files in 'pipeline-adapters' are excluded from coverage unless imported directly. See issue ML-9729.
source=["mlrun", "server/py", "pipeline-adapters"]
omit = [
"test_*.py" ,
"**/tests/*" ,
"**/conftest.py" ,
"server/py/schemas/proto/*"
]
relative_files = true