flake8-mypy
flake8-mypy copied to clipboard
Flake8 does not respect mypy.ini
I have a mypy.ini file at project root, with Python version set to 3.7.. Running flake8 on any file in that directory still gives me T499 mypy: error: failed to find a Python executable matching version (3, 6). Running mypy standalone works straight out of the box, with or without mypy.ini, without any additional arguments or configuration.
$ which flake8
~/anaconda3/bin/flake8
$ which python
~/anaconda3/bin/python
$ python ~/anaconda3/bin/flake8 multipuller/feed.py
multipuller/feed.py:1:1: T499 usage: mypy [-h] [-v] [-V] [more options; see below]
multipuller/feed.py:2:1: T499 [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
multipuller/feed.py:3:1: T499 mypy: error: failed to find a Python executable matching version (3, 6), perhaps try --python-executable, or --no-site-packages?
$ python --version
Python 3.7.0
$ mypy multipuller/feed.py
multipuller/feed.py:101:8: error: "Dict[str, Any]" has no attribute "entries"
multipuller/feed.py:102:22: error: "Dict[str, Any]" has no attribute "entries"
multipuller/feed.py:112:13: error: "Dict[str, Any]" has no attribute "feed_dict"
multipuller/feed.py:113:15: error: "Dict[str, Any]" has no attribute "feed_dict"
multipuller/feed.py:114:18: error: "Dict[str, Any]" has no attribute "feed_dict"
multipuller/feed.py:117:17: error: "Dict[str, Any]" has no attribute "feed_dict"
$ head -2 mypy.ini
[mypy]
python_version=3.7
(The problem with using --mypy-config is that is does NOT work in subdirectories)
Have also tried adding this to setup.cfg, without luck:
#[mypy]
#python_version = 3.7
Also fixed by https://github.com/ambv/flake8-mypy/pull/22/files
Try from master!
Although this will only fix the problem for the version. In case you wanna check for another platform than linux, I'm afraid that the problem remains...