-
-
Notifications
You must be signed in to change notification settings - Fork 3k
MYPYPATH directory used even if no __init__.py #19129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is this because namespace packages? |
Yeah, possibly. In our actual codebase, we use From the docs:
I don't see any mention of how namespace packages affect this; if they do, are these docs incomplete? It looks like namespace packages are only discussed in the section about specifying files on the command line. |
I assume namespace package support was added after the documentation was added. If this issue is indeed because of namespace package support and also this is intended (I'm not sure, I haven't got much experience with it) then this should just be a documentation update. |
You might be right; it looks like there's namespace logic in the module finder logic: Line 563 in 3f50e3c
Possibly just a docs update then |
Bug Report
According to the docs, when importing
foo.bar
, mypy will look through each directory inMYPYPATH
and find a match. A directory is matched if it contains a__init__.py(i)
file. However, I'm seeing behavior where an empty directory in MYPYPATH causes typechecking to fail.To Reproduce
Expected Behavior
If
<dir>
does not contain any__init__.py
files recursively, then addingMYPYPATH=<dir>
should not make any differenceActual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: