-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
working with third party libs without stubs #3930
Comments
Looks like you manipulated MYPYPATH to point to the stdlib so that mypy
tries to analyze the real (runtime-only) typing.py module instead of its
typing.pyi stub in typeshed. There's a warning in the docs specifically
against doing this.
|
I set it to the virtual-env's site-packages directory:
As I mentioned, there is a |
So the gist is that developers need to maintain a set of stubs for their library even if they're already using type annotations within their code as intended. It's kind of a bummer. Really hoping to see some movement on python/typing#84. |
@chadrik I have started writing a formal PEP. I hope to have a very early draft viable for commenting by the end of this weekend. |
@ethanhs glad to hear it! |
Hi,
mypy is crashing in what I think is a pretty straight-forward situation. This seems to me like a pretty important UX issue, related to python/typing#84
I'm running mypy on a library that contains type annotations. It depends on another library that also contains type annotations, but no stubs. Additionally, because the project supports python 2.x, I'm installing the latest version of the typing module.
In order to find the type-info in the dependency, which was pip-installed into a virtual env, I have to add the site-packages directory of the virtual env to
MYPYPATH
, but doing so causes mypy to get tripped up by the typing module that lives there, which aborts the whole operation:I've ensured that python3 and the venv python both have the latest
typing
:Here's the traceback:
Next, I used pip to uninstall typing and re-ran mypy. This prevents mypy from crashing, but it still gets tripped up by other dependencies in site-packages, this time on one which contains no typing information whatsoever.
If I don't include site-packages in MYPYPATH, I get more details about type errors in my own package, so it appears this error is causing mypy to abort additional phases of type checking.
It's unclear what I should try next. Any help would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: