Pip: [Doc] Contradictory descriptions for `pip config --site`

Created on 23 Jul 2020  ·  4Comments  ·  Source: pypa/pip

Environment

  • pip version: 2.1.1

Description

In pip config, --global means system-wide configuration and --site means environment configuration.

--global
Use the system-wide configuration file only
--site
Use the current environment configuration file only

But in User Guide - Config file, Site-wide means system configuration, such as C:\ProgramData\pip\pip.ini on Windows.

Expected behavior

These 2 documents should have consistent descriptions.

Also, it would be nice to add some examples in pip config to indicate how to correctly specify name ("dot separated section and key", according to the error message), such as

pip config set --site global.timeout 60
good first issue bug docs

Most helpful comment

Hi! I will try to work on this issue today on EuroPython Sprints :)

All 4 comments

I think this logic is adapted from appdirs, but it's confusing on GNU/Linux too:

$ pip debug
global:
  /etc/xdg/pip/pip.conf, exists: False
  /etc/pip.conf, exists: False
site:
  /usr/pip.conf, exists: False
user:
  /home/cnx/.pip/pip.conf, exists: False
  /home/cnx/.config/pip/pip.conf, exists: True

I mean who even puts configurations files in /usr (I think it's supposed to be /usr/share/pip/pip.conf)?

Reading the implementation, it seems that global means system-wide, site means interpreter-wide, and user means per-user.

https://github.com/pypa/pip/blob/89a51a6fefec826256fb334ea6244dfb0b3455a0/src/pip/_internal/configuration.py#L76-L96

So user guide likely needs to be fixed.

Hi! I will try to work on this issue today on EuroPython Sprints :)

I took a look at GH-6268 (and its linked issue), but it doesn't seem that site is for means interpreter-wide configuration. sys.prefix does not point to the directory specific to the interpreter, but {sys.prefix}/*/pythonX.Y. Perhaps where the configuration file that is specific to the interpreter can be stored in {sys.prefix}/share/pythonX.Y, or that we can deprecate this entirely and convert obscure setups to employ PIP_CONFIG_FILE instead.

I understand that this is not exactly within the scope of this issue so I will file a new ticket for this if necessary.

Was this page helpful?
0 / 5 - 0 ratings