bazel-contrib/bazel-mypy-integration

Cannot find third-party libraries used via `requirement`

psalvaggio-dl opened this issue · 3 comments

I am trying to stand up a monorepo that runs mypy as part of the build phase. I have been installing third-party libraries via pip_parse and requirement in rules_python. However, when I tried out this integration, I get:

error: Cannot find implementation or library stub for module named "numpy"

for all of the third-party dependencies that I depend on via requirement. This seems like the most basic use case, so I figure I must be doing something wrong, but I am not seeing anything in the README about third party imports. Is there a way to make this integration aware of my requirements-based imports?

Thanks,
Phil

In practice, if the Typeshed doesn't ship with the stubs, we just resort to ignoring the third-party package using mypy.ini config. This obviously cuts out a large amount of the type-checking mypy could do, but there hasn't been a lot of interest/investment in the mypy_stubs rule.

That said, I thought I heard that recent versions of typeshed do ship numpy stubs.

OK, I looked into typeshed and I don’t see numpy or any of the other libraries I was using in there. I will try to make a standalone example with some of the libraries in there tomorrow and see if that works. I’m new to Python so I went for mypy because it seems to be the most common and the only one with Bazel integration, but perhaps pytype might be a better solution for my team if we’re going to be using libraries that mypy cannot handle.

Duplicate of #39 - I'm working on it right now.