【发布时间】:2020-10-05 06:24:34
【问题描述】:
Python 包 Flask-HTTPAuth 有并且可能不会有类型注释 (source)。我想创建它们并将它们作为 mypy 上的包提供,而无需分叉项目。我创建了一个flask-httpauth-stubs package。
我需要做什么来告诉 mypy 这个包为 Flask-HTTPAuth 提供了存根?
我如何测试
code.py:
from flask_httpauth import HTTPAuth
def autho(a: HTTPAuth):
return a.get_auth()
然后:
$ pip install flask_httpauth flask_httpauth-stubs
$ mypy code.py
code.py:1: error: Skipping analyzing 'flask_httpauth': found module but no type hints or library stubs
code.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
我还尝试将包重命名为 flask_httpauth-stubs,以防 CASE 或破折号/下划线很重要。结果一样。
【问题讨论】:
-
谢谢你,@MarioIshac!我刚刚重命名了这个包,但它没有起到作用。我不知道我做错了什么。我也在gitter.im/python/typing寻求帮助