-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Given that PYTHONPATH contains .../pythonX.Y/site-packages
And a package that contains some private 3rd party stubs under .../pythonX.Y/site-packages/foo/some_stubs
When setting MYPYPATH to .../pythonX.Y/site-packages/foo/some_stubs
Then mypy gives the error .../pythonX.Y/site-packages is in the MYPYPATH. Please remove it..
This is wrong because:
-
MYPYPATHdoes not include../pythonX.Y/site-packages. It does include.../pythonX.Y/site-packages/foo/some_stubsbut that is a very different directory. -
Due to this error
mypyrefuses to use the stubs listed inMYPYPATHin this case.
This probably isn't intentional? The relevant PEP explicitly allows for MYPYPATH and does not seem to mention any restriction on the location of stubs added via MYPYPATH.
It is possible to work around the problem by copying (or linking) the stubs to a directory which is not under ../pythonX.Y/site-packages, say into ~/.foo-stubs and adding this path to MYPYPATH.