Skip to content

Commit a2a9176

Browse files
authored
Enable toml-sort-fix (#442)
1 parent 415bdbb commit a2a9176

File tree

2 files changed

+45
-35
lines changed

2 files changed

+45
-35
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ repos:
6868
files: \.(yaml|yml)$
6969
types: [file, yaml]
7070
entry: yamllint --strict
71+
- repo: https://github.com/pappasam/toml-sort
72+
rev: v0.24.2
73+
hooks:
74+
- id: toml-sort-fix
7175
- repo: https://github.com/psf/black
7276
rev: 24.10.0
7377
hooks:

pyproject.toml

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
[build-system]
2+
build-backend = "setuptools.build_meta"
23
requires = [
34
"setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs
45
"setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme
56
]
6-
build-backend = "setuptools.build_meta"
77

88
[project]
9-
# https://peps.python.org/pep-0621/#readme
10-
requires-python = ">=3.9"
11-
dynamic = ["version", "dependencies", "optional-dependencies"]
12-
name = "ansible-compat"
13-
description = "Ansible compatibility goodies"
14-
readme = "README.md"
15-
authors = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }]
16-
maintainers = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }]
17-
license = { text = "MIT" }
9+
authors = [{"email" = "ssbarnea@redhat.com", "name" = "Sorin Sbarnea"}]
1810
classifiers = [
1911
"Development Status :: 5 - Production/Stable",
2012
"Environment :: Console",
@@ -36,52 +28,60 @@ classifiers = [
3628
"Topic :: Software Development :: Testing",
3729
"Topic :: Utilities"
3830
]
31+
description = "Ansible compatibility goodies"
32+
dynamic = ["version", "dependencies", "optional-dependencies"]
3933
keywords = ["ansible"]
34+
license = {text = "MIT"}
35+
maintainers = [{"email" = "ssbarnea@redhat.com", "name" = "Sorin Sbarnea"}]
36+
name = "ansible-compat"
37+
readme = "README.md"
38+
# https://peps.python.org/pep-0621/#readme
39+
requires-python = ">=3.9"
4040

4141
[project.urls]
42-
homepage = "https://github.com/ansible/ansible-compat"
42+
changelog = "https://github.com/ansible/ansible-compat/releases"
4343
documentation = "https://ansible.readthedocs.io/projects/compat/"
44+
homepage = "https://github.com/ansible/ansible-compat"
4445
repository = "https://github.com/ansible/ansible-compat"
45-
changelog = "https://github.com/ansible/ansible-compat/releases"
4646

4747
[tool.coverage.report]
48-
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
48+
exclude_also = ["pragma: no cover", "if TYPE_CHECKING:"]
4949
fail_under = 100
50-
skip_covered = true
5150
show_missing = true
51+
skip_covered = true
5252

5353
[tool.coverage.run]
54-
source = ["src"]
5554
# Do not use branch until bug is fixes:
5655
# https://github.com/nedbat/coveragepy/issues/605
5756
branch = false
58-
parallel = true
5957
concurrency = ["multiprocessing", "thread"]
58+
parallel = true
59+
source = ["src"]
6060

6161
[tool.isort]
6262
profile = "black"
6363

6464
[tool.mypy]
65-
python_version = 3.9
6665
color_output = true
67-
error_summary = true
66+
disallow_any_generics = true
6867
disallow_untyped_calls = true
6968
disallow_untyped_defs = true
70-
disallow_any_generics = true
69+
error_summary = true
7170
# disallow_any_unimported = True
7271
# ; warn_redundant_casts = True
7372
# warn_return_any = True
7473
# warn_unused_configs = True
7574
exclude = "test/local-content"
75+
python_version = "3.9"
7676

7777
[[tool.mypy.overrides]]
78-
module = "ansible.*"
7978
ignore_missing_imports = true
79+
module = "ansible.*"
8080

8181
[[tool.mypy.overrides]]
82+
ignore_errors = true
8283
# generated by setuptools-scm, can be missing during linting
8384
module = "ansible_compat._version"
84-
ignore_errors = true
8585

8686
[tool.pydoclint]
8787
allow-init-docstring = true
@@ -362,11 +362,15 @@ filterwarnings = [
362362
testpaths = ["test"]
363363

364364
[tool.ruff]
365-
preview = true
366365
extend-include = ["src/ansible_compat/_version.py"]
366+
preview = true
367367
target-version = "py39"
368-
lint.select = ["ALL"]
369-
lint.ignore = [
368+
369+
[tool.ruff.format]
370+
docstring-code-format = true
371+
372+
[tool.ruff.lint]
373+
ignore = [
370374
# Disabled on purpose:
371375
"CPY001",
372376
"D203", # incompatible with D211
@@ -384,9 +388,7 @@ lint.ignore = [
384388
"PLC0415",
385389
"DOC501" # preview
386390
]
387-
388-
[tool.ruff.format]
389-
docstring-code-format = true
391+
select = ["ALL"]
390392

391393
[tool.ruff.lint.flake8-pytest-style]
392394
parametrize-values-type = "tuple"
@@ -401,16 +403,12 @@ known-third-party = ["packaging"]
401403
[tool.ruff.lint.pydocstyle]
402404
convention = "google"
403405

404-
405406
[tool.setuptools.dynamic]
406-
dependencies = { file = [".config/requirements.in"] }
407-
optional-dependencies.docs = { file = [".config/requirements-docs.in"] }
408-
optional-dependencies.test = { file = [".config/requirements-test.in"] }
407+
dependencies = {file = [".config/requirements.in"]}
408+
optional-dependencies.docs = {file = [".config/requirements-docs.in"]}
409+
optional-dependencies.test = {file = [".config/requirements-test.in"]}
409410

410411
[tool.setuptools_scm]
411-
local_scheme = "no-local-version"
412-
tag_regex = "^(?P<prefix>v)?(?P<version>\\d+[^\\+]*)(?P<suffix>.*)?$"
413-
write_to = "src/ansible_compat/_version.py"
414412
# To prevent accidental pick of mobile version tags such 'v6'
415413
git_describe_command = [
416414
"git",
@@ -421,8 +419,16 @@ git_describe_command = [
421419
"--match",
422420
"v*.*"
423421
]
422+
local_scheme = "no-local-version"
423+
tag_regex = "^(?P<prefix>v)?(?P<version>\\d+[^\\+]*)(?P<suffix>.*)?$"
424+
write_to = "src/ansible_compat/_version.py"
425+
426+
[tool.tomlsort]
427+
in_place = true
428+
sort_inline_tables = true
429+
sort_table_keys = true
424430

425431
[tool.uv.pip]
426432
annotation-style = "line"
427-
no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv"]
428433
custom-compile-command = "tox run deps"
434+
no-emit-package = ["ansible-core", "pip", "resolvelib", "typing_extensions", "uv"]

0 commit comments

Comments
 (0)