-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Move all internal APIs to pip._internal #4700
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
Yeah, no way I'll be able to review this, but I'm +1 on the idea and if tests pass that's probably all we can expect to check. Probably worth taking care when we merge this - as you noted elsewhere it'll break pretty much every existing PR... |
@pfmoore Yea. I don't really have a good idea for how to take care of when we merge this. I think no matter what it's gonna suck and probably there's not really a good way forward besides just doing it. |
@@ -0,0 +1,2 @@ | |||
Move all of pip's APIs into the pip._internal package, properly reflecting the |
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 happens if there are 2 news files?
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.
If the contents are the same, it'll get rolled up into a single news entry, referencing multiple issues.
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.
Oh, that's neat. I never realised this was possible.
@@ -1,4 +0,0 @@ | |||
from pip.models.index import Index, PyPI |
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.
You might have removed 2 files unintentionally.
pip.models.__init__
and pip._vendor.cachecontrol.compat
.
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.
Both of those files still exist.
src/pip/_internal/__init__.py
Outdated
@@ -17,7 +17,9 @@ | |||
# to add socks as yet another dependency for pip, nor do I want to allow-stder | |||
# in the DEP-8 tests, so just suppress the warning. pdb tells me this has to | |||
# be done before the import of pip.vcs. | |||
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning | |||
from pip._internal.vendor.requests.packages.urllib3.exceptions import ( |
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.
How about keeping vendored packages in pip._vendor
?
I know it's bike shedding but if everyone agrees it's a nicer colour, that's good too. :)
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.
Fine with me.
Is this going to be merged soon? If so, then I probably need to merge this branch into my PR to avoid conflicts. |
Since de-vendoring support exists only for downstream, and they need to patch pip to get that support anyways, it seems reasonable to push support for testing that configuration onto them. This is something they need to do anyways, since they need to test their versions of the vendored libraries. See pypa#4657 for more information.
@xoviat Yes, right now actually. |
Note that this will break virtualenv at some point, since even something like I know using pip's internal API is unsupported outside of pip, but there's a difference between not supporting outside use (and saying so when a related bug is open) and actively breaking every project in existence that might be using it... |
@benoit-pierre Sorry if I'm being nosy but could you explain how this affects virtualenv? I'm not understanding that... |
It won't break virtualenv until virtualenv bundles a new copy of pip, at which point virtualenv can be updated. |
As far as I know, that only depends on pip.main, which is "semi-suppported." @dstufft What about importing |
Okay then, apparently not going to happen. |
So, if someone does
Please no... That would defeat the whole purpose of doing this change. |
What about this virtualenv API use-case: python -c 'import sys, virtualenv; virtualenv.create_environment(sys.argv[1], search_dirs=sys.argv[2:]) venv directory_with_updated_wheels ? |
@pradyunsg as far as i can tell the environment would not break at all - the script is only executed with a self-defined pythonpath |
Virtualenv uses a bundled copy of pip. The only way that would change is if someone has explicitly overridden the bundled copy of pip (as @benoit-pierre posted above). But we don't, and have never attempted to support arbitrary versions of pip in that (virtualenv does more than just call |
Why additional |
Because it avoids |
This change will be in the next release of pip? |
Yes it will be part of the next release, there is no ETA at the moment. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It's not really going to be possible to review this PR, it touches basically every file in pip, but mostly to move them and rewrite imports. Functionally what this does is:
pip.*
intopip._internal.*
.pip/
intosrc/pip/
.I was unsure about if this was a good idea or not, but as I implemented it, it has really grown on me. I think the biggest benefits will be: