-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
350 lines (322 loc) · 9.55 KB
/
Copy pathpyproject.toml
File metadata and controls
350 lines (322 loc) · 9.55 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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
[project]
name = "linux-benchmark-lib"
version = "0.67.0"
description = "A robust and configurable Python library for benchmarking Linux computational node performance"
readme = "README.md"
requires-python = ">=3.12"
authors = [
{ name = "Your Name", email = "your.email@example.com" }
]
dependencies = [
"psutil>=7.0.0",
"pandas>=2.0.0",
"numpy>=1.24.0",
"jc>=1.25.0",
"PyYAML>=6.0",
"pydantic>=2.11.4",
"structlog>=24.2.0",
"plyer>=2.1.0",
"pystray>=0.19.5",
"pillow>=12.0.0",
"desktop-notifier>=6.2.0",
]
[project.optional-dependencies]
dfaas = [
"fabric>=3.2.2",
"invoke>=2.2.1",
]
peva_faas = [
"duckdb>=1.1.0",
"pyarrow>=17.0.0",
]
ui = [
"rich>=13.7.0",
"typer>=0.12.5",
"rapidfuzz>=3.0.0",
"prompt_toolkit>=3.0.0",
]
controller = [
"ansible-runner>=2.4.0",
"ansible-core>=2.15.0",
"matplotlib>=3.7.0",
"seaborn>=0.12.0",
]
dev = [
"fabric>=3.2.2",
"invoke>=2.2.1",
"duckdb>=1.1.0",
"pyarrow>=17.0.0",
"rich>=13.7.0",
"typer>=0.12.5",
"rapidfuzz>=3.0.0",
"prompt_toolkit>=3.0.0",
"PySide6>=6.6.0",
"pytest-cov>=4.1.0",
"vulture>=2.10",
"molecule>=6",
"molecule-plugins[delegated]",
"ansible-core>=2.15.0",
"flake8-cognitive-complexity>=0.1.0",
]
docs = [
"mkdocs>=1.6",
"mkdocs-material>=9.5",
"mkdocstrings[python]>=0.26",
"rich>=13.7.0",
"typer>=0.12.5",
"rapidfuzz>=3.0.0",
"prompt_toolkit>=3.0.0",
]
gui = [
"PySide6>=6.6.0",
]
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
include = ["lb_runner*", "lb_controller*", "lb_ui*", "lb_gui*", "lb_analytics*", "lb_provisioner*", "lb_app*", "lb_common*", "lb_plugins*"]
exclude = ["reports*", "data_exports*", "benchmark_results*", "tests*"]
[tool.setuptools.package-data]
lb_plugins = [
"plugins/**/*",
]
lb_controller = [
"ansible/**/*",
]
lb_provisioner = [
"assets/**/*",
]
lb_gui = [
"resources/**/*",
]
[project.scripts]
lb = "lb_ui.cli.main:main"
lb-ui = "lb_ui.cli.main:main"
lb-gui = "lb_gui.main:main"
[project.entry-points."linux_benchmark.collectors"]
psutil = "lb_runner.metric_collectors.builtin:PSUTIL_COLLECTOR"
cli = "lb_runner.metric_collectors.builtin:CLI_COLLECTOR"
[project.entry-points."linux_benchmark.workloads"]
stress_ng = "lb_plugins.plugins.stress_ng.plugin:PLUGIN"
fio = "lb_plugins.plugins.fio.plugin:PLUGIN"
dd = "lb_plugins.plugins.dd.plugin:PLUGIN"
hpl = "lb_plugins.plugins.hpl.plugin:PLUGIN"
stream = "lb_plugins.plugins.stream.plugin:PLUGIN"
[tool.uv]
package = true
[tool.black]
line-length = 88
target-version = ['py312']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q --strict-markers"
testpaths = ["tests"]
markers = [
# Test levels
"unit: all unit tests (fast, isolated)",
"integration: integration tests (service-level)",
"e2e: end-to-end tests (full stack)",
# Module-specific unit markers
"unit_runner: tests for the lb_runner package (execution, local logic)",
"unit_controller: tests for the lb_controller package (orchestration, state)",
"unit_ui: tests for the User Interface (CLI commands, TUI, prompts)",
"unit_provisioner: tests for provisioning logic (Multipass, Docker)",
"unit_analytics: tests for lb_analytics (data processing, reporting)",
"unit_plugins: unit tests specific to workload plugins",
"unit_baseline: unit tests for the baseline workload plugin",
"unit_common: tests for lb_common utilities",
# Integration markers (legacy naming)
"inter_generic: marks tests as integration tests (deselect with '-m \"not inter_generic\"')",
"inter_docker: integration tests that build/run plugin Docker images",
"inter_multipass: integration tests that validate plugin multipass/ansible assets",
"inter_multipass_single: multipass e2e per-workload runs with artifact checks",
"inter_e2e: full end-to-end tests (e.g., with real VMs)",
"inter_plugins: integration tests specific to workload plugins",
"inter_baseline: integration tests for the baseline workload plugin",
# Performance markers
"slow: tests that require > 1 second",
"slowest: very slow tests (minutes) such as VM provisioning",
]
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
[tool.mypy]
python_version = "3.12"
plugins = ["pydantic.mypy"]
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
exclude = '''(?x)(
^molecule/
| ^lb_controller/ansible/collections/ansible_collections/
| ^lb_plugins/plugins/_user/
| (^|.*/)__pycache__/
)'''
[[tool.mypy.overrides]]
module = [
"ansible",
"ansible.*",
"duckdb",
"duckdb.*",
"fabric",
"fabric.*",
"invoke",
"invoke.*",
"matplotlib",
"matplotlib.*",
"pandas",
"pandas.*",
"pyarrow",
"pyarrow.*",
"psutil",
"psutil.*",
"seaborn",
"seaborn.*",
"yaml",
"yaml.*",
"plyer",
"plyer.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
"lb_controller.ansible.callback_plugins.lb_events",
]
disable_error_code = ["import-not-found"]
[[tool.mypy.overrides]]
module = [
"lb_plugins.plugins.peva_faas.services.memory_checkpoint",
"lb_plugins.plugins.peva_faas.services.memory_store",
"lb_plugins.plugins.dfaas.services.k6_runner",
]
disable_error_code = ["import-not-found"]
[[tool.mypy.overrides]]
module = [
"lb_ui.services.tray",
"lb_ui.notifications.providers.desktop",
]
disable_error_code = ["import-untyped"]
[tool.pydocstyle]
inherit = false
ignore = "D100,D104,D203,D213"
match-dir = "(?!tests).*"
[dependency-groups]
dev = [
"pytest>=7.3.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"psutil>=7.0.0",
"fabric>=3.2.2",
"invoke>=2.2.1",
"duckdb>=1.1.0",
"pyarrow>=17.0.0",
"pandas-stubs>=2.2.0.240218",
"rich>=13.7.0",
"typer>=0.12.5",
"rapidfuzz>=3.0.0",
"prompt_toolkit>=3.0.0",
"PySide6>=6.6.0",
"black>=23.0.0",
"flake8>=6.0.0",
"flake8-tidy-imports>=4.12.0",
"pydocstyle>=6.3.0",
"mypy>=1.0.0",
"pre-commit>=3.2.0",
"ansible-runner>=2.4.0",
"vulture>=2.10",
"flake8-cognitive-complexity>=0.1.0",
"ruff>=0.14.10",
"coverage>=7.13.0",
"radon>=6.0.1",
"xenon>=0.9.3",
"lizard>=1.19.0",
"grimp>=3.14",
"import-linter>=2.9",
"pydeps>=3.0.1",
"pyan3>=1.2.0",
"deptry>=0.24.0",
"pip-audit>=2.9.0",
"bandit>=1.9.2",
"semgrep>=1.86.0",
"tenacity>=9.1.2",
"types-PyYAML>=6.0.12.20250822",
"types-psutil>=7.0.0.20250601",
"types-seaborn>=0.13.2.20250914",
]
[tool.deptry]
extend_exclude = ["molecule"]
per_rule_ignores = { DEP001 = ["controller_stop_runner"], DEP002 = ["pytest-cov", "vulture", "molecule", "molecule-plugins", "flake8-cognitive-complexity", "mkdocs", "mkdocs-material", "mkdocstrings"] }
# =============================================================================
# Import Linter - Enforces layered architecture import boundaries
# =============================================================================
# Run with: uv run lint-imports
#
# Architecture:
# lb_common (base) <- lb_plugins <- lb_runner <- lb_controller <- lb_app <- lb_ui
# lb_analytics and lb_provisioner are siblings at the lb_app level
#
# These contracts enforce that packages only import from allowed lower layers.
# The .api boundary enforcement is handled by scripts/check_api_imports.py
# because import-linter tracks transitive imports which don't work well with
# re-exports from .api modules.
[tool.importlinter]
root_packages = ["lb_common", "lb_plugins", "lb_runner", "lb_controller", "lb_app", "lb_ui", "lb_gui", "lb_analytics", "lb_provisioner"]
include_external_packages = false
# Layered architecture contract - enforces the dependency hierarchy
# Note: lb_controller, lb_analytics, lb_provisioner are at the same level (can't import each other)
[[tool.importlinter.contracts]]
name = "Layered architecture"
type = "layers"
layers = [
"lb_ui : lb_gui",
"lb_app",
"lb_controller",
"lb_runner",
"lb_plugins",
"lb_common",
]
# lb_plugins has a known dependency on lb_runner for log_manager services
# This is a design decision to allow plugins to use runner's logging facilities
ignore_imports = [
"lb_plugins.plugins.dfaas.services.log_manager -> lb_runner.api",
"lb_plugins.plugins.peva_faas.services.log_manager -> lb_runner.api",
]
# lb_analytics is isolated - only imports from lb_common
[[tool.importlinter.contracts]]
name = "lb_analytics isolation"
type = "forbidden"
source_modules = ["lb_analytics"]
forbidden_modules = ["lb_plugins", "lb_runner", "lb_controller", "lb_app", "lb_ui", "lb_gui", "lb_provisioner"]
# lb_provisioner can only import from lb_common and lb_plugins
[[tool.importlinter.contracts]]
name = "lb_provisioner layer restrictions"
type = "forbidden"
source_modules = ["lb_provisioner"]
forbidden_modules = ["lb_runner", "lb_controller", "lb_app", "lb_ui", "lb_gui", "lb_analytics"]
# Note: The "forbidden" contract type tracks transitive imports, which is not what
# we want for the .api boundary check. Use scripts/check_api_imports.py for that.
# The layers contract above handles the main architecture hierarchy.