Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible-lint failing with a Python TypeError: 'default' is an invalid keyword argument for typevar() #4502

Closed
pikkemans opened this issue Jan 30, 2025 · 4 comments
Labels

Comments

@pikkemans
Copy link

pikkemans commented Jan 30, 2025

Summary

Ansible-lint failing with a Python TypeError on Alpine Linux 3.22.0_alpha20250108 (edge) container image.

ansible-lint --version fails with the same python error.

Issue Type
  • Bug Report
OS / ENVIRONMENT

OS: Alpine Linux
release: 3.22.0_alpha20250108 (edge)
platform: arm64, amd64

ansible and ansible-lint installed via apk command.

List of installed packages (edited on 31st of January see comments below)

alpine-baselayout 3.6.8
alpine-baselayout-data 3.6.8
alpine-keys 2.5
alpine-release 3.22.0_alpha20250108
ansible 11.2.0
ansible-core 2.18.2
ansible-core-pyc 2.18.2
ansible-lint 24.12.2
ansible-lint-pyc 24.12.2
ansible-pyc 11.2.0
apk-tools 2.14.7
black 24.10.0
black-pyc 24.10.0
brotli-libs 1.1.0
busybox 1.37.0
busybox-binsh 1.37.0
c-ares 1.34.4
ca-certificates-bundle 20241121
gdbm 1.24
git 2.48.1
git-init-template 2.48.1
libbz2 1.0.8
libcrypto3 3.3.2
libcurl 8.11.1
libexpat 2.6.4
libffi 3.4.6
libgcc 14.2.0
libidn2 2.3.7
libncursesw 6.5_p20250118
libpanelw 6.5_p20250118
libpsl 0.21.5
libssl3 3.3.2
libstdc++ 14.2.0
libunistring 1.3
mpdecimal 4.0.0
musl 1.2.5
musl-utils 1.2.5
ncurses-terminfo-base 6.5_p20250118
nghttp2-libs 1.64.0
pcre2 10.43
py3-ansible-compat 25.1.1
py3-ansible-compat-pyc 25.1.1
py3-attrs 24.2.0
py3-attrs-pyc 24.2.0
py3-bcrypt 4.2.1
py3-bcrypt-pyc 4.2.1
py3-bracex 2.5
py3-bracex-pyc 2.5
py3-certifi 2024.12.14
py3-certifi-pyc 2024.12.14
py3-cffi 1.17.1
py3-cffi-pyc 1.17.1
py3-charset-normalizer 3.4.1
py3-charset-normalizer-pyc 3.4.1
py3-click 8.1.8
py3-click-pyc 8.1.8
py3-cparser 2.22
py3-cparser-pyc 2.22
py3-cryptography 44.0.0
py3-cryptography-pyc 44.0.0
py3-editables 0.5
py3-editables-pyc 0.5
py3-enrich 1.2.7
py3-enrich-pyc 1.2.7
py3-filelock 3.16.1
py3-filelock-pyc 3.16.1
py3-hatchling 1.27.0
py3-hatchling-pyc 1.27.0
py3-idna 3.10
py3-idna-pyc 3.10
py3-importlib-metadata 7.0.2
py3-importlib-metadata-pyc 7.0.2
py3-jinja2 3.1.5
py3-jinja2-pyc 3.1.5
py3-jsonschema 4.23.0
py3-jsonschema-pyc 4.23.0
py3-jsonschema-specifications 2024.10.1
py3-jsonschema-specifications-pyc 2024.10.1
py3-markdown-it-py 3.0.0
py3-markdown-it-py-pyc 3.0.0
py3-markupsafe 3.0.2
py3-markupsafe-pyc 3.0.2
py3-mdurl 0.1.2
py3-mdurl-pyc 0.1.2
py3-mypy-extensions 1.0.0
py3-mypy-extensions-pyc 1.0.0
py3-packaging 24.2
py3-packaging-pyc 24.2
py3-paramiko 3.5.0
py3-paramiko-pyc 3.5.0
py3-parsing 3.2.0
py3-parsing-pyc 3.2.0
py3-pathspec 0.12.1
py3-pathspec-pyc 0.12.1
py3-platformdirs 4.3.6
py3-platformdirs-pyc 4.3.6
py3-pluggy 1.5.0
py3-pluggy-pyc 1.5.0
py3-pygments 2.19.1
py3-pygments-pyc 2.19.1
py3-pynacl 1.5.0
py3-pynacl-pyc 1.5.0
py3-referencing 0.36.2
py3-referencing-pyc 0.36.2
py3-requests 2.32.3
py3-requests-pyc 2.32.3
py3-resolvelib 1.1.0
py3-resolvelib-pyc 1.1.0
py3-rich 13.9.4
py3-rich-pyc 13.9.4
py3-rpds-py 0.22.3
py3-rpds-py-pyc 0.22.3
py3-ruamel.yaml 0.17.28
py3-ruamel.yaml-pyc 0.17.28
py3-ruamel.yaml.clib 0.2.8
py3-subprocess-tee 0.4.2
py3-subprocess-tee-pyc 0.4.2
py3-trove-classifiers 2025.1.15.22
py3-trove-classifiers-pyc 2025.1.15.22
py3-typed-ast 1.5.5
py3-typed-ast-pyc 1.5.5
py3-urllib3 1.26.20
py3-urllib3-pyc 1.26.20
py3-wcmatch 9.0
py3-wcmatch-pyc 9.0
py3-yaml 6.0.2
py3-yaml-pyc 6.0.2
py3-zipp 3.17.0
py3-zipp-pyc 3.17.0
pyc 3.12.8
python3 3.12.8
python3-pyc 3.12.8
python3-pycache-pyc0 3.12.8
readline 8.2.13
scanelf 1.3.8
sqlite-libs 3.48.0
ssl_client 1.37.0
xz-libs 5.6.4
yaml 0.2.5
yamllint 1.35.1
yamllint-pyc 1.35.1
zlib 1.3.1
zstd-libs 1.5.6
STEPS TO REPRODUCE
docker run -it  alpine:edge /bin/sh -c "apk add --update ansible ansible-lint; ansible-lint --version"
Desired Behavior

