Skip to content
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

Merged
merged 1 commit into from
Oct 9, 2018

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Oct 8, 2018

Follow-up for #5691. Should be cherry-picked into the release (#5741). Fixes #5757.

Copy link
Collaborator

@msullivan msullivan left a 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.
Copy link
Collaborator

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?

Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe #5758?

@gvanrossum
Copy link
Member Author

As a question more about the original diff, what's the reason for leaving it off by default?

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.

@gvanrossum gvanrossum merged commit 2081eda into python:master Oct 9, 2018
@gvanrossum gvanrossum deleted the namespace-docs branch October 9, 2018 14:50
gvanrossum added a commit that referenced this pull request Oct 9, 2018
Follow-up for #5691. Should be cherry-picked into the release (#5741). Fixes #5757.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants