Running ansible-lint via pre-commit requires python3.14

The Ansible roles I write, on machines running Debian Trixie, which has Python 3.13.5, generally have .pre-commit-config.yaml files like this:

---
repos:
  # https://github.com/adrienverge/yamllint/tags
  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.38.0
    hooks:
      - id: yamllint
        name: YAML Lint
  # https://github.com/aristanetworks/j2lint/releases
  - repo: https://github.com/aristanetworks/j2lint.git
    rev: v1.2.0
    hooks:
      - id: j2lint
        name: Jinja2-Linter
        args:
          - templates
  # https://github.com/jackdewinter/pymarkdown/releases
  - repo: https://github.com/jackdewinter/pymarkdown.git
    rev: v0.9.34
    hooks:
      - id: pymarkdown
        name: Markdown Lint
  # https://github.com/ansible/ansible-lint/releases
  - repo: https://github.com/ansible/ansible-lint.git
    rev: v26.1.1
    hooks:
      - id: ansible-lint
        name: Ansible Lint
        language: python
        additional_dependencies:
          # https://pypi.org/project/ansible/
          - ansible==13.4.0
          # https://github.com/kellyjonbrazil/jc/releases
          - jc==1.25.6
          # https://github.com/jmespath/jmespath.py/tags
          - jmespath==1.0.1
...

In the past I was able to increment the ansible-lint version string when there were new releases (incidentally new ansible-lint releases don’t result in posts in the News & Announcements > Ecosystem Releases category on this forum).

However I am currently stuck on ansible-lint 26.1.1 as most recent versions require Python 3.14, is this intentional, is this the result of a policy or is this an accident? Would it be possible to enable the running ansible-lint via pre-commit to work with multiple versions of Python?

I’m posting this here as the GitHub issue I opened about this hasn’t had a response.

This can be solved by adding language_version: python3:

---
repos:
  - repo: https://github.com/ansible/ansible-lint.git
    rev: v26.3.0
    hooks:
      - id: ansible-lint
        name: Ansible Lint
        language: python
        language_version: python3
        additional_dependencies:
          # https://pypi.org/project/ansible/
          - ansible==13.4.0
          # https://github.com/kellyjonbrazil/jc/releases
          - jc==1.25.6
          # https://github.com/jmespath/jmespath.py/tags
          - jmespath==1.0.1
...
2 Likes