Expected output is the result of ansible-lint --version

example ansible-lint 24.10.0 using ansible-core:2.18.1 ansible-compat:24.10.0 ruamel-yaml:0.17.28 ruamel-yaml-clib:0.2.8

Actual Behavior
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 5, in <module>
    from ansiblelint.__main__ import _run_cli_entrypoint
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 49, in <module>
    from ansiblelint import cli
  File "/usr/lib/python3.12/site-packages/ansiblelint/cli.py", line 29, in <module>
    from ansiblelint.schemas.main import validate_file_schema
  File "/usr/lib/python3.12/site-packages/ansiblelint/schemas/main.py", line 12, in <module>
    from jsonschema.exceptions import ValidationError
  File "/usr/lib/python3.12/site-packages/jsonschema/__init__.py", line 13, in <module>
    from jsonschema._format import FormatChecker
  File "/usr/lib/python3.12/site-packages/jsonschema/_format.py", line 11, in <module>
    from jsonschema.exceptions import FormatError
  File "/usr/lib/python3.12/site-packages/jsonschema/exceptions.py", line 15, in <module>
    from referencing.exceptions import Unresolvable as _Unresolvable
  File "/usr/lib/python3.12/site-packages/referencing/__init__.py", line 5, in <module>
    from referencing._core import Anchor, Registry, Resource, Specification
  File "/usr/lib/python3.12/site-packages/referencing/_core.py", line 18, in <module>
    from referencing.typing import URI, Anchor as AnchorType, D, Mapping, Retrieve
  File "/usr/lib/python3.12/site-packages/referencing/typing.py", line 22, in <module>
    D = TypeVar("D", default=Any)
        ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'default' is an invalid keyword argument for typevar()
@ssbarnea
Copy link
Member

This is an upstream bug python-jsonschema/referencing#216

@ssbarnea
Copy link
Member

ssbarnea commented Jan 30, 2025

What version of referencing library do you have? I am asking because our tests run with referencing==0.36.2 and they did pass on all python versions.

Have you tried to install and use linter using pipx install 'ansible-lint[lock]'? This ensures that all dependencies are the same as the tested ones.

I am almost sure this was caused by your referencing being 0.35.1.

@ssbarnea ssbarnea self-assigned this Jan 30, 2025
@ssbarnea ssbarnea removed the new Triage required label Jan 30, 2025
@pikkemans
Copy link
Author

Hi @ssbarnea , Thank you for taking the time to respond. It appears my initial post is incorrect as I put in the wrong package installed list. The initial post had the installed package list of Alpine 3.21 (which is working correctly)

This is the installed packages list from the Alpine 3.22.0_alpha20250108 (edge) image

alpine-baselayout 3.6.8
alpine-baselayout-data 3.6.8
alpine-keys 2.5
alpine-release 3.22.0_alpha20250108
ansible 11.2.0
ansible-core 2.18.2
ansible-core-pyc 2.18.2
ansible-lint 24.12.2
ansible-lint-pyc 24.12.2
ansible-pyc 11.2.0
apk-tools 2.14.7
black 24.10.0
black-pyc 24.10.0
brotli-libs 1.1.0
busybox 1.37.0
busybox-binsh 1.37.0
c-ares 1.34.4
ca-certificates-bundle 20241121
gdbm 1.24
git 2.48.1
git-init-template 2.48.1
libbz2 1.0.8
libcrypto3 3.3.2
libcurl 8.11.1
libexpat 2.6.4
libffi 3.4.6
libgcc 14.2.0
libidn2 2.3.7
libncursesw 6.5_p20250118
libpanelw 6.5_p20250118
libpsl 0.21.5
libssl3 3.3.2
libstdc++ 14.2.0
libunistring 1.3
mpdecimal 4.0.0
musl 1.2.5
musl-utils 1.2.5
ncurses-terminfo-base 6.5_p20250118
nghttp2-libs 1.64.0
pcre2 10.43
py3-ansible-compat 25.1.1
py3-ansible-compat-pyc 25.1.1
py3-attrs 24.2.0
py3-attrs-pyc 24.2.0
py3-bcrypt 4.2.1
py3-bcrypt-pyc 4.2.1
py3-bracex 2.5
py3-bracex-pyc 2.5
py3-certifi 2024.12.14
py3-certifi-pyc 2024.12.14
py3-cffi 1.17.1
py3-cffi-pyc 1.17.1
py3-charset-normalizer 3.4.1
py3-charset-normalizer-pyc 3.4.1
py3-click 8.1.8
py3-click-pyc 8.1.8
py3-cparser 2.22
py3-cparser-pyc 2.22
py3-cryptography 44.0.0
py3-cryptography-pyc 44.0.0
py3-editables 0.5
py3-editables-pyc 0.5
py3-enrich 1.2.7
py3-enrich-pyc 1.2.7
py3-filelock 3.16.1
py3-filelock-pyc 3.16.1
py3-hatchling 1.27.0
py3-hatchling-pyc 1.27.0
py3-idna 3.10
py3-idna-pyc 3.10
py3-importlib-metadata 7.0.2
py3-importlib-metadata-pyc 7.0.2
py3-jinja2 3.1.5
py3-jinja2-pyc 3.1.5
py3-jsonschema 4.23.0
py3-jsonschema-pyc 4.23.0
py3-jsonschema-specifications 2024.10.1
py3-jsonschema-specifications-pyc 2024.10.1
py3-markdown-it-py 3.0.0
py3-markdown-it-py-pyc 3.0.0
py3-markupsafe 3.0.2
py3-markupsafe-pyc 3.0.2
py3-mdurl 0.1.2
py3-mdurl-pyc 0.1.2
py3-mypy-extensions 1.0.0
py3-mypy-extensions-pyc 1.0.0
py3-packaging 24.2
py3-packaging-pyc 24.2
py3-paramiko 3.5.0
py3-paramiko-pyc 3.5.0
py3-parsing 3.2.0
py3-parsing-pyc 3.2.0
py3-pathspec 0.12.1
py3-pathspec-pyc 0.12.1
py3-platformdirs 4.3.6
py3-platformdirs-pyc 4.3.6
py3-pluggy 1.5.0
py3-pluggy-pyc 1.5.0
py3-pygments 2.19.1
py3-pygments-pyc 2.19.1
py3-pynacl 1.5.0
py3-pynacl-pyc 1.5.0
py3-referencing 0.36.2
py3-referencing-pyc 0.36.2
py3-requests 2.32.3
py3-requests-pyc 2.32.3
py3-resolvelib 1.1.0
py3-resolvelib-pyc 1.1.0
py3-rich 13.9.4
py3-rich-pyc 13.9.4
py3-rpds-py 0.22.3
py3-rpds-py-pyc 0.22.3
py3-ruamel.yaml 0.17.28
py3-ruamel.yaml-pyc 0.17.28
py3-ruamel.yaml.clib 0.2.8
py3-subprocess-tee 0.4.2
py3-subprocess-tee-pyc 0.4.2
py3-trove-classifiers 2025.1.15.22
py3-trove-classifiers-pyc 2025.1.15.22
py3-typed-ast 1.5.5
py3-typed-ast-pyc 1.5.5
py3-urllib3 1.26.20
py3-urllib3-pyc 1.26.20
py3-wcmatch 9.0
py3-wcmatch-pyc 9.0
py3-yaml 6.0.2
py3-yaml-pyc 6.0.2
py3-zipp 3.17.0
py3-zipp-pyc 3.17.0
pyc 3.12.8
python3 3.12.8
python3-pyc 3.12.8
python3-pycache-pyc0 3.12.8
readline 8.2.13
scanelf 1.3.8
sqlite-libs 3.48.0
ssl_client 1.37.0
xz-libs 5.6.4
yaml 0.2.5
yamllint 1.35.1
yamllint-pyc 1.35.1
zlib 1.3.1
zstd-libs 1.5.6

As you can see py3-referencing 0.36.2 is installed on the system.

bahill added a commit to broadinstitute/hca-ingest-migration that referenced this issue Feb 3, 2025
bahill added a commit to broadinstitute/hca-ingest-migration that referenced this issue Feb 3, 2025
@ssbarnea
Copy link
Member

ssbarnea commented Feb 5, 2025

Closing this because is a downstream packaging issue.

@ssbarnea ssbarnea closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2025
@ssbarnea ssbarnea removed their assignment Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants