Skip to content

Commit 36075fa

Browse files
cidrblockpre-commit-ci[bot]alisonlhart
authored
chore: Remove cffi, importlib-metadata, reduce core lower bound (#4860)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alison Hart <[email protected]>
1 parent 61a8e7b commit 36075fa

File tree

10 files changed

+114
-67
lines changed

10 files changed

+114
-67
lines changed

.config/dictionary.txt

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
Chamoulaud
2-
Codeclimate
3-
FQCN
4-
FQCNs
5-
LIBYAML
6-
LINEINFILE
7-
Lineinfile
8-
Lintable
9-
MYSQLD
10-
NODEPS
11-
Octals
12-
PYTHONBREAKPOINT
13-
PYTHONIOENCODING
14-
PYTHONPYCACHEPREFIX
15-
Parseable
16-
Representer
17-
SARIF
18-
Sarif
19-
Sbarnea
20-
Sorin
21-
Tsukinowa
22-
WSLENV
231
alertmanager
242
ansiblelint
253
apport
@@ -29,6 +7,7 @@ blockinfile
297
bracketsmatchtest
308
bracketsmatchtestfile
319
cachier
10+
chamoulaud
3211
codeclimate
3312
codespell
3413
deannotate
@@ -43,6 +22,7 @@ filesspot
4322
firewalld
4423
fontawesome
4524
fqcn
25+
fqcns
4626
geerlingguy
4727
getmatches
4828
gplv
@@ -60,6 +40,7 @@ lintable
6040
lintables
6141
matchyaml
6242
mockings
43+
mysqld
6344
netcommon
6445
nodeps
6546
nomatchestest
@@ -72,17 +53,21 @@ pfexec
7253
plainexamples
7354
pmrun
7455
pymdownx
56+
pythonbreakpoint
57+
pythonioencoding
58+
pythonpycacheprefix
7559
redirections
7660
reformatter
7761
releasenotes
78-
representer
7962
rulebooks
8063
runas
8164
sarif
65+
sbarnea
8266
seealso
8367
sesu
8468
simplifiable
8569
slackpkg
70+
sorin
8671
ssbarnea
8772
sudosu
8873
supervisorctl
@@ -96,6 +81,7 @@ timesyncd
9681
tmpfs
9782
tombi
9883
tomlsort
84+
tsukinowa
9985
typehints
10086
uncook
10187
unjinja
@@ -105,5 +91,6 @@ untemplated
10591
virtnet
10692
willthames
10793
workerinput
94+
wslenv
10895
xdist
10996
yatesr

.config/requirements-lock.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ distro==1.9.0
2626
# via ansible-lint
2727
filelock==3.20.0
2828
# via ansible-lint
29-
importlib-metadata==8.7.0
30-
# via ansible-lint
3129
jinja2==3.1.6
3230
# via ansible-core
3331
jsonschema==4.25.1
@@ -82,5 +80,3 @@ wcmatch==10.1
8280
# via ansible-lint
8381
yamllint==1.37.1
8482
# via ansible-lint
85-
zipp==3.23.0
86-
# via importlib-metadata

.pre-commit-config.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ repos:
6565
alias: biome
6666
args: [--unsafe]
6767
- repo: https://github.com/streetsidesoftware/cspell-cli
68-
rev: v9.2.1
68+
rev: v9.3.3
6969
hooks:
7070
- id: cspell
7171
entry: bash
@@ -75,7 +75,7 @@ repos:
7575
"-euo",
7676
"pipefail",
7777
"-c",
78-
"cspell-cli . --relative --no-progress --no-summary && cspell-cli . --disable-dictionary=words --no-exit-code --words-only --quiet --unique | LC_ALL=C sort > .config/dictionary.txt",
78+
"cspell-cli . --relative --no-progress --no-summary && cspell-cli . --disable-dictionary=words --no-exit-code --words-only --quiet --unique | tr '[:upper:]' '[:lower:]' | LC_ALL=C sort -u > .config/dictionary.txt",
7979
]
8080
name: cspell + remove unused and sort dictionary
8181
- repo: https://github.com/python-jsonschema/check-jsonschema
@@ -145,7 +145,7 @@ repos:
145145
entry: yamllint --strict
146146

