question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support to pass --extra-index-url parameter to use both global and hosted PyPI servers

See original GitHub issue

How would this feature be useful?

When internal users of the corporate hosted PyPI need to install a package hosted on the company’s PyPI, they have to have a file with the contents

$ cat ~/.pip/pip.conf
[global]
index-url = https://user:pwd@server.cloud/api/pypi/pypi/simple
extra-index-url = https://pypi.python.org/simple

This file makes it possible to install a package with the pipx install package-name command (the package is hosted on the company’s PyPI but its dependencies are not - they should be taken from the https://pypi.python.org/simple).

However, I am looking for a way to to supply the option to pass the internal PyPI url (either with the pre-filled user:pwd pair or to be prompted to enter user/password) - so that the package of interest is taken from the hosted PyPI but if its dependencies are not found in the internal PyPI, fall back to the global one.

This would remove the need to deploy the configuration files (storing login details / tokens in plain text). The pip does not need any configuration files for this scenario - pip install package-name --extra-index-url https://user:pwd@server.cloud/api/pypi/pypi/simple works fine.

Describe the solution you’d like

Maybe it is already possible to pass this to the pip-args argument, but I haven’t been able to find a way to do this as supplying named arguments does not seem to be supported.

Describe alternatives you’ve considered

Storing a file ~/.pip/pip.conf with the urls to the PyPI servers.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
cs01commented, Aug 1, 2020

pipx does support passing arbitrary arguments to pip. This should work:

pipx install package-name --pip-args='--index-url https://user:pwd@server.cloud/api/pypi/pypi/simple --extra-index-url https://pypi.org/simple'
1reaction
uranusjrcommented, Jul 31, 2020

Would it be acceptable to use environment variables? All pip options can be set that way, see https://pip.pypa.io/en/stable/user_guide/#environment-variables

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can pip.conf specify two index-url at the same time?
Official PyPI now supports HTTPS so you can specify https://pypi.org/simple/ for extra-index-url and avoid specifying pypi.org in trusted-host.
Read more >
"sam build" feedback: Support private PyPi repositories #794
Description: Some companies host their own internal Pypi servers. ... sam build needs to support passing extra options to PIP in this case....
Read more >
How to Use an Alternate PyPI (Package Index) - mothergeo
Use the extra-index-url option to tell pip where your alternate package index lives. If your package index doesn't support SSL, you can supress...
Read more >
Using TestPyPI - Python Packaging User Guide
Using TestPyPI ¶. TestPyPI is a separate instance of the Python Package Index (PyPI) that allows you to try out the distribution tools...
Read more >
User Guide - pip documentation v22.3.1
When installing packages from PyPI, pip requires internet access, which in many corporate environments requires an outbound HTTP proxy server.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found