Skip to content

Support recursive traversal into PEP 420 namespace packages #7219

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

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

warsaw
Copy link
Member

@warsaw warsaw commented Jul 15, 2019

E.g. with this file layout:

src/
    anamespace/
        foo/
            __init__.py
            bar.py

running

$ MYPYPATH=src mypy -p foo --namespace-packages

will traverse into src/anamespace/foo

Closes #6989

warsaw added a commit to warsaw/pygradle that referenced this pull request Jul 16, 2019
If and when python/mypy#7219 lands, we will have the
ability to tell mypy to traverse into PEP 420 namespace packages.  In order to
preserve backward compatibility, the MypyExtension now allows clients to set
the mypy command line arguments, but if they don't it will use the old command
line of just passing the source directory.
@warsaw
Copy link
Member Author

warsaw commented Jul 16, 2019

After internal testing, this does seem to do what I'm looking for.

One small semi-related gotcha: you can't seem to specify -p/--package in the mypy.ini or setup.cfg file.

E.g. with this file layout:

src/
    anamespace/
        foo/
            __init__.py
            bar.py

$ MYPYPATH=src mypy -p foo --namespace-packages

will traverse into src/anamespace/foo
@emmatyping
Copy link
Member

I restarted the failed travis job, seems to have been an error on their end.

@warsaw
Copy link
Member Author

warsaw commented Jul 18, 2019

I wonder if appveyor is stuck?

@JelleZijlstra
Copy link
Member

It looks like it actually succeeded but didn't report success GitHub.

@warsaw
Copy link
Member Author

warsaw commented Jul 18, 2019

@JelleZijlstra Should I push another commit or is the status good enough to review (and hopefully merge :) this PR?

@JelleZijlstra
Copy link
Member

I think it should be fine but I won't be merging the PR, sorry.

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.

This looks good to me!

@msullivan msullivan merged commit 404d5c9 into python:master Jul 18, 2019
@warsaw warsaw deleted the issue6989 branch July 19, 2019 16:42
@warsaw
Copy link
Member Author

warsaw commented Jul 19, 2019

Thanks! I look forward to the next release. I'll likely hot fix our internal version in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discovery strategy is still mysterious w/PEP 420 namespace packages
4 participants