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:
-
MYPYPATH
does not include../pythonX.Y/site-packages
. It does include.../pythonX.Y/site-packages/foo/some_stubs
but that is a very different directory. -
Due to this error
mypy
refuses to use the stubs listed inMYPYPATH
in 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
.