Skip to content

Be able to use different proxies for different index urls #8232

Open
@stefanoborini

Description

What's the problem this feature will solve?

Possibly this is already known but I could not find an easy solution.
Currently pip does support the use of proxies, but as far as I understand it will only rely on one proxy, and use it for every access. The following scenario would therefore introduce problems:

  • a company has both an internal pypi server for its own internal packages, and uses external access to the official pypi.
  • the company has set up a proxy. All connections to external urls go through the proxy, but all connections to internal ones must not (or you get an error).

Now, when the configuration is done for the browser, this is not a problem, as the automatic setup uses a proxy.pac script that is able to use logic that maps the requested URL to the proxy server to use (or when not to use it). pip however cannot take advantage of this, and if you have the above situation, you can either connect to the local pypi but not the external one (without proxy setup) or only to the external one but not the local one (with proxy setup)

Describe the solution you'd like

pip already supports a --proxy option. The following solutions could be implemented:

  1. extend the grammar of this option to support multiple entries that are mapped to index and extra index, in order.
  2. consider --proxy as the default and to extend the --index-url or --extra-index-url so that both the url and the optional proxy can be passed in some form
  3. add specific proxy options --index-proxy-url and --extra-index-proxy-url. Given that it's possible to specify multiple --extra-index-url entries, proper mapping must be done.

Alternative Solutions

Unsure. It might be that there's a smarter solution that does not involve pip.

Additional context

I am unsure how the proxy setup scenario given above is prevalent out there. I am sure however that at the moment I am experiencing it.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions