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

bpo-37449: Move ensurepip off of pkgutil and to importlib.resources #15109

Merged
merged 4 commits into from Sep 13, 2019

Conversation

@nanjekyejoannah
Copy link
Contributor

@nanjekyejoannah nanjekyejoannah commented Aug 4, 2019

Move ensurepip off of pkgutil and to importlib.resources.

https://bugs.python.org/issue37449

Automerge-Triggered-By: @ericsnowcurrently

@nanjekyejoannah
Copy link
Contributor Author

@nanjekyejoannah nanjekyejoannah commented Aug 4, 2019

@brettcannon brettcannon self-requested a review Aug 9, 2019
Copy link
Member

@brettcannon brettcannon left a comment

I don't see a change in here to add an __init__.py file to Lib/ensurepip/_bundled to make it be a concrete package instead of a namespace package as importlib.resources won't work with the latter. Did you happen to manually test this and have it succeed? Or am I missing something?

import sys
import tempfile
from . import _bundled

from importlib.resources import read_binary
Copy link
Member

@brettcannon brettcannon Aug 9, 2019

Choose a reason for hiding this comment

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

Import to the module, not the object (both to follow the style of the module and because it avoids circular import issues):

Suggested change
from importlib.resources import read_binary
from importlib import resources

Copy link
Contributor Author

@nanjekyejoannah nanjekyejoannah Aug 9, 2019

Choose a reason for hiding this comment

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

IIRC, I was not able to do the import without adding the init.py to make it a package.

import sys
import tempfile
from . import _bundled
Copy link
Member

@brettcannon brettcannon Aug 9, 2019

Choose a reason for hiding this comment

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

PEP 8 says to sort imports so that stdlib imports com first, then a blank line, then package-local modules.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Aug 9, 2019

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@nanjekyejoannah
Copy link
Contributor Author

@nanjekyejoannah nanjekyejoannah commented Aug 9, 2019

I have made the requested changes; please review again.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Aug 9, 2019

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

Copy link
Member

@brettcannon brettcannon left a comment

One very minor PEP 8 thing, then this looks ready to go!

import sys
import tempfile

from importlib import resources
Copy link
Member

@brettcannon brettcannon Sep 11, 2019

Choose a reason for hiding this comment

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

This should get moved up with the other stdlib modules above.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Sep 11, 2019

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@nanjekyejoannah
Copy link
Contributor Author

@nanjekyejoannah nanjekyejoannah commented Sep 11, 2019

I have made the requested changes; please review again.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Sep 11, 2019

Thanks for making the requested changes!

@brettcannon: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from brettcannon Sep 11, 2019
Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

LGTM

@miss-islington miss-islington merged commit 2ccb50c into python:master Sep 13, 2019
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants