-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip still prompts for username/password even when keyring is configured #12661
Comments
This fixes pypa#12543 (and probably pypa#12661). Somewhat confusingly, when using using `PIP_KEYRING_PROVIDER=import`, pip was able to fetch both a username and a password from keyring, but when using `PIP_KEYRING_PROVIDER=subprocess`, it needed the username. I opted not to write a new test for this, as the existing [test_prompt_for_keyring_if_needed](https://github.com/pypa/pip/blob/86b8b23c1eaaac5c420a28519daf91de830f1182/tests/functional/test_install_config.py#L392) feels sufficient to me. TODO/need feedback: - I haven't implemented any "feature detection" to see if the `keyring` subprocess supports `--mode=creds`. This feature was added quite recently (jaraco/keyring@7830a64 landed in keyring v25.2.0). It looks like there's an older `getcreds` subcommand which we could probably feature detect as well. I personally would inclined to keep things simple and only support the latest version of the `keyring` cli, but I will gladly implement whatever y'all think is best. - Should I add a news entry about this?
This fixes pypa#12543 (and probably pypa#12661). Somewhat confusingly, when using using `PIP_KEYRING_PROVIDER=import`, pip was able to fetch both a username and a password from keyring, but when using `PIP_KEYRING_PROVIDER=subprocess`, it needed the username. I opted not to write a new test for this, as the existing [test_prompt_for_keyring_if_needed](https://github.com/pypa/pip/blob/86b8b23c1eaaac5c420a28519daf91de830f1182/tests/functional/test_install_config.py#L392) feels sufficient to me. TODO/need feedback: - I haven't implemented any "feature detection" to see if the `keyring` subprocess supports `--mode=creds`. This feature was added quite recently (jaraco/keyring@7830a64 landed in keyring v25.2.0). It looks like there's an older `getcreds` subcommand which we could probably feature detect as well. I personally would inclined to keep things simple and only support the latest version of the `keyring` cli, but I will gladly implement whatever y'all think is best. - Should I add a news entry about this?
This fixes pypa#12543 (and probably pypa#12661). Somewhat confusingly, when using using `PIP_KEYRING_PROVIDER=import`, pip was able to fetch both a username and a password from keyring, but when using `PIP_KEYRING_PROVIDER=subprocess`, it needed the username. I opted not to write a new test for this, as the existing [test_prompt_for_keyring_if_needed](https://github.com/pypa/pip/blob/86b8b23c1eaaac5c420a28519daf91de830f1182/tests/functional/test_install_config.py#L392) feels sufficient to me. TODO/need feedback: - I haven't implemented any "feature detection" to see if the `keyring` subprocess supports `--mode=creds`. This feature was added quite recently (jaraco/keyring@7830a64 landed in keyring v25.2.0). It looks like there's an older `getcreds` subcommand which we could probably feature detect as well. I personally would inclined to keep things simple and only support the latest version of the `keyring` cli, but I will gladly implement whatever y'all think is best.
Edit: nevermind, I was wrong: @Time0o is using
|
The reproducer includes |
This fixes pypa#12543 (and probably pypa#12661). Somewhat confusingly, when using using `PIP_KEYRING_PROVIDER=import`, pip was able to fetch both a username and a password from keyring, but when using `PIP_KEYRING_PROVIDER=subprocess`, it needed the username. I had to rework the existing tests quite a bit to fit with this new behavior, as it's now OK to ask for a username/password for an index even if you don't have a username. This is why `KeyringSubprocessResult` now subclasses `KeyringModuleV2`. While I was in here, I opted to remove the "fixtures" values from `KeyringModuleV2` by introducing this new `add_credential` contextmanager. IMO, they were hurting the readability of our tests: you had to jump around quite a bit to see what the contents of the keyring would be during our tests. It also forced all our tests to play nicely with the same fixtures values, which IMO was an unnecessary constraint. Note: per the discussion [here](pypa#12748 (comment)), I've opted not to implement any "feature detection" to see if the `keyring` subprocess supports `--mode=creds`. For the record, this feature was added in jaraco/keyring@7830a64, which landed in keyring v25.2.0.
Description
I'm trying to download a package from a GitLab registry using credentials stored via keyring. I believe I am following the documentation but pip neither uses the keyring credentials nor displays an error and instead just prompts for username/password.
Expected behavior
pip uses the credentials stored in keyring.
pip version
24.0
Python version
3.10.12
OS
Ubuntu 22.04.4 LTS
How to Reproduce
read_api
rightspip install --keyring-provider import -i https://gitlab.com/api/v4/groups/<MY_GROUP_ID>/-/packages/pypi/simple <MY_PACKAGE>
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: