From ca8ff553a88a85e7802137a7d42901c26974dced Mon Sep 17 00:00:00 2001 From: Jonathan <33353899+allcloud-jonathan@users.noreply.github.com> Date: Thu, 21 Apr 2022 01:16:48 +0200 Subject: [PATCH] [fix] allow the user to overwrite the `no_input` flag to pip (#5036) Support `no_input` flag for when you want to e.g. use keyring to authenticate against Google Artifact Registry. --- docs/advanced.rst | 32 ++++++++++++++++++++++++++++++++ news/4706.bugfix.rst | 1 + pipenv/utils/resolver.py | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 news/4706.bugfix.rst diff --git a/docs/advanced.rst b/docs/advanced.rst index 4af7424c..cafa190d 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -107,6 +107,38 @@ Environment variables in the URL part of requirement specifiers can also be expa Keep in mind that environment variables are expanded in runtime, leaving the entries in ``Pipfile`` or ``Pipfile.lock`` untouched. This is to avoid the accidental leakage of credentials in the source code. +☤ Injecting credentials through keychain support +------------------------------------------------ + +Private regirstries on Google Cloud, Azure and AWS support dynamic credentials using +the keychain implementation. Due to the way the keychain is structured, it might ask +the user for input. Asking the user for input is disabled. This will disable the keychain +support completely, unfortunately. + +If you want to work with private registries that use the keychain for authentication, you +can disable the "enforcement of no input". + +**Note:** Please be sure that the keychain will really not ask for +input. Otherwise the process will hang forever! + + [[source]] + url = "https://pypi.org/simple" + verify_ssl = true + name = "pypi" + + [[source]] + url = "https://europe-python.pkg.dev/my-project/python/simple" + verify_ssl = true + name = "private-gcp" + + [packages] + flask = "*" + private-test-package = {version = "*", index = "private-gcp"} + + [pipenv] + disable_pip_input = false + +Above example will install ``flask`` and a private package ``private-test-package`` from GCP. ☤ Specifying Basically Anything ------------------------------- diff --git a/news/4706.bugfix.rst b/news/4706.bugfix.rst new file mode 100644 index 00000000..3571a750 --- /dev/null +++ b/news/4706.bugfix.rst @@ -0,0 +1 @@ +allow the user to disable the ``no_input`` flag, so the use of e.g Google Artifact Registry is possible. diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index 480ae066..7020bf1f 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -518,7 +518,7 @@ class Resolver: pip_options, _ = self.pip_command.parser.parse_args(self.pip_args) pip_options.cache_dir = self.project.s.PIPENV_CACHE_DIR pip_options.no_python_version_warning = True - pip_options.no_input = True + pip_options.no_input = self.project.settings.get("disable_pip_input", True) pip_options.progress_bar = "off" pip_options.ignore_requires_python = True pip_options.pre = self.pre or self.project.settings.get(