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 "block index" package index option

See original GitHub issue

What’s the problem this feature will solve?

Often companies have privately hosted indexes that contain shared python libraries. If the index is set in the computers pip.conf, pip install checks that index. As it currently stands, the best way to test install behaviour with that index blocked is to remove the index from pip.conf

Describe the solution you’d like

It would be nice to have a command line method to block specific indexes

pip install mypackage --block-index-url http://pypi.company.com/simple

Alternative Solutions

--no-index would block the index but other indexes should still be available for testing

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
chrahuntcommented, Feb 13, 2020

I wonder if it’d be possible to do something like

pip install --no-index -i https://pypi.org/simple --extra-index-url https://custom.index.example/simple

where --no-index resets the index list, and subsequent options add more just for this command.

In this proposal, is it not resetting --index-url and --extra-index-url because they are after --no-index on the command line or because they are provided as command-line arguments and the other indexes that get overridden are in a config file which has lower precedence? Either way deviates from the way we currently handle other arguments.

For the use case of testing install behavior I think it would make more sense to specify an explicit configuration file with PIP_CONFIG_FILE that has the index URLs you want (or not). In general we try to avoid adding additional configuration/arguments (see #6221), so an approach that avoids it is preferred.

If I understand correctly (big if), the user (person, CI, …) could try install patterns by programmatically setting up an env and parsing the PIP_CONFIG_FILE to feed the -i or --extra-index-url args

On a computer with an index in pip.conf, any program like so (unless they altered the pip.conf file, yuck) would not fix the problem in this issue

What I am saying is that if you want to test installation of your package and you do not want pip to use an index URL that may be configured in a system pip.conf, then create a config file with index-url set to whatever you want to test (or nothing) and then set PIP_CONFIG_FILE to the path to that file. Then pip will not read the system-level pip.conf.

0reactions
chrahuntcommented, Mar 4, 2020

I think that my comment above helps provide a workable approach for testing. Taking into account that this is something users are not likely to run into, the general desire to limit the number of CLI options in pip, and that we now have an explicit issue (this one) that people can find if they are in a similar situation, I will close this. The more general proposal at #4263 may be good to look at for anyone interested in improving this area of pip.

Thank you @mbardwell for this proposal and for your prototype.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Index blocks | Elasticsearch Guide [8.5] | Elastic
By default, you must explicitly name the indices you are adding blocks to. To allow the adding of blocks to indices with _all...
Read more >
pip requirements.txt with alternative index - Stack Overflow
Your answer "Add an extra index location...just before the package/project name" implies a per package option. @Rafael-WO IIRC you can't do it in...
Read more >
Using the DBMS_REPAIR Package - Oracle Help Center
DBMS_REPAIR PL/SQL package. Performs block checking for a specified table, partition, or index. It populates a repair table with results. DB_VERIFY utility.
Read more >
Block Search Indexing with 'noindex' - Google Developers
A noindex tag can block Google from indexing a page so that it won't appear in ... header instructing search engines not to...
Read more >
Advanced Usage of Pipenv - Python Packaging Authority
You may install a package such as the example torch from the named index pytorch ... add install_search_all_sources = true option to your...
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