-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add docs for --namespace-packages #5749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
As a question more about the original diff, what's the reason for leaving it off by default?
Note that this only affects import discovery -- for modules and | ||
packages explicitly passed on the command line, mypy still | ||
searches for ``__init__.py[i]`` files in order to determine the | ||
fully-qualified module/package name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be worth talking about what to do in order to explicitly check code in namespace packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about things like mypy -m foo.bar
if foo
is a namespace package? Users may expect it to work, since the module name is explicit. Similarly, what about mypy -p foo
if foo
is a namespace package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, none of those currently work. Maybe they should, but I don't have time to make it work in this release (command line files/modules/packages use an entirely different code path than imported modules). I'll open a new issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy -c 'import foo.bar'
, I suppose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, there are still problems with that. I'm not sure why. Will try to look into this before the release goes out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe #5758?
It might surprise people. Plus PEP 420 only applies to Python 3. If there's demand (and the bugs are shaken out) we can enable it by default for Python 3 in the future. |
Follow-up for #5691. Should be cherry-picked into the release (#5741). Fixes #5757.