faker 库的 MyPy 存根
我在 Python 项目中使用 faker 12.3.3,并希望使用 MyPy 作为代码质量检查的一部分。
收到以下错误
error: Cannot find implementation or library stub for module named "faker"
我猜我必须为我正在使用的特定 faker 类编写一个存根文件?
我正在使用 PyEnv 运行各种版本的 Python,所以我不确定这样的存根(如果我要编写它)将安装在哪里。
另一种选择是告诉 MyPy 忽略 faker 类,这感觉就像是在逃避。 有许多广泛使用的 Python 库似乎会困扰 MyPy,因此了解如何最好地处理这些问题将是一个很大的推动。
I am using faker 12.3.3 in my Python project and want to use MyPy as part of my code quality checks.
I get the following error
error: Cannot find implementation or library stub for module named "faker"
I have looked on typeshed but there are no stubs shown there.
I am guessing that I would have to write a stub file for the particular faker classes I am using?
I am using PyEnv to run various versions of Python so am not sure where such a stub, if I was to write it, would be installed.
Another option is to tell MyPy to ignore the faker class which feels like a cop out.
There are a number of widely used Python libraries that seem to trip up MyPy so knowing how best to deal with these issues would be a big boost.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论