Skip to content

Commit bf91b06

Browse files
authored
Refactor types for future ansible-core compatibility (#4557)
1 parent 7bd4447 commit bf91b06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+348
-270
lines changed

.config/constraints.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ attrs==25.3.0 # via jsonschema, referencing
66
babel==2.17.0 # via mkdocs-material
77
backrefs==5.8 # via mkdocs-material
88
beautifulsoup4==4.13.3 # via linkchecker, mkdocs-htmlproofer-plugin
9+
bindep==2.13.0 # via tox-extra
910
black==25.1.0 # via ansible-lint (pyproject.toml)
1011
boolean-py==4.0 # via license-expression
1112
bracex==2.5.post1 # via wcmatch
@@ -26,10 +27,13 @@ cssselect2==0.8.0 # via cairosvg
2627
defusedxml==0.7.1 # via cairosvg
2728
dill==0.3.9 # via pylint
2829
distlib==0.3.9 # via virtualenv
30+
distro==1.9.0 # via bindep
2931
dnspython==2.7.0 # via linkchecker
3032
execnet==2.1.1 # via pytest-xdist
3133
filelock==3.18.0 # via tox, virtualenv, ansible-lint (pyproject.toml)
3234
ghp-import==2.1.0 # via mkdocs
35+
gitdb==4.0.12 # via gitpython
36+
gitpython==3.1.44 # via tox-extra
3337
griffe==1.6.2 # via mkdocstrings-python
3438
hjson==3.1.0 # via mkdocs-macros-plugin, super-collections
3539
htmlmin2==0.1.13 # via mkdocs-minify-plugin
@@ -66,9 +70,11 @@ mkdocstrings-python==1.16.7 # via mkdocs-ansible
6670
mypy==1.15.0 # via ansible-lint (pyproject.toml)
6771
mypy-extensions==1.0.0 # via black, mypy
6872
netaddr==1.3.0 # via ansible-lint (pyproject.toml)
69-
packaging==24.2 # via ansible-compat, ansible-core, black, mkdocs, mkdocs-macros-plugin, pyproject-api, pytest, tox, ansible-lint (pyproject.toml)
73+
packaging==24.2 # via ansible-compat, ansible-core, bindep, black, mkdocs, mkdocs-macros-plugin, pyproject-api, pytest, tox, tox-extra, tox-uv, ansible-lint (pyproject.toml)
7074
paginate==0.5.7 # via mkdocs-material
75+
parsley==1.3 # via bindep
7176
pathspec==0.12.1 # via black, mkdocs, mkdocs-macros-plugin, yamllint, ansible-lint (pyproject.toml)
77+
pbr==6.1.1 # via bindep
7278
pillow==11.1.0 # via cairosvg, mkdocs-ansible
7379
platformdirs==4.3.7 # via black, mkdocs-get-deps, pylint, tox, virtualenv
7480
pluggy==1.5.0 # via pytest, tox
@@ -92,15 +98,19 @@ requests==2.32.3 # via linkchecker, mkdocs-htmlproofer-plugin, mkdocs-m
9298
rpds-py==0.23.1 # via jsonschema, referencing
9399
ruamel-yaml==0.18.10 # via ansible-lint (pyproject.toml)
94100
setproctitle==1.3.5 # via pytest-xdist
101+
setuptools==77.0.3 # via pbr
95102
six==1.17.0 # via python-dateutil
103+
smmap==5.0.2 # via gitdb
96104
soupsieve==2.6 # via beautifulsoup4
97105
subprocess-tee==0.4.2 # via ansible-compat, ansible-lint (pyproject.toml)
98106
super-collections==0.5.3 # via mkdocs-macros-plugin
99107
termcolor==2.5.0 # via mkdocs-macros-plugin
100108
text-unidecode==1.3 # via python-slugify
101109
tinycss2==1.4.0 # via cairosvg, cssselect2
102110
tomlkit==0.13.2 # via pylint
103-
tox==4.24.2 # via ansible-lint (pyproject.toml)
111+
tox==4.24.2 # via tox-extra, tox-uv, ansible-lint (pyproject.toml)
112+
tox-extra==2.1.0 # via ansible-lint (pyproject.toml)
113+
tox-uv==1.25.0 # via tox-extra, ansible-lint (pyproject.toml)
104114
types-jsonschema==4.23.0.20241208 # via ansible-lint (pyproject.toml)
105115
types-pyyaml==6.0.12.20241230 # via ansible-lint (pyproject.toml)
106116
urllib3==2.3.0 # via requests
@@ -119,3 +129,4 @@ zipp==3.21.0 # via importlib-metadata
119129
# ruamel-yaml-clib
120130
# tomli
121131
# typing-extensions
132+
# uv

.config/requirements-lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ rpds-py==0.23.1 # via jsonschema, referencing
2424
ruamel-yaml==0.18.10 # via ansible-lint (pyproject.toml)
2525
subprocess-tee==0.4.2 # via ansible-compat, ansible-lint (pyproject.toml)
2626
wcmatch==10.0 # via ansible-lint (pyproject.toml)
27-
yamllint==1.36.2 # via ansible-lint (pyproject.toml)
27+
yamllint==1.37.0 # via ansible-lint (pyproject.toml)
2828
zipp==3.21.0 # via importlib-metadata
2929

3030
# The following packages were excluded from the output:

.config/requirements-test.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ pip # tox command
99
psutil # soft-dep of pytest-xdist
1010
pylint # IDE support
1111
pytest >= 7.2.2
12+
pytest-instafail >= 0.5.0 # only for local development, via PYTEST_ADDOPTS=-edit
1213
pytest-mock
1314
pytest-plus >= 0.6 # for PYTEST_REQPASS
1415
pytest-xdist[psutil,setproctitle] >= 2.1.0
15-
pytest-instafail >= 0.5.0 # only for local development, via PYTEST_ADDOPTS=-edit
16-
ruamel.yaml>=0.17.31
1716
ruamel-yaml-clib # needed for mypy
17+
ruamel.yaml>=0.17.31
1818
tox >= 4.0.0
19+
tox-extra>=2.1
20+
tox-uv>=1.25
21+
tox>=4.24.2
1922
types-jsonschema # IDE support
2023
types-pyyaml # IDE support

.github/lower-constraints.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# automatically updated by dependabot. This should be kept in sync with
33
# minimal requirements configured inside .config/requirements.in
44
ansible-core==2.16.0
5-
ansible-compat>=25.1.3 # GPLv3
5+
ansible-compat==25.1.4 # GPLv3
66
black==24.3.0 # MIT (security)
7-
filelock==3.8.2 # The Unlicense
7+
filelock==3.16.1 # The Unlicense # due to tox-uv
88
jsonschema==4.10.0 # MIT, version needed for improved errors
9-
packaging==22.0
9+
packaging==24.2 # Due to tox-uv
1010
pathspec==0.10.3
1111
pyyaml==6.0.2
1212
ruamel.yaml==0.18.5 # MIT

.github/workflows/tox.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ jobs:
106106

107107
- name: Set ansible cache(s)
108108
uses: actions/cache@v4
109-
if: ${{ matrix.name != 'pkg' && matrix.name != 'schemas' }}
110109
with:
111110
path: |
112111
.cache/eco
113112
examples/playbooks/collections/ansible_collections
114113
~/.cache/ansible-compat
115114
~/.ansible/collections
116115
~/.ansible/roles
117-
key: ${{ matrix.name }}-${{ hashFiles('tools/test-eco.sh', 'requirements.yml', 'examples/playbooks/collections/requirements.yml') }}
116+
.tox
117+
key: ${{ matrix.name }}-${{ matrix.os }}--${{ hashFiles('tools/test-eco.sh', 'requirements.yml', 'examples/playbooks/collections/requirements.yml') }}
118118

119119
- name: Set up Python ${{ matrix.python_version || '3.10' }}
120120
if: "!contains(matrix.shell, 'wsl')"

.pre-commit-config.yaml

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -157,81 +157,40 @@ repos:
157157
rev: v1.15.0
158158
hooks:
159159
- id: mypy
160-
# empty args needed in order to match mypy cli behavior
161-
args: [--strict]
162-
additional_dependencies:
160+
# "." and pass_files are used to make pre-commit mypy behave the same as standalone mypy
161+
args: ["."]
162+
pass_filenames: false
163+
additional_dependencies: &deps
163164
- ansible-compat>=25.1.3
164165
- black>=22.10.0
165166
- cryptography>=39.0.1
166167
- filelock>=3.12.2
167168
- importlib_metadata
168169
- jinja2
169170
- license-expression >= 30.3.0
171+
- pip>=22.3.1
170172
- pytest-mock
171173
- pytest>=7.2.2
172-
- pip>=22.3.1
174+
- pyyaml>=6.0.2 # types-PyYAML is not enough
173175
- ruamel-yaml-clib>=0.2.8
174176
- ruamel-yaml>=0.18.6
175177
- subprocess-tee
176-
- types-PyYAML
177178
- types-jsonschema>=4.20.0.0
178179
- types-setuptools
179180
- wcmatch
180-
exclude: >
181-
(?x)^(
182-
.config/.*|
183-
collections/.*|
184-
test/local-content/.*|
185-
plugins/.*
186-
)$
181+
- yamllint>=1.34.0
187182
- repo: https://github.com/RobertCraigie/pyright-python
188-
rev: v1.1.396
183+
rev: v1.1.397
189184
hooks:
190185
- id: pyright
191-
additional_dependencies:
192-
- nodejs-wheel-binaries
193-
- ansible-compat>=25.1.3
194-
- black>=22.10.0
195-
- cryptography>=39.0.1
196-
- filelock>=3.12.2
197-
- importlib_metadata
198-
- jinja2
199-
- license-expression >= 30.3.0
200-
- pip>=22.3.1
201-
- pytest-mock
202-
- pytest>=7.2.2
203-
- ruamel-yaml-clib>=0.2.8
204-
- ruamel-yaml>=0.18.6
205-
- subprocess-tee
206-
- types-PyYAML
207-
- types-jsonschema>=4.20.0.0
208-
- types-setuptools
209-
- wcmatch
210-
- yamllint
186+
additional_dependencies: *deps
211187
- repo: https://github.com/pycqa/pylint
212-
rev: v3.3.5
188+
rev: v3.3.6
213189
hooks:
214190
- id: pylint
215191
args:
216192
- --output-format=colorized
217-
additional_dependencies:
218-
- ansible-compat>=25.1.3
219-
- ansible-core>=2.16.0
220-
- black>=24.10.0
221-
- docutils
222-
- filelock>=3.12.2
223-
- importlib_metadata
224-
- jsonschema>=4.20.0
225-
- license-expression >= 30.3.0
226-
- pytest-mock
227-
- pytest>=7.2.2
228-
- pyyaml
229-
- ruamel-yaml-clib>=0.2.7
230-
- ruamel-yaml>=0.18.2
231-
- setuptools # needed for pkg_resources import
232-
- typing_extensions
233-
- wcmatch
234-
- yamllint
193+
additional_dependencies: *deps
235194
- repo: https://github.com/jendrikseipp/vulture
236195
rev: v2.14
237196
hooks:

examples/collections/broken_no_runtime/CHANGELOG.md

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: broken_no_runtime
3+
namespace: fixtures
4+
version: 1.2.3
5+
authors:
6+
- John
7+
readme: ../README.md
8+
tags: ["tools"]
9+
description: Lorem ipsum
10+
repository: https://www.github.com/my_org/my_collection

examples/playbooks/action_plugins/some_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from ansible.plugins.action import ActionBase
44

55

6-
class ActionModule(ActionBase): # type: ignore[misc,no-any-unimported]
6+
class ActionModule(ActionBase):
77
"""Sample module."""
88

99
def run(self, tmp=None, task_vars=None): # type: ignore[no-untyped-def]
1010
"""."""
11-
super().run(tmp, task_vars)
11+
super().run(tmp, task_vars) # type: ignore[no-untyped-call]
1212
ret = {"foo": "bar"}
1313
return {"ansible_facts": ret}

examples/playbooks/command-check-success.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@
6060
- name: Restart something # noqa: fqcn[action-core] no-changed-when
6161
command: do something
6262
- name: Foo # noqa: fqcn[action-core] deprecated-module
63-
include: handlers/included-handlers.yml
63+
include_tasks: handlers/included-handlers.yml

0 commit comments

Comments
 (0)