diff --git a/pyproject.toml b/pyproject.toml index a89a206666..d33b27a99c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -141,12 +141,29 @@ ignore_missing_imports = true ignore_errors = true ignore_missing_imports = true - # pytest (which we depend on) optionally imports numpy, which requires Python 3.8 in - # recent versions. mypy still imports its .pyi file, which has positional-only - # arguments, which don't work in 3.7, which causes mypy to bail out early if you have - # numpy installed. + # Spack imports a number of external packages, and they *may* require Python 3.8 or + # higher in recent versions. This can cause mypy to fail because we check for 3.7 + # compatibility. We could restrict mypy to run for the oldest supported version (3.7), + # but that means most developers won't be able to run mypy, which means it'll fail + # more in CI. Instead, we exclude these imported packages from mypy checking. [[tool.mypy.overrides]] - module = 'numpy' + module = [ + 'IPython', + 'altgraph', + 'attr', + 'boto3', + 'botocore', + 'distro', + 'jinja2', + 'jsonschema', + 'macholib', + 'markupsafe', + 'numpy', + 'pyristent', + 'pytest', + 'ruamel.yaml', + 'six', + ] follow_imports = 'skip' follow_imports_for_stubs = true