mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 10:40:47 +03:00
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 <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user