summaryrefslogtreecommitdiff
path: root/pyproject.toml
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2023-07-11 04:30:07 -0700
committerGitHub <noreply@github.com>2023-07-11 13:30:07 +0200
commit162d0926f939ce938279e73fd07ff6634ee35770 (patch)
tree79f4de0dc3051c39d50de493fab46c2e16f080a8 /pyproject.toml
parentf0ef0ceb341fa3f35b4ca1d06f62fa9d94343bd7 (diff)
downloadspack-162d0926f939ce938279e73fd07ff6634ee35770.tar.gz
spack-162d0926f939ce938279e73fd07ff6634ee35770.tar.bz2
spack-162d0926f939ce938279e73fd07ff6634ee35770.tar.xz
spack-162d0926f939ce938279e73fd07ff6634ee35770.zip
mypy: add more ignored modules to `pyproject.toml` (#38769)
`mypy` will check *all* imported packages, even optional dependencies outside your project, and this can cause issues if you are targeting python versions *older* than the one you're running in. `mypy` will report issues in the latest versions of dependencies as errors even if installing on some older python would have installed an older version of the dependency. We saw this problem before with `numpy` in #34732. We've started seeing it with IPython in #38704. This fixes the issue by exempting `IPython` and a number of other imports of Spack's from `mypy` checking.
Diffstat (limited to 'pyproject.toml')
-rw-r--r--pyproject.toml27
1 files changed, 22 insertions, 5 deletions
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