-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathpyproject.toml
More file actions
358 lines (344 loc) · 12.2 KB
/
Copy pathpyproject.toml
File metadata and controls
358 lines (344 loc) · 12.2 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
351
352
353
354
355
356
357
358
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025 LAVA contributors
[build-system]
build-backend = "setuptools.build_meta"
requires = [ "setuptools>=66.1.1", "setuptools-scm>=7.1.0" ]
[project]
name = "lava"
description = """\
LAVA is a continuous integration system for deploying operating systems onto physical and virtual hardware for \
running tests.\
"""
readme = "README.md"
keywords = [ "automation", "ci", "continuous-integration", "embedded", "hardware", "testing" ]
license = { text = "GPL-2.0-or-later" }
maintainers = [ { name = "LAVA team", email = "lava-team@linaro.org" } ]
authors = [ { name = "LAVA team", email = "lava-team@linaro.org" } ]
requires-python = ">=3.11"
classifiers = [
"Development Status :: 6 - Mature",
"Framework :: Django",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Testing",
]
dynamic = [ "version" ]
dependencies = [
"pyyaml",
"sentry-sdk",
"voluptuous",
]
optional-dependencies.coordinator = []
optional-dependencies.dev = [
"django-stubs",
"lava[full]",
"lava[test]",
"mypy",
"pre-commit==4.6.0",
"pylint",
"pylint-django",
"pyproject-fmt==2.25.1",
"pyrefly==1.1.1",
"ruff==0.15.20",
"ty==0.0.55",
"types-pexpect",
"types-pyyaml",
"types-requests",
]
optional-dependencies.dispatcher = [
"aiohttp",
"configobj",
"jinja2",
"pexpect",
"python-magic",
"pyudev",
"requests",
"setproctitle",
]
optional-dependencies.dispatcher-host = [
"jinja2",
"pyudev",
"requests",
]
optional-dependencies.docs = [
"mkdocs-material",
"pymdown-extensions",
]
optional-dependencies.full = [
"lava[dispatcher]",
"lava[server]",
]
optional-dependencies.server = [
"aiohttp",
"asgiref",
"celery",
"defusedxml",
"django>=4.2,<5.0",
"django-allauth",
"django-environ",
"django-filter",
"django-tables2",
"djangorestframework",
"djangorestframework-filters>=1.0.0.dev2",
"drf-extensions>=0.8.0",
"gunicorn",
"jinja2",
"junit-xml",
"more-itertools",
"psycopg2-binary",
"pyzmq",
"requests",
"tap-py",
"whitenoise",
]
optional-dependencies.test = [
"pytest>=7.0",
"pytest-asyncio",
"pytest-cov",
"pytest-django",
"pytest-mock",
"pytest-random-order",
"pytest-subtests",
"responses",
]
urls.Documentation = "https://docs.lavasoftware.org"
urls.Homepage = "https://lavasoftware.org"
urls.Issues = "https://gitlab.com/lava/lava/-/issues"
urls.Repository = "https://gitlab.com/lava/lava"
# NOTE: package selection, py-modules and console scripts are deliberately
# NOT declared here. The Debian packaging builds each binary package by
# invoking setup.py once per component (see debian/rules), relying on the
# per-component "packages"/"scripts" lists in setup.py to split the source
# tree across lava-common, lava-dispatcher, lava-server, etc. Any of
# [tool.setuptools.packages.find], py-modules or [project.scripts] declared
# here would override those lists and end up installing every module/script
# into every Debian package.
[tool.setuptools]
include-package-data = true
package-data.lava_common = [ "VERSION" ]
package-data.lava_dispatcher = [
"dynamic_vm_keys/lava*",
"lava_test_shell/**/*",
]
package-data.lava_rest_app = [ "templates/**/*.html" ]
package-data.lava_results_app = [
"static/**/*",
"templates/**/*.html",
]
package-data.lava_scheduler_app = [
"static/**/*",
"templates/**/*.html",
"templates/**/*.txt",
]
package-data.lava_server = [
"static/**/*",
"templates/**/*.html",
"templates/robots.txt",
]
zip-safe = false
[tool.setuptools_scm]
version_file = "lava_common/_version.py"
local_scheme = "no-local-version"
tag_regex = "^(?P<version>[0-9]+\\.[0-9]+)$"
[tool.ruff]
target-version = "py311"
line-length = 88
lint.select = [
# "B", # flake8-bugbear
# "E", # pycodestyle errors
# "F", # pyflakes
"I", # isort
# "SIM", # flake8-simplify
"UP", # pyupgrade
# "W", # pycodestyle warnings
]
lint.ignore = [
"E501", # line too long (test data strings, URLs, commands)
"F403", # wildcard imports in Django settings are intentional
"F405", # undefined names from wildcard imports in Django settings
"UP031", # use format specifiers instead of percent format
]
[tool.pylint]
main.disable = [
"C0103", # Method name doesn't conform to snake_case naming style
"C0104", # Disallowed name
"C0114", # Missing module docstring
"C0115", # Missing class docstring
"C0116", # Missing function or method docstring
"C0209", # Formatting a regular string which could be an f-string
"C0411", # Wrong import order. This is handled by `ruff`.
"C0412", # Imports from package %s are not grouped
"C0415", # Import outside toplevel
"design",
"E0202", # An attribute defined in %s line %s hides this method
"E0401", # Unable to import '%s'
"E1101", # Instance of x has no y member
"E5142", # User model imported from django.contrib.auth.models (imported-auth-user)
"format", # Formatting is handled by `ruff`
"R0401", # Cyclic import (%s -> %s)
"R0801", # Duplicate code
"R1702", # Too many nested blocks
"R1705", # Unnecessary "else" after "return"
"R1710", # Either all return statements in a function should return an expression,
# or none of them should.
"R1711", # Useless return at end of function or method
"R1720", # Unnecessary "elif" after "raise"
"R1723", # Unnecessary "else" after "break"
"R1724", # Unnecessary "else" after "continue", remove the "else" and de-indent the code inside it
"R1732", # Consider using 'with' for resource-allocating operations
"W0107", # Unnecessary pass statement
"W0201", # Attribute defined outside __init__
"W0212", # Access to a protected member of a client class
"W0221", # Used when a method has a different number of arguments than
# the implemented interface or in an overridden method.
"W0223", # Method is abstract in class but is not overridden in child class
"W0237", # Parameter has been renamed in overriding method
"W0511", # FIXME comments
"W0603", # Using the global statement
"W0613", # Unused argument
"W0621", # Redefining name from outer scope
"W0622", # Redefining built-in
"W0632", # Possible unbalanced tuple unpacking
"W0707", # Consider explicitly re-raising using 'raise x from y'
"W0718", # Catching too general exception
"W0719", # Raising too general exception
"W1201", # Use lazy % formatting in logging functions
"W1203", # Use lazy % or % formatting in logging functions
"W1309", # Using an f-string that does not have any interpolated variables
"W1509", # Using preexec_fn keyword which may be unsafe in the presence of threads
"W1514", # Using open without explicitly specifying an encoding
]
main.init-hook = """\
import os, sys; os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lava_server.settings.dev'); sys.path.insert(0, \
os.getcwd()); import django; django.setup()\
""" # Fix django apps not being initialized
# Pylint configuration
main.jobs = 0 # Scale number of jobs to number of CPUs
main.load-plugins = "pylint_django"
main.py-version = "3.11" # Debian 12 (bookworm) Python version
main.recursive = true
[tool.codespell]
ignore-words-list = [ "distroname", "hart", "Hart", "Nd", "NotIn" ]
skip = [
".gitlab-ci/analyze/codespell.ignore",
"debian/po/*.po",
"doc/v2/images/*.svg",
"lava_*/static/lava_*/js/*.js",
]
[tool.pyproject-fmt]
keep_full_version = true
# FIXME review the bandit issues
[tool.bandit]
skips = [
"B102", # exec_used] Use of exec detected.
"B104", # hardcoded_bind_all_interfaces] Possible binding to all interfaces.
"B108", # hardcoded_tmp_directory] Probable insecure usage of temp file/directory.
"B113", # request_without_timeout] Call to requests without timeout
"B202", # tarfile_unsafe_members] tarfile.extractall used without any validation.
"B307", # blacklist] Use of possibly insecure function - consider using safer ast.literal_eval.
"B308", # blacklist] Use of mark_safe() may expose cross-site scripting vulnerabilities and should be reviewed.
"B314", # blacklist] Using xml.etree.ElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
"B324", # hashlib] Use of weak MD5 hash for security. Consider usedforsecurity=False
"B411", # blacklist] Using xmlrpc to parse untrusted XML data is known to be vulnerable to XML attacks. Use defusedxml.xmlrpc.monkey_patch() function to monkey-patch xmlrpclib and mitigate XML vulnerabilities.
"B411", # blacklist] Using xmlrpc.client to parse untrusted XML data is known to be vulnerable to XML attacks. Use defusedxml.xmlrpc.monkey_patch() function to monkey-patch xmlrpclib and mitigate XML vulnerabilities.
"B602", # subprocess_popen_with_shell_equals_true] subprocess call with shell=True identified, security issue.
"B604", # any_other_function_with_shell_equals_true] Function call with shell=True parameter identified, possible security issue.
"B610", # django_extra_used] Use of extra potential SQL attack vector.
"B701", # jinja2_autoescape_false] By default, jinja2 sets autoescape to False. Consider using autoescape=True or use the select_autoescape function to mitigate XSS vulnerabilities.
"B703", # django_mark_safe] Potential XSS on mark_safe function.
]
[tool.pyrefly]
# guestfs requires libguestfs-dev (C headers) not available in pre-commit env
errors.missing-import = false
project-includes = [
"lava_common/constants.py",
"lava_common/converters.py",
"lava_common/decorators.py",
"lava_common/device_mappings.py",
"lava_common/exceptions.py",
"lava_common/jinja.py",
"lava_common/log.py",
"lava_common/timeout.py",
"lava_common/utils.py",
"lava_common/version.py",
"lava_common/worker.py",
"lava_common/yaml.py",
"lava_dispatcher/actions/base_strategy.py",
"lava_dispatcher/actions/boot_strategy.py",
"lava_dispatcher/actions/deploy_strategy.py",
"lava_dispatcher/actions/test/mixins.py",
"lava_dispatcher/actions/test_strategy.py",
"lava_dispatcher/utils/compression.py",
"lava_dispatcher/utils/contextmanager.py",
"lava_dispatcher/utils/decorator.py",
"lava_dispatcher/utils/ext4.py",
"lava_dispatcher/utils/filesystem.py",
"lava_dispatcher/utils/installers.py",
"lava_dispatcher/utils/network.py",
"lava_dispatcher/utils/shell.py",
"lava_dispatcher/utils/strings.py",
"lava_dispatcher/utils/vcs.py",
"lava_dispatcher/connection.py",
"lava_dispatcher/deployment_data.py",
]
[tool.ty]
src.include = [
"lava_common/constants.py",
"lava_common/converters.py",
"lava_common/decorators.py",
"lava_common/device_mappings.py",
"lava_common/exceptions.py",
"lava_common/jinja.py",
"lava_common/log.py",
"lava_common/timeout.py",
"lava_common/utils.py",
"lava_common/version.py",
"lava_common/worker.py",
"lava_common/yaml.py",
"lava_dispatcher/actions/base_strategy.py",
"lava_dispatcher/actions/boot_strategy.py",
"lava_dispatcher/actions/deploy_strategy.py",
"lava_dispatcher/actions/test/mixins.py",
"lava_dispatcher/actions/test_strategy.py",
"lava_dispatcher/connection.py",
"lava_dispatcher/deployment_data.py",
"lava_dispatcher/utils/compression.py",
"lava_dispatcher/utils/contextmanager.py",
"lava_dispatcher/utils/decorator.py",
"lava_dispatcher/utils/ext4.py",
"lava_dispatcher/utils/filesystem.py",
"lava_dispatcher/utils/installers.py",
"lava_dispatcher/utils/network.py",
"lava_dispatcher/utils/shell.py",
"lava_dispatcher/utils/strings.py",
"lava_dispatcher/utils/vcs.py",
]
[tool.pytest]
ini_options.junit_family = "xunit2"
ini_options.DJANGO_SETTINGS_MODULE = "tests.settings"
[tool.coverage]
run.omit = [ "*/migrations/*", "*/tests/*" ]
run.source = [
"lava_common",
"lava_dispatcher",
"lava_dispatcher_host",
"lava_rest_app",
"lava_results_app",
"lava_scheduler_app",
"lava_server",
"linaro_django_xmlrpc",
]
report.exclude_lines = [
"def __repr__",
"if TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError",
]
[tool.pycodestyle]
max-line-length = 88
[tool.djangofmt]
profile = "django"