You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I'm guessing Jukka initially brought this up because some internal Dropbox code used the idiom, and that code was eventually cleaned up. Mypy is unlikely to add support for highly dynamic patterns like manual manipulation of the __path__ property absent a very compelling use case.
It's possible to manipulate
__path__
in packages to let a package span multiple directories. For example, some files of packagep.q
can be inx/p/q
and remaining files are iny/p/q
. It's difficult to detect this automatically, but we could support a special entry in MYPYPATH for this:(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:
Spaces around entries within
package(...)
should be stripped.This is followup to #1422 and based on an offline discussion we had a while back.
The text was updated successfully, but these errors were encountered: