-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[question] How to find pyi stubs? #3626
Comments
Mypy does not look at Python-installed packages by default; it only looks at stubs from typeshed and those accessible through paths in the MYPYPATH environment variable. I'm working on a proposal (see python/typing#84) to provide a way for third-party packages to install their stubs in a place where mypy can find them. |
IIRC the mentioned issue is about separate stub libraries. Using Moreover if I have well-annotated dependency library without stubs mypy ignores it until I add a path to its source code in That's sad. Is there workaround for this? |
Yes, the proposed solution would be that libraries that distribute pyi files put them in some dedicated directory other than site-packages. Until then, I'm afraid you will have to manually work with MYPYPATH. |
Ok. Thanks. |
Pointing MYPYPATH to |
I want to enable mypy checks for yarl library.
The library depends on multidict.
Multdict itself has stub annotation file
__init__.pyi
(I should use stubs because multidict has Cython C Extensions thus I need support stubs for both Python and C Accelerator versions).__init__.pyi
is included in both.tar.gz
and.whl
distribution files and uploaded to PyPI.In yarl I use
__init__.pyi
stub also.Now in yarl project I run
mypy -p yarl
.Report is:
'yarl._quoting'
is another C Extension, I'll cope with it later.Cannot find module named 'multidict'
is the source of my problem. The module is definitely present and was installed bypip install multidict
. Binary wheel with compiled.so
files is used..../site-packages/multidict/__init__.pyi
is present along with.../site-packages/multidict/__init__.py
.import multidict
works without problem.Why
mypy
doesn't find info aboutmultidict
module?I use fresh virtual environment with mypy and multidict installed.
Python==3.6.1
MyPy==0.511
The text was updated successfully, but these errors were encountered: