feat: Add --no-proxy-env and support --proxy=""#13051
Conversation
|
Hi everyone - am I missing anything on this PR? Also, I am thinking about logging a message if both |
|
I'm going to put it on the 25.0 milestone so it doesn't get forgotten, but it will be up to a pip maintainer or release manager to review and decide whether it stays on there. I don't have a lot of experience reviewing this type of PR but it looks simple and your note about existing use of |
|
@martinezlc99, I just happened to be investigating this behavior today and it was a pleasant surprise to see this was active just yesterday. Thanks for driving this forward! I did want to ask, wouldn't the ideal behavior be for the Unfortunately, there seems to be buggy behavior in requests that means simple passing on a |
|
@jdlangs I think what this PR has going for it is its simplicity. Generally pip should rely on sourcing behavior from the standard or vendored libraries. I notice that uv has not implemented There is no standard definition of what |
|
Yeah, just using environment variables does seem like the most standard and robust method, but if pip provides a proxy argument, I think being able to configure
The simplest PR would actually be only passing a
Point taken, but is there any tool that treats |
Yeah, I think it's an unfortunate naming collision , maybe |
|
@notatallshaw @jdlangs my initial intent, and my understanding based on the original issue, was to bypass the proxy completely, so the boolean option made sense. But, I agree the I did a quick search to see how other tools handle this situation and found there is not a consensus:
The Chromium Chromium also supports A nice medium may be adding support for Open to thoughts/suggestions. |
But in this implementation you still take the proxy options provided to pip (which I assume can be either CLI or config), so it doesn't bypass the proxy options completely. Which is fine, there is precedence for this in the existing options I don't know how much other CLIs here are that informative as it's not exactly the same behavior. I would prefer to keep it something simple, but preferably a little more accurate, naming is hard, I'd stick to the current name unless something is obviously better. I really don't think pip should be trying to do it's own emulation of big complex tools, e.g. |
|
Thanks @notatallshaw - agree with all your points...forgot this implementation will take the proxy from the CLI as well 😎 So I think the name of the option is the only outstanding item. I like your suggestion of |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
It looks like the discussion here is still ongoing. So I'll postpone this to the next release. |
|
To restart the discussion on this PR, I'm fine with |
|
@notatallshaw it looks like you have been working on this - do you plan to merge it for 25.1? If not, I suggest we just remove the milestone, and it can go in when it's ready. |
|
I agree with @ichard26 , let's change the name. I'll move it to the next milestone, but will try and review if it gets updated quickly. |
|
@notatallshaw - apologies for not tracking this response, been a bit busy. I will update the name ASAP. |
…to option function
ichard26
left a comment
There was a problem hiding this comment.
Having come back to review this again, the main wrinkle with this design is that it's not true all proxy configuration set via environment variables will be ignored. All of pip's options can be set via environment variables. PIP_PROXY=myproxy is equivalent to pip --proxy=myproxy
I don't know common ignoring PIP_PROXY would be, but this flag has the potential to be confusing. Thoughts?
Thanks @ichard26. From my perspective, overriding The renaming of the option name to include environment seems like it would also cover the |
This, because pip's CLI infrastructure treats |
@ichard26 - you are correct. Given this PR allows So as to not restart the discussions from scratch, I propose we clarify the documentation to indicate which environmental variables are ignored with this option; however, open to updating to ignore other means of P.S. I had previously set It seems in the timeframe of the initial PR and now, the I mention this only to state the two converse proxy options are consistent now. |
|
This PR is stale. I'd like to see it land at some point, but it is too close to feasibly land ahead of the 25.2 deadline. Removing it from the milestone. |
|
As this PR is stale I'm removing from the 25.3 milestone, I will try and take time to review before 25.3 if OP or someone else wants to fix this up in the next few weeks. |
|
Coming back to this PR! I think it's still good, I made merged in main and made some small tweaks (hope you don't mind), and I think it's ready to merge, I've added it to the milestone. I'll do one more review pass and if everything is good approve it, and then leave it for a few days for any other maintainers to object before merging. |
|
This seems fine, but I've just realized rereading the earlier discussion that this feature can be achieved via pip/src/pip/_internal/cli/index_command.py Lines 124 to 131 in 639f233 to be gated on requests handle a blank proxy just fine and we'll set |
|
@ichard26 I am fine with fixing |
Ah ok, then it makes sense to add a new flag. 👍 |
ichard26
left a comment
There was a problem hiding this comment.
Thanks a ton @martinezlc99 and @notatallshaw for pushing this over the line!
(I pushed a commit to reorganise the newly added tests. The build_env proxy unit tests don't belong in test_build_constraints.py and the other tests were moved to their own class since they have a custom session constructor.)
Fixes #5378.
This PR was originally done in #12011, which I cancelled due to age and associated pain of rebasing.
Originally this PR stalled in addressing #12011 (comment), but since then I have noticed the
--proxy=PROXYoption also setssession.trust_env = Falseas well, so the behavior is consistent.