-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-37449: Move ensurepip off of pkgutil and to importlib.resources #15109
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
Conversation
cc @brettcannon @warsaw . |
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.
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?
Lib/ensurepip/__init__.py
Outdated
import sys | ||
import tempfile | ||
from . import _bundled | ||
|
||
from importlib.resources import read_binary |
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.
Import to the module, not the object (both to follow the style of the module and because it avoids circular import issues):
from importlib.resources import read_binary | |
from importlib import resources |
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.
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 |
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.
PEP 8 says to sort imports so that stdlib imports com first, then a blank line, then package-local modules.
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. |
Thanks for making the requested changes! @brettcannon: please review the changes made to this pull request. |
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.
One very minor PEP 8 thing, then this looks ready to go!
import sys | ||
import tempfile | ||
|
||
from importlib import resources |
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.
This should get moved up with the other stdlib modules above.
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. |
Thanks for making the requested changes! @brettcannon: please review the changes made to this pull request. |
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.
LGTM
…ythonGH-15109) Move ensurepip off of pkgutil and to importlib.resources. https://bugs.python.org/issue37449
…ythonGH-15109) Move ensurepip off of pkgutil and to importlib.resources. https://bugs.python.org/issue37449
Move ensurepip off of pkgutil and to importlib.resources.
https://bugs.python.org/issue37449
Automerge-Triggered-By: @ericsnowcurrently