-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add a new *public* main() method #5149
Conversation
I don't understand this statement. We do support
There is another class of breakages, anything that attempted to monkeypatch pip prior to calling That being said, I'm not opposed to this (though I'm not sure I'm for it either). I would prefer this to just be defined in |
Sorry, my phrasing was poor. Of course the reality is more subtle. However, barring consideration for the prior meaning of
That's a fair concern, but I find this confusing when I look at the highly contentious thread, #5081. Refusing to add Recognizing that the vast majority of users of I'm happy to move it into |
This is mostly compatible with the prior use of `pip.main()` but not exactly identical. If the recommended mode of use for invoking `pip` programmatically is to call `sys.executable` with `-m pip`, then that mode of use *must* be supported by `pip`. `subprocess.check_output(...)` behaves very similarly, but of course not identically, to `pip.main(...)` on pip<9.0.2 This is therefore a mostly compatible interface which alleviates some transitional hurdles for those using virtualenv or other 3rd party packages which depend upon `pip.main`. The only packages which will remain broken are those which use `pip.main` from an environment in which subprocess cannot be spawned. The new public `pip.main` is very clearly declared as the *only* public python API for pip and is noted as having been added for better backwards compatibility with known (but not supported) usage.
8b72454
to
9b10a2e
Compare
Relavant here: #5080 |
I feel we should expose a And then 2 major version bumps later, make it go away for good. |
If someone had proposed this back when we first announced that we were reorganising the internal APIs in pip 10, it might have had some merit, and I'd likely have supported it. But it's now too late for this to land in pip 10, so we're left with a situation where anyone using I'm -1 on @pradyunsg's suggestion that we add it just to deprecate it again. The fact that it won't be in pip 10 makes that pointless IMO. |
I disagree, I think this has value even in 10.1. Maybe not surprising, as I'm the person suggesting adding it back in. For anyone running Dropping it in v11 or later would be fine as far as I am concerned/this opinion runs.
further enhances the value here. |
But I'm assuming we're talking here about people with apps that depend on pip (to be clear, this is unsupported, but we're trying to provide a smoother transition for them). For those people, what will they do? Say their app supports pip <10 and pip 10.1-10.9 but not pip 10.0 or pip 11? What will their explanation be for not supporting pip 10? That there's a "bug" in that version? I'm really not in favour of any solution which allows people to claim that pip 10 is "buggy", so "fixing" that bug in 10.1 gives totally the wrong impression IMO. It's not as if changing your code to call |
fro mmy pov this one is worse, since it makes code thats potentially half-working, as in the bits that call main will magically keep working while others break hard, its better to break things whole than to leave a minefield |
Anyone who's going to complain about pip 10.0 and 9.0.2 is going to complain about 9.0.2 and 10+ To me, #5081 demonstrates that people have already made up their minds to be angry about pip "breaking" in a point release, and to continue being angry that the "breakage" persists into 10.x
Yes, this whole measure is just a courtesy. If we're concerned with public perception of pip, taking some measures to at least cope with those real and extant packages which use
Yes, and this is a strong argument in favor of having a warning and marking this as deprecated (rather than, as initially proposed, a new and publicly supported feature). This could even be added as officially unsupported with the warning, and removing it after some shorter deprecation cycle than waiting for pip 11. It can be added in 10.1 and removed in 10.2, so long as those are spaced out enough to let people who were doing it wrong get a warning and upgrade to the right thing. Even the extreme version of this, in which RuntimeError(
"pip.main() is unsupported and should not be used. "
"If you want to invoke pip from within your program, see the documentation "
"here: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program\n"
"You may also find that pip<10 works for this purpose, but the pip maintainers "
"cannot and do not support such usage.") |
If we add a warning, it's probably gonna show up to an end user which means they might go ahead and report it somewhere. If we don't add anything, their code breaks and they get a little annoyed and report it somewhere and pin it down to a lower version of pip. Both of these are acceptable to me. Paul's right, pip 10.0 betas are out and we should not make non-bugfix changes now... Making this, a discussion for a post pip 10.0 for me. |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
pip 10.0 is out. Thinking a bit about pip 10.1, what @pfmoore says - about people viewing pip 10.0 as buggy - resonates with my thoughts on this now. I'm a -1 on this change as is - it's subtly different when it breaks things + this wasn't supported in the first place. The fix/workaround/whatever-you-call-it of replacing with a subprocess call is likely less painful overall than this change. As for introducing a pip.main with a |
Closing in favor of #5254. |
@pradyunsg Since the |
@labrys this simply isn't going to happen. It's all been discussed multiple times, and re-opening the discussion won't change the result, it will simply annoy people. Please let this drop. |
This is mostly compatible with the prior use of
pip.main()
but not exactly identical.If the recommended mode of use for invoking
pip
programmatically is to callsys.executable
with-m pip
, then that mode of use must be supported bypip
.subprocess.check_output(...)
behaves very similarly, but of course not identically, topip.main(...)
on pip<9.0.2This is therefore a mostly compatible interface which alleviates some transitional hurdles for those using virtualenv or other 3rd party packages which depend upon
pip.main
.The only packages which will remain broken are those which use
pip.main
from an environment in which subprocess cannot be spawned.The new public
pip.main
is very clearly declared as the only public python API for pip and is noted as having been added for better backwards compatibility with known (but not supported) usage.I'm well aware of the existing threads on this subject, and of a very similar, but rejected, PR ( #4798 ).
To me, it seems silly to say that
pip
will support invocation in this manner, but then very explicitly not provide the very small and very broadly compatible patch to make the lives of numerous pip consumers much easier.