# Static type checking for the non-GUI Python helper scripts. # # Unlike black/isort/pylint, which CI runs over every changed lintable file, # mypy runs over the explicit allowlist below: it is a whole-program analysis, # so a diff-shaped file list would make sibling imports resolve to Any, and most # of the ~74 lintable scripts predate any annotation effort and are adopted one # at a time. Onboarding a file means listing it here and in the matching # `include` of pyrightconfig.json, which gives editors the same project scope. # # python_version is the floor the scripts must run on, not the version CI # happens to provide; keep it in sync with PY3_MINIMUM_VERSION in # cmake-scripts/options.cmake. It is the *only* mechanical check of the stdlib # half of that floor: pylint's py-version covers syntax but not stdlib # availability, and passes math.lcm (3.9) or copytree(dirs_exist_ok=) (3.8). # # The mypy pin in requirements-dev.txt is coupled to this value: 1.8.x is the # last release able to target 3.7, so the two move together or not at all. [mypy] # Comma-separated (a newline alone does not split the list: mypy would take the # whole block as one filename). files = findsym.py, generate_enums.py, .github/actions/vcpkg-cache-restore/gnu-mirror.py, tests/test_collections_errors.py, tests/test_executable_path.py, tests/test_relocatable.py, tests/test_surface_errors.py python_version = 3.7 # Mypy's default, stated because the allowlist strategy depends on it and it # should not change silently under a version bump. check_untyped_defs = False # Once a file is on the allowlist, hold it to a real standard. disallow_untyped_defs = True disallow_incomplete_defs = True warn_return_any = True warn_unused_ignores = True warn_redundant_casts = True warn_unused_configs = True no_implicit_optional = True strict_equality = True