147147
- repo: https://github.com/tombi-toml/tombi-pre-commit
148-
rev: v0.6.40
148+
rev: v0.7.0
149149
hooks:
150150
- id: tombi-format
151151
alias: toml
@@ -171,7 +171,6 @@ repos:
171171
- black>=22.10.0
172172
- cryptography>=39.0.1
173173
- filelock>=3.12.2
174-
- importlib_metadata
175174
- jinja2
176175
- license-expression >= 30.3.0
177176
- pip>=22.3.1
@@ -201,6 +200,10 @@ repos:
201200
rev: v2.14
202201
hooks:
203202
- id: vulture
203+
- repo: https://github.com/ansible/team-devtools
204+
rev: v25.12.8
205+
hooks:
206+
- id: check-platform-constraints
204207
- # keep at bottom as these are slower
205208
repo: local
206209
hooks:

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,17 @@ classifiers = [
3434
]
3535
dependencies = [
3636
"ansible-compat>=25.8.2",
37-
"ansible-core>=2.17.10",
37+
"ansible-core>=2.16.14",
3838
"black>=24.3.0",
39-
"cffi>=1.17.1", # indirect dependency of ruamel-yaml
39+
"cffi>=1.15.1", # indirect dependency of ruamel-yaml
4040
"cryptography>=38",
4141
"distro>=1.9.0",
4242
"filelock>=3.8.2",
43-
"importlib-metadata>=8.7.0",
4443
"jsonschema>=4.10.0",
4544
"packaging>=22.0",
4645
"pathspec>=0.10.3",
47-
"pyyaml>=6.0.2 ; python_version < '3.14'",
48-
"pyyaml>=6.0.3 ; python_version >= '3.14'", # py314 support
46+
"pyyaml>=6.0.1 ; python_version < '3.14'",
47+
"pyyaml>=6.0.1 ; python_version >= '3.14'", # py314 support
4948
"referencing>=0.36.2",
5049
"ruamel-yaml>=0.18.11",
5150
"ruamel-yaml-clib>=0.2.12 ; python_version < '3.14'",
@@ -89,7 +88,7 @@ dev = [
8988
"pytest-plus>=0.8.1",
9089
"pytest-sugar>=1.1.1",
9190
"pytest-xdist[psutil,setproctitle]>=2.1.0",
92-
"pyyaml>=6.0.2",
91+
"pyyaml>=6.0.1",
9392
"ruamel-yaml>=0.18.11",
9493
"ruamel-yaml-clib>=0.2.12 ; python_full_version < '3.14'",
9594
"tox>=4.24.2",

renovate.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,51 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["github>ansible/actions//config/renovate.json"]
3+
"extends": ["github>ansible/actions//config/renovate.json"],
4+
"packageRules": [
5+
{
6+
"allowedVersions": "<2.17",
7+
"description": "Platform compatibility constraint",
8+
"matchPackageNames": ["ansible-core"]
9+
},
10+
{
11+
"allowedVersions": "<1.16",
12+
"description": "Platform compatibility constraint",
13+
"matchPackageNames": ["cffi"]
14+
},
15+
{
16+
"allowedVersions": "<4.3",
17+
"description": "Platform compatibility constraint",
18+
"matchPackageNames": ["django"]
19+
},
20+
{
21+
"allowedVersions": "<6.1",
22+
"description": "Platform compatibility constraint",
23+
"matchPackageNames": ["importlib-metadata"]
24+
},
25+
{
26+
"allowedVersions": "<4.22",
27+
"description": "Platform compatibility constraint",
28+
"matchPackageNames": ["jsonschema"]
29+
},
30+
{
31+
"allowedVersions": "<25.0",
32+
"description": "Platform compatibility constraint",
33+
"matchPackageNames": ["packaging"]
34+
},
35+
{
36+
"allowedVersions": "<6.0.2",
37+
"description": "Platform compatibility constraint",
38+
"matchPackageNames": ["pyyaml"]
39+
},
40+
{
41+
"allowedVersions": "<0.5.3",
42+
"description": "Platform compatibility constraint",
43+
"matchPackageNames": ["python-gnupg"]
44+
},
45+
{
46+
"allowedVersions": "<65.6",
47+
"description": "Platform compatibility constraint",
48+
"matchPackageNames": ["setuptools"]
49+
}
50+
]
451
}

src/ansiblelint/requirements.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Utilities for checking python packages requirements."""
22

3-
import importlib_metadata
3+
from importlib.metadata import metadata
4+
45
from packaging.requirements import Requirement
56
from packaging.specifiers import SpecifierSet
67
from packaging.version import Version
@@ -13,9 +14,9 @@ class Reqs(dict[str, SpecifierSet]):
1314

1415
def __init__(self, name: str = "ansible-lint") -> None:
1516
"""Load linter metadata requirements."""
16-
metadata = importlib_metadata.metadata(name)
17-
if metadata:
18-
for req_str in metadata.json["requires_dist"]:
17+
lint_metadata = metadata(name)
18+
if lint_metadata:
19+
for req_str in lint_metadata.json["requires_dist"]:
1920
req = Requirement(req_str)
2021
if req.name:
2122
if req.marker and not req.marker.evaluate():

src/ansiblelint/rules/args.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,4 +346,12 @@ def test_args_module_pass(
346346
with caplog.at_level(logging.WARNING):
347347
results = Runner(success, rules=default_rules_collection).run()
348348
assert len(results) == 0, results
349-
assert len(caplog.records) == 0, caplog.records
349+
# Remove any records about incompatible ansible version with the collections
350+
# Sample: AnsibleWarning Collection community.docker does not support Ansible version
351+
records = [
352+
record
353+
for record in caplog.records
354+
if "does not support Ansible version" not in record.getMessage()
355+
]
356+
log_string = "\n".join(record.getMessage() for record in records)
357+
assert len(records) == 0, log_string
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ansible-lint-config": {
3-
"etag": "edfce2b56aae684bf1f0b9978dcfaaaa588dbc236f6e0ce29427277f6a327ddc",
3+
"etag": "d08ce380364a2935299f89bf453787601d44a1bc6b70a38afaec4a8b0b80d104",
44
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible-lint-config.json"
55
},
66
"ansible-navigator-config": {
@@ -12,55 +12,55 @@
1212
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/changelog.json"
1313
},
1414
"execution-environment": {
15-
"etag": "075ab552988793a43ddfe9907b0e391331c54b5dbee2ad1a194e6fc9268e5df9",
15+
"etag": "127ca906c1dc04fe55e4dd1ee0742a096a40f094ec3d4418b803456713c35243",
1616
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/execution-environment.json"
1717
},
1818
"galaxy": {
19-
"etag": "53510178f6231be276d4fdb1b99e0db2bf52a6fedfaa634f9870537d9ad1b385",
19+
"etag": "fbee11277e3cf6fd3ae47831fb912dda5954e2689d1830ddaba7cbac1fd0ce3b",
2020
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/galaxy.json"
2121
},
2222
"inventory": {
23-
"etag": "b52c251a121e2e807928db7b4e09338babde9e74a50d0f74e8908f6e230d101d",
23+
"etag": "d5f717b4df27cd750ce0acdcbfa2b7ad747815c8b98d4f6ea474a637ba04ce72",
2424
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/inventory.json"
2525
},
2626
"meta": {
27-
"etag": "6315f4ea4ed7a14f3d011bbb3095ee56ed4621c4e7c1d14c85dcf88a5cfe3573",
27+
"etag": "d63b91b4cb6a73cde4d9d98b7b5d9bbaf8ed568173e90682afb5b11cd6ba55b3",
2828
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta.json"
2929
},
3030
"meta-runtime": {
31-
"etag": "448b614e9d4411b82d220950b7a415c248cc75d5431f9b8058c771a595d40163",
31+
"etag": "eae3d798ca5ccb03b3fd81ec44ea3d579782e75d1bd5a96eb0d64b1939c3b1f1",
3232
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/meta-runtime.json"
3333
},
3434
"molecule": {
35-
"etag": "3b625438c28e884ac42a14c09ca542fc3e1b4466abaf47d0c28646e0857d3fb5",
35+
"etag": "c654d6e4f94ae56daa39f456d15d31c933977e2eb3f5031dca40533f25c32746",
3636
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/molecule.json"
3737
},
3838
"play-argspec": {
39-
"etag": "b418c4edcf2a44f0534321e0b38b6b7fb3f73a87c4f6ea18cab15e4b3f53bd20",
39+
"etag": "699edbc9ddf026606d8cd79f71b10f9487f6acc37e8622143f76e5e8d0ae14bf",
4040
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/play-argspec.json"
4141
},
4242
"playbook": {
43-
"etag": "db849c713091b29d3a569e72a82f8a28f49b3b14ad90c1a96936099b04eb393e",
43+
"etag": "09d087fd7fe850790857de197c778bbce80ec360234e3240e2eff964f773aa8c",
4444
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/playbook.json"
4545
},
4646
"requirements": {
47-
"etag": "5ae3a6058ac626a341338c760db7cef7f02a8911c7293c7e129dbc6b0f8bb86d",
47+
"etag": "4473c6fcaddcc040aa8357ed3fd2b316c5699c4cc1978dbf3935c29be35b8a62",
4848
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/requirements.json"
4949
},
5050
"role-arg-spec": {
51-
"etag": "c470f67bc8eec3937957773074d7b6549deefd83dd0c3e13db725df166a66df3",
51+
"etag": "cb7ac0c4f8d55736f8c53e27bc6984f67d12fda5eadca1991f50d5d78fcdfb63",
5252
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/role-arg-spec.json"
5353
},
5454
"rulebook": {
5555
"etag": "9f785b5986cdbfe3b4ba911cbb65263df150bb595b22e4f191081b9360717d33",
5656
"url": "https://raw.githubusercontent.com/ansible/ansible-rulebook/main/ansible_rulebook/schema/ruleset_schema.json"
5757
},
5858
"tasks": {
59-
"etag": "9f3b54cf5cc432d57c9691fb3108a7f37996ab0875e2abb66eda0aa62437dcdc",
59+
"etag": "0e94cba9067e983083040bd661515801b5b1d4fd5660019f34234bba7ec8de1a",
6060
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/tasks.json"
6161
},
6262
"vars": {
63-
"etag": "73feaa77561d1d5b0bebe6cd66d499a28d67037055ac6d746139a38c9d28ca04",
63+
"etag": "76e5ac2daa6465ba16c3a566307876cf6d74ff433cf7fd0836bc4a9e389b668a",
6464
"url": "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/vars.json"
6565
}
6666
}

test/schemas/src/schema.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ function getTestFiles(
161161
): { file: string; expect_fail: boolean }[] {
162162
const files = Array.from(
163163
new Set(
164-
globs.flatMap((glob: any) =>
164+
globs.flatMap((glob: string) =>
165165
minimatch.match(test_files, path.join("**", glob)),
166166
),
167167
),
168168
);
169169
const negative_files = Array.from(
170170
new Set(
171-
globs.flatMap((glob: any) =>
171+
globs.flatMap((glob: string) =>
172172
minimatch.match(negative_test_files, path.join("**", glob)),
173173
),
174174
),
@@ -186,6 +186,12 @@ function getAllFiles(dir: string): string[] {
186186
return fs.readdirSync(dir).reduce((files: string[], file: string) => {
187187
const name = path.join(dir, file);
188188
const isDirectory = fs.statSync(name).isDirectory();
189-
return isDirectory ? [...files, ...getAllFiles(name)] : [...files, name];
189+
if (isDirectory) {
190+
files.push(...getAllFiles(name));
191+
return files;
192+
} else {
193+
files.push(name);
194+
return files;
195+
}
190196
}, []);
191197
}

0 commit comments

Comments
 (0)