如何在 mypy 中使用 typeshed? [英] How to use typeshed with mypy?

查看:93
本文介绍了如何在 mypy 中使用 typeshed?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我克隆了 typeshed 但我不知道如何告诉 mypy 使用类型提示它包含,我在 mypy --help 中看不到任何选项.mypy 存储库确实包含对 typeshed 存储库的引用,但安装它的 pip 不会下载它.

I cloned typeshed but I can't figure out how to tell mypy to use the type hints it contains, I see no option in mypy --help. The mypy repo does contain reference to the typeshed repo, but pip installing it doesn't not download it.

推荐答案

Mypy 默认与 typeshed 捆绑在一起,所以你不需要做任何事情——只需执行 pip install mypy 就会安装它正确.

Mypy comes bundled with typeshed by default, so you shouldn't need to do anything -- simply doing pip install mypy will install it correctly.

请注意,typeshed 不是 Python 模块,因此无法从 Python 程序导入或以其他方式访问它,除非您从字面上查看存根在文件系统中的存储位置.

Note that typeshed is not a Python module, so it isn't possible to import it or otherwise access it from a Python program unless you literally look at the location in the filesystem the stubs are stored.

这篇关于如何在 mypy 中使用 typeshed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