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

--proxy should override environment variables #10685

Closed
1 task done
meiswjn opened this issue Nov 26, 2021 · 2 comments · Fixed by #11091
Closed
1 task done

--proxy should override environment variables #10685

meiswjn opened this issue Nov 26, 2021 · 2 comments · Fixed by #11091
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@meiswjn
Copy link

meiswjn commented Nov 26, 2021

Description

Hey,

When specifying proxies in both the environment variables (http_proxy, ...) and the --proxy parameter, the environment variables seem to take precedence.
Since --proxy is more explicit, it should be used whenever specified (even over pip config).

While it is possible to temporarily change the environment variables, it is much more work:

export http_proxy="<alternate_proxy>"
export https_proxy="<alternate_proxy>"
pip install -r requirements.txt
export http_proxy="<original_proxy>"
export https_proxy="<original_proxy>"

vs.

pip --proxy=<alternate_proxy> -r requirements.txt

Expected behavior

No response

pip version

20.0.2

Python version

3.8

OS

Ubuntu

How to Reproduce

  1. Define environment variables HTTP_PROXY, HTTPS_PROXY, http_proxy, https_proxy
  2. Install a package with --proxy= and specify a different proxy

Output

No response

Code of Conduct

@meiswjn meiswjn added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Nov 26, 2021
@uranusjr
Copy link
Member

I think I agree. I don’t use proxies (like ever…), but it makes sense for an argument to have higher precedence over environment variables of the same functionality. Would you be interested in sending in a pull request?

@meiswjn
Copy link
Author

meiswjn commented Nov 29, 2021

Sure, done. Let me know if changes are required.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants