File: pyproject.toml

package info (click to toggle)
python-ansible-compat 25.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 964 kB
  • sloc: python: 2,638; sh: 26; makefile: 24
file content (693 lines) | stat: -rw-r--r-- 23,189 bytes parent folder | download
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
#:tombi schema.strict = false

[project]
name = "ansible-compat"
description = "Ansible compatibility goodies"
readme = "README.md"
# https://peps.python.org/pep-0621/#readme
requires-python = ">=3.10"
license = "MIT"
authors = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }]
maintainers = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }]
keywords = ["ansible"]
classifiers = [
  "Development Status :: 5 - Production/Stable",
  "Environment :: Console",
  "Intended Audience :: Developers",
  "Intended Audience :: Information Technology",
  "Intended Audience :: System Administrators",
  "Operating System :: OS Independent",
  "Programming Language :: Python",
  "Programming Language :: Python :: 3",
  "Programming Language :: Python :: 3.10",
  "Programming Language :: Python :: 3.11",
  "Programming Language :: Python :: 3.12",
  "Programming Language :: Python :: 3.13",
  "Programming Language :: Python :: 3.14",
  "Topic :: Software Development :: Bug Tracking",
  "Topic :: Software Development :: Quality Assurance",
  "Topic :: Software Development :: Testing",
  "Topic :: System :: Systems Administration",
  "Topic :: Utilities",
]
dependencies = [
  "ansible-core>=2.16",
  "jsonschema>=4.6.0",
  "packaging>=22.0",
  "pyyaml>=6.0.1",
  "subprocess-tee>=0.4.1",
]
dynamic = ["version"]

[project.urls]
changelog = "https://github.com/ansible/ansible-compat/releases"
documentation = "https://ansible.readthedocs.io/projects/compat/"
homepage = "https://github.com/ansible/ansible-compat"
repository = "https://github.com/ansible/ansible-compat"

[dependency-groups]
dev = [
  "ansible-core>=2.16",
  "coverage[toml]>=7.10.6",
  "jsonschema>=4.6.0",
  "packaging>=22.0",
  "pip>=25.2",
  "pytest>=7.2.0",
  "pytest-instafail>=0.5.0",
  "pytest-mock>=3.14.1",
  "pytest-plus>=0.6.1",
  "pytest-sugar>=1.1.1",
  "pytest-xdist>=3.8.0",
  "pyyaml>=6.0.1",
  "subprocess-tee>=0.4.1",
  "uv>=0.4.30",
]
docs = ["argparse-manpage>=4.7", "black>=25.1.0", "mkdocs-ansible>=24.3.1"]
lint = ["pip>=25.2", "pre-commit>=4.0.1", "pre-commit-uv>=4.1.4"]
pkg = ["build>=0.9", "pip>=25.2", "twine>=4.0.2"]

[build-system]
requires = [
  "setuptools_scm[toml] >= 7.0.5",  # required for "no-local-version" scheme
  "setuptools >= 65.3.0",  # required by pyproject+setuptools_scm integration and editable installs
]
build-backend = "setuptools.build_meta"

[tool.coverage.report]
exclude_also = ["if TYPE_CHECKING:", "pragma: no cover"]
fail_under = 99
ignore_errors = false
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"]
omit = ["_version.py"]
# avoid failse positive warning, we still fail if coverage level is not met
disable_warnings = ["no-data-collected"]
parallel = true
source = ["src"]

[tool.mypy]
color_output = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_defs = true
error_summary = true
# disallow_any_unimported = True
# ; warn_redundant_casts = True
# warn_return_any = True
# warn_unused_configs = True
exclude = "test/local-content"
python_version = "3.10"

[[tool.mypy.overrides]]
ignore_missing_imports = true
module = "ansible.*"

[[tool.mypy.overrides]]
ignore_errors = true
# generated by setuptools-scm, can be missing during linting
module = "ansible_compat._version"

[tool.pydoclint]
allow-init-docstring = true
arg-type-hints-in-docstring = false
baseline = ".config/pydoclint-baseline.txt"
check-return-types = false
check-yield-types = false
exclude = '\.ansible|\.cache|\.git|\.tox|build|ansible_collections|out|venv'
should-document-private-class-attributes = true
show-filenames-in-every-violation-message = true
skip-checking-short-docstrings = false
style = "google"

[tool.pylint.BASIC]
good-names = [
  "f",  # filename
  "i",
  "j",
  "k",
  "ns",  # namespace
  "ex",
  "Run",
  "_",
]

[tool.pylint.IMPORTS]
preferred-modules = ["unittest:pytest"]

[tool.pylint.master]
# _version.py is generated by setuptools-scm.
ignore-paths = "^src/ansible_compat/_version.py"

[tool.pylint.messages_control]
disable = [
  "unknown-option-value",
  # https://gist.github.com/cidrblock/ec3412bacfeb34dbc2d334c1d53bef83
  "C0103",  # invalid-name / ruff N815
  "C0105",  # typevar-name-incorrect-variance / ruff PLC0105
  "C0112",  # empty-docstring / ruff D419
  "C0113",  # unneeded-not / ruff SIM208
  "C0114",  # missing-module-docstring / ruff D100
  "C0115",  # missing-class-docstring / ruff D101
  "C0116",  # missing-function-docstring / ruff D103
  "C0121",  # singleton-comparison / ruff PLC0121
  "C0123",  # unidiomatic-typecheck / ruff E721
  "C0131",  # typevar-double-variance / ruff PLC0131
  "C0132",  # typevar-name-mismatch / ruff PLC0132
  "C0198",  # bad-docstring-quotes / ruff Q002
  "C0199",  # docstring-first-line-empty / ruff D210
  "C0201",  # consider-iterating-dictionary / ruff SIM118
  "C0202",  # bad-classmethod-argument / ruff PLC0202
  "C0205",  # single-string-used-for-slots / ruff PLC0205
  "C0208",  # use-sequence-for-iteration / ruff PLC0208
  "C0301",  # line-too-long / ruff E501
  "C0303",  # trailing-whitespace / ruff W291
  "C0304",  # missing-final-newline / ruff W292
  "C0321",  # multiple-statements / ruff PLC0321
  "C0410",  # multiple-imports / ruff E401
  "C0411",  # wrong-import-order / ruff I001
  "C0412",  # ungrouped-imports / ruff I001
  "C0413",  # wrong-import-position / ruff E402
  "C0414",  # useless-import-alias / ruff PLC0414
  "C0415",  # import-outside-toplevel / ruff PLC0415
  "C0501",  # consider-using-any-or-all / ruff PLC0501
  "C1901",  # compare-to-empty-string / ruff PLC1901
  "C2201",  # misplaced-comparison-constant / ruff SIM300
  "C2401",  # non-ascii-name / ruff PLC2401
  "C2403",  # non-ascii-module-import / ruff PLC2403
  "C2701",  # import-private-name / ruff PLC2701
  "C2801",  # unnecessary-dunder-call / ruff PLC2801
  "C3001",  # unnecessary-lambda-assignment / ruff E731
  "C3002",  # unnecessary-direct-lambda-call / ruff PLC3002
  "E0001",  # syntax-error / ruff E999
  "E0100",  # init-is-generator / ruff PLE0100
  "E0101",  # return-in-init / ruff PLE0101
  "E0102",  # function-redefined / ruff F811
  "E0103",  # not-in-loop / ruff PLE0103
  "E0104",  # return-outside-function / ruff F706
  "E0105",  # yield-outside-function / ruff F704
  "E0107",  # nonexistent-operator / ruff B002
  "E0112",  # too-many-star-expressions / ruff F622
  "E0115",  # nonlocal-and-global / ruff PLE0115
  "E0116",  # continue-in-finally / ruff PLE0116
  "E0117",  # nonlocal-without-binding / ruff PLE0117
  "E0118",  # used-prior-global-declaration / ruff PLE0118
  "E0211",  # no-method-argument / ruff N805
  "E0213",  # no-self-argument / ruff N805
  "E0237",  # assigning-non-slot / ruff PLE0237
  "E0241",  # duplicate-bases / ruff PLE0241
  "E0302",  # unexpected-special-method-signature / ruff PLE0302
  "E0303",  # invalid-length-returned / ruff PLE0303
  "E0304",  # invalid-bool-returned / ruff PLE0304
  "E0305",  # invalid-index-returned / ruff PLE0305
  "E0308",  # invalid-bytes-returned / ruff PLE0308
  "E0309",  # invalid-hash-returned / ruff PLE0309
  "E0402",  # relative-beyond-top-level / ruff TID252
  "E0602",  # undefined-variable / ruff F821
  "E0603",  # undefined-all-variable / ruff F822
  "E0604",  # invalid-all-object / ruff PLE0604
  "E0605",  # invalid-all-format / ruff PLE0605
  "E0643",  # potential-index-error / ruff PLE0643
  "E0704",  # misplaced-bare-raise / ruff PLE0704
  "E0711",  # notimplemented-raised / ruff F901
  "E1132",  # repeated-keyword / ruff PLE1132
  "E1142",  # await-outside-async / ruff PLE1142
  "E1205",  # logging-too-many-args / ruff PLE1205
  "E1206",  # logging-too-few-args / ruff PLE1206
  "E1300",  # bad-format-character / ruff PLE1300
  "E1301",  # truncated-format-string / ruff F501
  "E1302",  # mixed-format-string / ruff F506
  "E1303",  # format-needs-mapping / ruff F502
  "E1304",  # missing-format-string-key / ruff F524
  "E1305",  # too-many-format-args / ruff F522
  "E1306",  # too-few-format-args / ruff F524
  "E1307",  # bad-string-format-type / ruff PLE1307
  "E1310",  # bad-str-strip-call / ruff PLE1310
  "E1519",  # singledispatch-method / ruff PLE1519
  "E1520",  # singledispatchmethod-function / ruff PLE5120
  "E1700",  # yield-inside-async-function / ruff PLE1700
  "E2502",  # bidirectional-unicode / ruff PLE2502
  "E2510",  # invalid-character-backspace / ruff PLE2510
  "E2512",  # invalid-character-sub / ruff PLE2512
  "E2513",  # invalid-character-esc / ruff PLE2513
  "E2514",  # invalid-character-nul / ruff PLE2514
  "E2515",  # invalid-character-zero-width-space / ruff PLE2515
  "E4703",  # modified-iterating-set / ruff PLE4703
  "R0123",  # literal-comparison / ruff F632
  "R0124",  # comparison-with-itself / ruff PLR0124
  "R0133",  # comparison-of-constants / ruff PLR0133
  "R0202",  # no-classmethod-decorator / ruff PLR0202
  "R0203",  # no-staticmethod-decorator / ruff PLR0203
  "R0205",  # useless-object-inheritance / ruff UP004
  "R0206",  # property-with-parameters / ruff PLR0206
  "R0904",  # too-many-public-methods / ruff PLR0904
  "R0911",  # too-many-return-statements / ruff PLR0911
  "R0912",  # too-many-branches / ruff PLR0912
  "R0913",  # too-many-arguments / ruff PLR0913
  "R0914",  # too-many-locals / ruff PLR0914
  "R0915",  # too-many-statements / ruff PLR0915
  "R0916",  # too-many-boolean-expressions / ruff PLR0916
  "R0917",  # too-many-positional-arguments / ruff PLR0917
  "R1260",  # too-complex / ruff C901
  "R1701",  # consider-merging-isinstance / ruff PLR1701
  "R1702",  # too-many-nested-blocks / ruff PLR1702
  "R1703",  # simplifiable-if-statement / ruff SIM108
  "R1704",  # redefined-argument-from-local / ruff PLR1704
  "R1705",  # no-else-return / ruff RET505
  "R1706",  # consider-using-ternary / ruff PLR1706
  "R1707",  # trailing-comma-tuple / ruff COM818
  "R1710",  # inconsistent-return-statements / ruff PLR1710
  "R1711",  # useless-return / ruff PLR1711
  "R1714",  # consider-using-in / ruff PLR1714
  "R1715",  # consider-using-get / ruff SIM401
  "R1717",  # consider-using-dict-comprehension / ruff C402
  "R1718",  # consider-using-set-comprehension / ruff C401
  "R1719",  # simplifiable-if-expression / ruff PLR1719
  "R1720",  # no-else-raise / ruff RET506
  "R1721",  # unnecessary-comprehension / ruff C416
  "R1722",  # consider-using-sys-exit / ruff PLR1722
  "R1723",  # no-else-break / ruff RET508
  "R1724",  # no-else-continue / ruff RET507
  "R1725",  # super-with-arguments / ruff UP008
  "R1728",  # consider-using-generator / ruff C417
  "R1729",  # use-a-generator / ruff C419
  "R1730",  # consider-using-min-builtin / ruff PLR1730
  "R1731",  # consider-using-max-builtin / ruff PLR1730
  "R1732",  # consider-using-with / ruff SIM115
  "R1733",  # unnecessary-dict-index-lookup / ruff PLR1733
  "R1734",  # use-list-literal / ruff C405
  "R1735",  # use-dict-literal / ruff C406
  "R1736",  # unnecessary-list-index-lookup / ruff PLR1736
  "R2004",  # magic-value-comparison / ruff PLR2004
  "R2044",  # empty-comment / ruff PLR2044
  "R5501",  # else-if-used / ruff PLR5501
  "R6002",  # consider-using-alias / ruff UP006
  "R6003",  # consider-alternative-union-syntax / ruff UP007
  "R6104",  # consider-using-augmented-assign / ruff PLR6104
  "R6201",  # use-set-for-membership / ruff PLR6201
  "R6301",  # no-self-use / ruff PLR6301
  "W0102",  # dangerous-default-value / ruff B006
  "W0104",  # pointless-statement / ruff B018
  "W0106",  # expression-not-assigned / ruff B018
  "W0107",  # unnecessary-pass / ruff PIE790
  "W0108",  # unnecessary-lambda / ruff PLW0108
  "W0109",  # duplicate-key / ruff F601
  "W0120",  # useless-else-on-loop / ruff PLW0120
  "W0122",  # exec-used / ruff S102
  "W0123",  # eval-used / ruff PGH001
  "W0127",  # self-assigning-variable / ruff PLW0127
  "W0129",  # assert-on-string-literal / ruff PLW0129
  "W0130",  # duplicate-value / ruff B033
  "W0131",  # named-expr-without-context / ruff PLW0131
  "W0133",  # pointless-exception-statement / ruff PLW0133
  "W0150",  # lost-exception / ruff B012
  "W0160",  # consider-ternary-expression / ruff SIM108
  "W0177",  # nan-comparison / ruff PLW0117
  "W0199",  # assert-on-tuple / ruff F631
  "W0211",  # bad-staticmethod-argument / ruff PLW0211
  "W0212",  # protected-access / ruff SLF001
  "W0245",  # super-without-brackets / ruff PLW0245
  "W0301",  # unnecessary-semicolon / ruff E703
  "W0401",  # wildcard-import / ruff F403
  "W0404",  # reimported / ruff F811
  "W0406",  # import-self / ruff PLW0406
  "W0410",  # misplaced-future / ruff F404
  "W0511",  # fixme / ruff PLW0511
  "W0602",  # global-variable-not-assigned / ruff PLW0602
  "W0603",  # global-statement / ruff PLW0603
  "W0604",  # global-at-module-level / ruff PLW0604
  "W0611",  # unused-import / ruff F401
  "W0612",  # unused-variable / ruff F841
  "W0613",  # unused-argument / ruff ARG001
  "W0622",  # redefined-builtin / ruff A001
  "W0640",  # cell-var-from-loop / ruff B023
  "W0702",  # bare-except / ruff E722
  "W0705",  # duplicate-except / ruff B014
  "W0706",  # try-except-raise / ruff TRY302
  "W0707",  # raise-missing-from / ruff TRY200
  "W0711",  # binary-op-exception / ruff PLW0711
  "W0718",  # broad-exception-caught / ruff PLW0718
  "W0719",  # broad-exception-raised / ruff TRY002
  "W1113",  # keyword-arg-before-vararg / ruff B026
  "W1201",  # logging-not-lazy / ruff G
  "W1202",  # logging-format-interpolation / ruff G
  "W1203",  # logging-fstring-interpolation / ruff G
  "W1300",  # bad-format-string-key / ruff PLW1300
  "W1301",  # unused-format-string-key / ruff F504
  "W1302",  # bad-format-string / ruff PLW1302
  "W1303",  # missing-format-argument-key / ruff F524
  "W1304",  # unused-format-string-argument / ruff F507
  "W1305",  # format-combined-specification / ruff F525
  "W1308",  # duplicate-string-formatting-argument / ruff PLW1308
  "W1309",  # f-string-without-interpolation / ruff F541
  "W1310",  # format-string-without-interpolation / ruff F541
  "W1401",  # anomalous-backslash-in-string / ruff W605
  "W1404",  # implicit-str-concat / ruff ISC001
  "W1405",  # inconsistent-quotes / ruff Q000
  "W1406",  # redundant-u-string-prefix / ruff UP025
  "W1501",  # bad-open-mode / ruff PLW1501
  "W1508",  # invalid-envvar-default / ruff PLW1508
  "W1509",  # subprocess-popen-preexec-fn / ruff PLW1509
  "W1510",  # subprocess-run-check / ruff PLW1510
  "W1514",  # unspecified-encoding / ruff PLW1514
  "W1515",  # forgotten-debug-statement / ruff T100
  "W1518",  # method-cache-max-size-none / ruff B019
  "W1641",  # eq-without-hash / ruff PLW1641
  "W2101",  # useless-with-lock / ruff PLW2101
  "W2402",  # non-ascii-file-name / ruff N999
  "W2901",  # redefined-loop-name / ruff PLW2901
  "W3201",  # bad-dunder-name / ruff PLW3201
  "W3301",  # nested-min-max / ruff PLW3301
  "duplicate-code",
  "fixme",
  "too-few-public-methods",
  "unsubscriptable-object",
  # On purpose disabled as we rely on black
  "line-too-long",
  "protected-access",  # covered by ruff SLF001
  # local imports do not work well with pre-commit hook
  "import-error",
  # already covered by ruff which is faster
  "too-many-arguments",  # PLR0913
  "raise-missing-from",
  # Temporary disable duplicate detection we remove old code from prerun
  "duplicate-code",
]

[tool.pytest.ini_options]
addopts = "-p no:pytest_cov --durations=10 --durations-min=1.0 --failed-first --instafail"
# ensure we treat warnings as error
filterwarnings = [
  "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",
]
junit_family = "xunit2"  # see https://docs.codecov.com/docs/test-analytics
testpaths = ["test"]

[tool.ruff]
extend-include = ["src/ansible_compat/_version.py"]
preview = true
target-version = "py310"

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint]
external = [
  "DOC",  # pydoclint
]
ignore = [
  # Disabled on purpose:
  "COM812",  # conflicts with ISC001 on format
  "CPY001",
  "D203",  # incompatible with D211
  "D211",
  "D213",  # incompatible with D212
  "E501",  # we use black
  "RET504",  # Unnecessary variable assignment before `return` statement
  # Temporary disabled during adoption:
  "S607",  # Starting a process with a partial executable path
  "PLR0912",  # Bug https://github.com/charliermarsh/ruff/issues/4244
  "PLR0913",  # Bug https://github.com/charliermarsh/ruff/issues/4244
  "RUF012",
  "PERF203",
  "DOC201",  # preview
  "PLC0415",
  "DOC501",  # preview
]
select = ["ALL"]

[tool.ruff.lint.flake8-pytest-style]
parametrize-values-type = "tuple"

[tool.ruff.lint.isort]
known-first-party = ["src"]
known-third-party = ["packaging"]

[tool.ruff.lint.per-file-ignores]
"test/**/*.py" = [
  "DOC402",
  "DOC501",
  "FBT001",
  "PLC2701",
  "PLR0917",
  "S101",
  "S404",
  "S603",  # subprocess
  "S607",  # subprocess
  "SLF001",
]
"tools/*.py" = ["S603"]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.setuptools_scm]
# To prevent accidental pick of mobile version tags such 'v6'
git_describe_command = [
  "git",
  "describe",
  "--dirty",
  "--long",
  "--tags",
  "--match",
  "v*.*",
]
local_scheme = "no-local-version"
tag_regex = "^(?P<prefix>v)?(?P<version>\\d+[^\\+]*)(?P<suffix>.*)?$"
version_file = "src/ansible_compat/_version.py"

[tool.tomlsort]
in_place = true
sort_inline_tables = true
sort_table_keys = true

[tool.tox]
env_list = [
  "pkg",
  "lint",
  "docs",
  "py",
  "devel",
  "py310-ansible217",
  "py312-ansible216",
  "py312-ansible217",
  "py312-ansible218",
  "py313-ansible218",
  "py313-devel",
  "py314-devel",
]
requires = [
  "setuptools>=65.3",
  "tox>=4.30.3",
  "tox-extra>=2.1",
  "tox-uv >= 1.28.1",
]
skip_missing_interpreters = false

[tool.tox.env.deps]
commands = [
  [
    "pre-commit",
    "run",
    "--all-files",
    "--show-diff-on-failure",
    "--hook-stage",
    "manual",
    "deps",
  ],
  ["pre-commit", "autoupdate"],
  ["tox", "-e", "lint"],
]
commands_post = []
commands_pre = []
description = "Bump all test dependencies"
env_dir = "{work_dir}/lint"
skip_install = true

[tool.tox.env.devel]
dependency_groups = ["dev"]
deps = ["ansible-core @ git+https://github.com/ansible/ansible.git@devel"]
description = "Run the tests with newest dependencies (no lock and allowing prereleases)"
runner = "uv-venv-runner"
uv_sync_flags = ["--upgrade", "--prerelease=allow"]
uv_sync_locked = false

[tool.tox.env.docs]
commands = [
  [
    "mkdocs",
    { default = ["build", "--strict", "--site-dir=_readthedocs/html/"], extend = true, replace = "posargs" },
  ],
]
commands_post = []
commands_pre = []
dependency_groups = ["docs"]
description = "Builds docs"
skip_install = false

[tool.tox.env.lint]
commands = [["pre-commit", "run", "--all-files", "--show-diff-on-failure"]]
commands_post = []
commands_pre = []
dependency_groups = ["lint"]
description = "Run all linters"
skip_install = true

[tool.tox.env.pkg]
commands = [
  ["rm", "-rf", "{tox_root}/dist/"],
  [
    "python",
    "-m",
    "build",
    "--outdir",
    "{tox_root}/dist/",
    "{tox_root}",
  ],
  ["sh", "-c", "python -m twine check --strict {tox_root}/dist/*"],
  ["sh", "-c", "python3 -m pip install {tox_root}/dist/*.whl"],
  ["pip", "uninstall", "-y", "ansible-compat"],
]
commands_post = []
commands_pre = []
dependency_groups = ["pkg"]
description = """
Build package, verify metadata, install package and assert behavior when ansible is missing.
"""
skip_install = true

[tool.tox.env.py310-ansible217]
deps = ["ansible-core>=2.17,<2.18"]
description = "ansible-core 2.17 py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py312-ansible216]
deps = ["ansible-core>=2.16,<2.17"]
description = "ansible-core 2.16 py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py312-ansible217]
deps = ["ansible-core>=2.17,<2.18"]
description = "ansible-core 2.17 py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py312-ansible218]
deps = ["ansible-core>=2.18,<2.19"]
description = "ansible-core 2.18 py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py313-ansible218]
deps = ["ansible-core>=2.18,<2.19"]
description = "ansible-core 2.18 py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py313-devel]
deps = ["ansible-core @ git+https://github.com/ansible/ansible.git@devel"]
description = "ansible-core devel py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.py314-devel]
deps = ["ansible-core @ git+https://github.com/ansible/ansible.git@devel"]
description = "ansible-core devel py{py_dot_ver}"
runner = "uv-venv-runner"

[tool.tox.env.rpm]
commands = [["sh", "-c", "packit build in-mock --root=fedora-40-$(arch)"]]
deps = ["packitos"]
description = "Use packit to build RPM (requires RPM based Linux distro)"

[tool.tox.env.smoke]
commands = [["python3", "tools/smoke.py"]]
description = "Run ansible-lint and molecule own testing with current code from compat library"
editable = true
skip_install = true

[tool.tox.env_run_base]
allowlist_externals = ["ansible", "git", "sh", "rm"]
commands = [
  ["sh", "-c", "ansible --version | head -n 1"],
  [
    "python",
    "-c",
    "import pathlib; pathlib.Path(\"{env_site_packages_dir}/cov.pth\").write_text(\"import coverage; coverage.process_startup()\")",
  ],
  [
    "coverage",
    "run",
    "-m",
    "pytest",
    { default = [
      "-ra",
      "-n",
      "1",  # we need to address some concurrency issue to allow parallel execution
      "--showlocals",
      "--doctest-modules",
      "--durations=10",
      "--junitxml=./junit.xml",
    ], extend = true, replace = "posargs" },
  ],
  ["coverage", "combine", "-q"],
  ["coverage", "xml", "-o", "{env_dir}/coverage.xml", "--fail-under=0"],
  ["coverage", "lcov", "-q", "--fail-under=0"],
  ["coverage", "report"],
]
commands_post = []
commands_pre = [["coverage", "erase"]]
dependency_groups = ["dev"]
description = """Run the tests: py{py_dot_ver}"""
package = "editable"
pass_env = [
  "CI",
  "CONTAINER_*",
  "CURL_CA_BUNDLE",
  "FORCE_COLOR",
  "DOCKER_*",
  "GITHUB_*",
  "HOME",
  "LANG",
  "LC_*",
  "NO_COLOR",
  "PRE_COMMIT_HOME",
  "PYTEST_*",
  "PYTEST_REQPASS",
  "PYTHON*",
  "PYTHONBREAKPOINT",
  "PYTHONIOENCODING",
  "PYTHONPYCACHEPREFIX",
  "PY_COLORS",
  "REQUESTS_CA_BUNDLE",
  "RTD_TOKEN",
  "SETUPTOOLS_SCM_DEBUG",
  "SSH_AUTH_SOCK",
  "TERM",
  "USER",
  "SSL_CERT_FILE",  # https proxies
  "SSH_AUTH_SOCK",  # may be needed by git
  "UV_*",
]
runner = "uv-venv-lock-runner"

[tool.tox.env_run_base.set_env]
ANSIBLE_DEVEL_WARNING = "false"
ANSIBLE_HOME = "{envdir}/.ansible"
COVERAGE_COMBINED = "{env_dir}/.coverage"
COVERAGE_FILE = "{env:COVERAGE_FILE:{env_dir}/.coverage.{env_name}}"
COVERAGE_PROCESS_START = "{tox_root}/pyproject.toml"
DYLD_FALLBACK_LIBRARY_PATH = "/opt/homebrew/lib:{env:LD_LIBRARY_PATH}"
FORCE_COLOR = "1"
PRE_COMMIT_COLOR = "always"

[tool.uv]
constraint-dependencies = [
  "ansible-core>=2.20.0.dev0; python_version >= '3.14'",
]
default-groups = ["dev", "docs", "lint", "pkg"]
package = true