Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Enable –no-index by default in pip configuration

Is there a way to set --no-index as default behaviour when installing packages with pip (both for Windows and Unix)?

Even though this configuration seems to work…

# /home/myaccount/.config/pip/pip.conf or C:\Users\MyAccount\AppData\Roaming\pip\pip.ini
[global]
find-urls = 
    /path/to/folder1
    /path/to/folder2
no-index = true

I’m not able to find a reference of it in pip configuration doc.
Am I doing it right?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

NOTE: I’m working offline and I don’t want to add the extra-burden of a local server repository. I’m just installing offline packages by setting find-urls configuration

>Solution :

Any command-line option can be set using the configuration file, following some simple rules to map the switch to a name in the configuration file.

This is explained in the Naming section of the Configuration chapter:

The names of the settings are derived from the long command line option.

As an example, if you want to use a different package index (--index-url) and set the HTTP timeout (--default-timeout) to 60 seconds, your config file would look like this:

[global]
timeout = 60
index-url = https://download.zope.org/ppix

Since --no-index is a boolean flag switch, the Boolean options section in the same chapter explains how to give such switches a value in the configuration file:

Boolean options like --ignore-installed or --no-dependencies can be set like this:

[install]
ignore-installed = true
no-dependencies = yes

Using no-index = true is exactly how you’d use that setting in a config file. Putting it in the [global] section means it’ll apply to all your pip commands.

Because command-line options map directly to names in the config file using these simple rules, the configuration chapter doesn’t have to cover every single possible config option.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading