-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
It's possible to manipulate __path__
in packages to let a package span multiple directories. For example, some files of package p.q
can be in x/p/q
and remaining files are in y/p/q
. It's difficult to detect this automatically, but we could support a special entry in MYPYPATH for this:
export MYPYPATH=package(p.q,x,y)
(I'm working on some internal Dropbox code that uses this idiom.)
Any positive number of directories can be included. By including a single directory, it's possible to only pick a particular module/package from a site packages directory. This can be useful for third party modules that are annotated and don't have stubs in typeshed. Including the entire site packages directory in MYPYPATH would likely result in mypy getting very confused, as most of the code would probably not be mypy compatible. Example:
export MYPYPATH=package(mypackage,/path/site-packages)
Spaces around entries within package(...)
should be stripped.
This is followup to #1422 and based on an offline discussion we had a while back.