I am running Mypy v0.910
with pre-commit
. It complains that python-dateutil
does not have type stubs. However, even after installing the stubs, I get the same error.
My pre-commit config is
default_language_version:
python: python3
repos:
<other hooks>
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
args:
- --install-types
additional_dependencies: [tokenize-rt==3.2.0]
When I try to commit, it complains that the stubs are not there and then fails to install them.
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1
coordinator/policy.py:5: error: Library stubs not installed for "dateutil.parser" (or incompatible with Python 3.7)
coordinator/policy.py:5: note: Hint: "python3 -m pip install types-python-dateutil"
coordinator/policy.py:5: note: (or run "mypy --install-types" to install all missing stub packages)
tests/test_policy.py:6: error: Cannot find implementation or library stub for module named "pyhocon"
coordinator/configuration.py:4: error: Cannot find implementation or library stub for module named "pyhocon"
coordinator/configuration.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 3 errors in 3 files (checked 7 source files)
Installing missing stub packages:
/Users/me/.cache/pre-commit/repov_smpwjv/py_env-python3/bin/python -m pip install types-python-dateutil
Install? [yN] Traceback (most recent call last):
File "/Users/me/.cache/pre-commit/repov_smpwjv/py_env-python3/bin/mypy", line 8, in <module>
sys.exit(console_entry())
File "/Users/me/.cache/pre-commit/repov_smpwjv/py_env-python3/lib/python3.7/site-packages/mypy/__main__.py", line 11, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 120, in main
File "mypy/main.py", line 1161, in install_types
EOFError: EOF when reading a line
There appears to be an open issue related to this on python-dateutil: https://github.com/dateutil/dateutil/issues/383
Is there a way to tell Mypy
not to worry about the missing stubs? At the moment, the only workaround that I can think of is to completely disable Mypy
.