From 2a92260bc1ac9611578d4c8a577df8003c6a4934 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 17 Aug 2026 16:49:27 +0200 Subject: [PATCH] ci: pass a mypy target that the toolchain still accepts check_type_comments.py runs ignore-listed files through a relaxed mypy pass with --python-version 3.8, which overrides the python_version = 3.9 that .mypy.ini already sets. mypy dropped 3.8 as a modelling target in 1.17.0 and now rejects the flag while parsing arguments, before it reads any source: mypy: error: argument --python-version: Python 3.8 is not supported (must be 3.9 or higher) mypy check failed for: tools/ldgen/ldgen.py The hook declares mypy without a version, so which mypy is used is decided when the ci/images pre-commit-idf-v5.5 image is built. That image is based on Python 3.9, where Requires-Python caps mypy at 1.19.1, and the image currently in use carries exactly that. Any MR touching a file listed in tools/ci/mypy_ignore_list.txt therefore fails check_pre_commit deterministically, whatever the file contains. Pass 3.9 instead, matching .mypy.ini and the OLDEST_PYTHON_SUPPORTED = (3, 9) that tools/python_version_checker.py enforces on this branch. This restores the pairing master and release/v6.0 already have, where the flag mirrors .mypy.ini at 3.10. release/v5.4 and release/v5.3 need no equivalent change: their pre-commit images are based on Python 3.8, where mypy caps at 1.14.1 and the flag is still accepted. Signed-off-by: Frantisek Hrbata --- tools/ci/check_type_comments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/check_type_comments.py b/tools/ci/check_type_comments.py index 38865b08426..e6f2e8ca679 100755 --- a/tools/ci/check_type_comments.py +++ b/tools/ci/check_type_comments.py @@ -29,7 +29,7 @@ def types_valid_ignored_rules(file_name): # type: (str) -> bool """ Run Mypy check with rules for ignore list on the given file, return TRUE if Mypy check passes """ - mypy_exit_code = subprocess.call('mypy {} --python-version 3.8 --allow-untyped-defs'.format(file_name), shell=True) + mypy_exit_code = subprocess.call('mypy {} --python-version 3.9 --allow-untyped-defs'.format(file_name), shell=True) return not bool(mypy_exit_code)