Reputation: 1412
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?
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
Upvotes: 1
Views: 925
Reputation: 1123400
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.
Upvotes: 2