summaryrefslogtreecommitdiffstats
path: root/pyproject.toml
blob: 51b6a80bb929e185a8a5f2ae3cdae6a00798c50e (plain)
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
[build-system]
requires = [
  "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs
  "setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme
]
build-backend = "setuptools.build_meta"

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

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

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
fail_under = 92
skip_covered = true
show_missing = true

[tool.coverage.run]
source = ["src"]
# Do not use branch until bug is fixes:
# https://github.com/nedbat/coveragepy/issues/605
branch = false
parallel = true
concurrency = ["multiprocessing", "thread"]

[tool.isort]
profile = "black"

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

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

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

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

[tool.pylint."MESSAGES CONTROL"]
disable = [
  # On purpose disabled as we rely on black
  "line-too-long",
  # 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]
# 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"
]
testpaths = ["test"]

[tool.ruff]
select = ["ALL"]
ignore = [
  # Disabled on purpose:
  "ANN101", # Missing type annotation for `self` in method
  "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"
]
target-version = "py39"

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

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

[tool.ruff.per-file-ignores]
"test/**/*.py" = ["SLF001", "S101", "FBT001"]

[tool.ruff.pydocstyle]
convention = "pep257"

[tool.setuptools.dynamic]
dependencies = {file = [".config/requirements.in"]}
optional-dependencies.docs = {file = [".config/requirements-docs.in"]}
optional-dependencies.test = {file = [".config/requirements-test.in"]}

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