From 7bb5605c42fd43eb4dbc7251e5d303daf14fbb84 Mon Sep 17 00:00:00 2001 From: Dos Moonen Date: Sat, 9 Apr 2022 21:31:59 +0200 Subject: [PATCH] Added a news entry and some documentation about `--force-keyring` --- docs/html/topics/authentication.md | 19 +++++++++++++++++++ news/11020.feature.rst | 1 + 2 files changed, 20 insertions(+) create mode 100644 news/11020.feature.rst diff --git a/docs/html/topics/authentication.md b/docs/html/topics/authentication.md index 981aab5abd7..7381af73a98 100644 --- a/docs/html/topics/authentication.md +++ b/docs/html/topics/authentication.md @@ -74,6 +74,25 @@ $ echo "your-password" | keyring set pypi.company.com your-username $ pip install your-package --index-url https://pypi.company.com/ ``` +Pip is conservative and does not query keyring at all when `--no-input` is used +because the keyring might require user interaction such as prompting the user +on the console. You can force keyring usage by passing `--force-keyring` or one +of the following: + +```bash +# possibly with --user, --global or --site +$ pip config set global.force-keyring true +# or +$ export PIP_FORCE_KEYRING=1 +``` + +```{warning} +Be careful when doing this since it could cause tools such as Pipx and Pipenv +to appear to hang. They show their own progress indicator while hiding output +from the subprocess in which they run Pip. You won't know whether the keyring +backend is waiting the user input or not in such situations. +``` + Note that `keyring` (the Python package) needs to be installed separately from pip. This can create a bootstrapping issue if you need the credentials stored in the keyring to download and install keyring. diff --git a/news/11020.feature.rst b/news/11020.feature.rst new file mode 100644 index 00000000000..bbf7190ae84 --- /dev/null +++ b/news/11020.feature.rst @@ -0,0 +1 @@ +Add ``--force-keyring`` flag which allows ``keyring`` lookups in combination with ``--no-input``. See the Authentication page in the documentation for more info.