开始使用mypy/忽略外部lib

2024-10-16 20:46:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试运行mypy类型的提示,只是得到了很多外部库的错误

我查过了this topic in the docs

并且有这样一个mypy.ini

# Global options:

[mypy]
python_version = 3.8
; warn_return_any = True
; warn_unused_configs = True

# Per-module options:

[httplib2]
ignore_missing_imports = True

[google.cloud]
ignore_missing_imports = True

但是当我运行mypy时,它仍然会用这些错误填充控制台。 而且,讽刺的是,在我自己的代码中没有发现任何故意的错误

(venv) dcollier@dcsan:~/dev/kzen$ mypy cxutils/digger/chat_stat.py 
cxutils/gbot.py:11: error: Skipping analyzing 'httplib2': found module but no type hints or library stubs
cxutils/logit.py:10: error: Skipping analyzing 'google.cloud': found module but no type hints or library stubs
cxutils/logit.py:12: error: Skipping analyzing 'ansimarkup': found module but no type hints or library stubs
cxutils/biglib.py:18: error: Skipping analyzing 'pandas_gbq': found module but no type hints or library stubs

... etc

我在一个virtualenv中使用mypy,并且which mypy证实了这一点


Tags: ornopytruetypelibraryerrorbut