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 in MYPYPATH 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.
Given that
PYTHONPATHcontains.../pythonX.Y/site-packagesAnd a package that contains some private 3rd party stubs under
.../pythonX.Y/site-packages/foo/some_stubsWhen setting
MYPYPATHto.../pythonX.Y/site-packages/foo/some_stubsThen
mypygives 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
MYPYPATHand does not seem to mention any restriction on the location of stubs added viaMYPYPATH.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-stubsand adding this path toMYPYPATH.