Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
338 lines (308 loc) · 8.74 KB
/
Copy pathpyproject.toml
File metadata and controls
338 lines (308 loc) · 8.74 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
# cspell: ignore addopts conftest minversion pyargs posargs PYTHONPYCACHEPREFIX PYTHONIOENCODING PYTHONBREAKPOINT tombi prek
#:tombi schema.strict = false
[project]
name = "ansible-actions"
requires-python = ">=3.12"
dependencies = [
"uv>=0.11.15",
]
dynamic = ["version"]
[project.scripts]
dynamic-matrix = "dynamic_matrix.__main__:main"
[project.optional-dependencies]
action = [
"actions-toolkit>=0.1.15",
]
[dependency-groups]
dev = [
"coverage-enable-subprocess", # see https://github.com/nedbat/coveragepy/issues/1341#issuecomment-1228942657
"coverage[toml] >= 6.4.4",
"pytest-xdist >= 2.1.0",
"pytest >= 9.0.3",
]
lint = [
"actions-toolkit>=0.1.15",
"ansible-lint>=25.9.2",
"codespell[toml]>=2.4.1",
"mypy>=1.18.2",
"prek>=0.3.1",
"pydoclint>=0.8.3",
"pylint>=4.0.2",
"pyright>=1.1.408",
"ruff>=0.14.0",
"shellcheck-py>=0.11.0.1",
"tombi>=0.6.25",
"yamllint>=1.37.1",
]
[build-system]
requires = [
"setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme
"setuptools >= 83.0.0", # required by pyproject+setuptools_scm integration and editable installs
]
build-backend = "setuptools.build_meta"
[tool.codespell]
skip = ".tox,.DS_Store,dist,.ruff_cache,.venv,.mypy_cache,build,.git,.eggs,pip-wheel-metadata,node_modules,package-lock.json,uv.lock"
# Keep this default because xml/report do not know to use load it from config file:
# data_file = ".coverage"
[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]
[tool.coverage.report]
exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"]
omit = ["tests/*"]
# Increase it just so it would pass on any single-python run
fail_under = 92
# During development we might remove code (files) with coverage data, and we dont want to fail:
ignore_errors = true
partial_branches = ["pragma: no cover", "if TYPE_CHECKING:"]
show_missing = true
skip_covered = true
skip_empty = true
[tool.coverage.run]
# branch is more reliable than lines, protects against false positives
branch = true
concurrency = ["multiprocessing", "thread"]
parallel = true
relative_files = true
source = ["src"]
[tool.mypy]
color_output = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_untyped_calls = true
disallow_untyped_defs = true
error_summary = true
exclude_gitignore = true
# https://github.com/python/mypy/issues/12664
follow_untyped_imports = true
incremental = false
no_implicit_optional = true
show_error_code_links = true
strict = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
exclude = [
".tox",
".venv",
"node_modules",
"build",
"dist",
"venv",
]
[[tool.mypy.overrides]]
module = ["actions_toolkit"]
ignore_missing_imports = true
implicit_reexport = true
ignore_errors = true
[tool.pydoclint]
allow-init-docstring = true
arg-type-hints-in-docstring = false
baseline = ".config/pydoclint-baseline.txt"
check-return-types = false
exclude = '\.git|\.tox|build|collections|out|venv|node_modules'
should-document-private-class-attributes = true
show-filenames-in-every-violation-message = true
skip-checking-short-docstrings = false
style = "google"
[tool.pylint.main]
ignore-paths = ".tox|.venv|node_modules"
[tool.pylint.reports]
output-format = "colorized"
[tool.pylint.messages_control]
disable = [
"line-too-long", # covered by ruff
]
[tool.pyright]
include = ["src"]
# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
pythonVersion = "3.12"
# https://github.com/microsoft/pyright/issues/777
"stubPath" = ""
# spell-checker:ignore filterwarnings norecursedirs optionflags
[tool.pytest]
# do not add options here as this will likely break either console runs or IDE
# integration like vscode or pycharm
addopts = ["-p", "no:pytest_cov"]
# https://code.visualstudio.com/docs/python/testing
# coverage is re-enabled in `tox.ini`. That approach is safer than
# `--no-cov` which prevents activation from tox.ini and which also fails
# when plugin is effectively missing.
doctest_optionflags = ["ALLOW_UNICODE", "ELLIPSIS"]
filterwarnings = [
# We raise one non critical warning from our own conftest.py:
"always::pytest.PytestWarning",
"error",
# py312 ansible-core
# https://github.com/ansible/ansible/issues/81906
"ignore:'importlib.abc.TraversableResources' is deprecated and slated for removal in Python 3.14:DeprecationWarning",
# https://github.com/ansible/ansible/pull/80968
"ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning",
# https://sourceforge.net/p/ruamel-yaml/tickets/452/
"ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning",
# https://github.com/spdx/tools-python/issues/507
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
]
minversion = "4.6.6"
norecursedirs = [
"*.egg",
".cache",
".eggs",
".git",
".github",
".mypy_cache",
".projects",
".tox",
"build",
"collections",
"dist",
"docs",
"node_modules",
]
python_files = [
# Ref: https://docs.pytest.org/en/latest/reference.html#confval-python_files
# Needed to discover legacy nose test modules:
"Test*.py",
"test_*.py",
]
strict = true
[tool.ruff]
target-version = "py312"
# Same as Black.
line-length = 88
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"COM812", # conflict with formatter
"CPY001", # no copyright header required
"D203", # incompatible with D211
"D213", # incompatible with D212
"E501", # we use black
"ERA001", # auto-removal of commented out code affects development and vscode integration
"INP001", # "is part of an implicit namespace package", all false positives
"PLW2901", # PLW2901: Redefined loop variable
"RET504", # Unnecessary variable assignment before `return` statement
"S603", # https://github.com/astral-sh/ruff/issues/4045
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["SLF001", "S101", "FBT001"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.tox]
min_version = "4.21.2"
env_list = ["lint", "py", "image"]
isolated_build = true
skip_missing_interpreters = true
requires = [
"tox>=4.28.4",
"tox-extra >= 2.0.2",
"tox-uv >= 1.28.0",
"setuptools >= 83.0.0", # editable installs
]
[tool.tox.env.deps]
commands = [
[
"prek",
"run",
"--all-files",
"--show-diff-on-failure",
"--hook-stage",
"manual",
"deps",
],
["prek", "autoupdate"],
["npx", "ncu", "-u"],
["tox", "-e", "lint"],
]
commands_pre = []
description = "Bump all test dependencies"
dependency_groups = ["lint"]
[tool.tox.env.hooks]
commands = [["{tox_root}/tools/test-hooks.sh"]]
dependency_groups = ["lint"]
description = "Validate prek hooks definitions"
[tool.tox.env.image]
dependency_groups = []
description = "Run the tests in a container"
skip_install = true
commands = [
["docker", "build", "-t", "ansible-actions", "."],
["docker", "run", "-i", "--rm", "ansible-actions"],
]
allowlist_externals = ["docker", "sh"]
[tool.tox.env.lint]
description = "Run all linters"
dependency_groups = ["lint"]
commands_pre = []
commands = [["prek", "run", "--all-files", "--show-diff-on-failure"]]
[tool.tox.env_run_base]
description = """Run the tests: py{py_dot_ver}"""
dependency_groups = ["dev"]
extras = ["action"]
commands_pre = [
["sh", "-c", "rm -f {env_dir}/.coverage.* 2>/dev/null || true"],
# safety measure to assure we do not accidentally run tests with broken dependencies
["uv", "pip", "check"],
]
commands = [
[
"{env_python}",
"-m",
"coverage",
"run",
"-m",
"pytest",
{ default = [
"-v",
"-n",
"0",
"--durations=10",
"--doctest-modules",
"--showlocals",
"-ra",
], extend = true, replace = "posargs" },
],
["{tox_root}/tools/report-coverage"],
]
pass_env = [
"CURL_CA_BUNDLE", # https proxies, https://github.com/tox-dev/tox/issues/1437
"FORCE_COLOR",
"HOME",
"NO_COLOR",
"PYTEST_*", # allows developer to define their own preferences
"PYTHON*", # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
"PY_COLORS",
"RTD_TOKEN",
"REQUESTS_CA_BUNDLE", # https proxies
"SETUPTOOLS_SCM_DEBUG",
"SSL_CERT_FILE", # https proxies
"SSH_AUTH_SOCK", # may be needed by git
"LANG",
"LC_*",
"PRE_COMMIT_HOME",
"UV_*",
]
allowlist_externals = [
"bash",
"find",
"git",
"pwd",
"rm",
"sh",
"tox",
"{tox_root}/tools/test-hooks.sh",
"{tox_root}/tools/report-coverage",
]
# https://tox.wiki/en/latest/upgrading.html#editable-mode
package = "editable"
[tool.tox.env_run_base.set_env]
COVERAGE_FILE = "{env:COVERAGE_FILE:{env_dir}/.coverage.{env_name}}"
COVERAGE_PROCESS_START = "{tox_root}/pyproject.toml"
PRE_COMMIT_COLOR = "always"
FORCE_COLOR = "1"
[tool.uv]
# default-groups = "All"
package = true
[tool.uv.workspace]
# avoids a warning when running uv in verbose mode as it looks for
# a `pyproject.toml` file one level up.
members = ["./"]