-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Update keyring docs further #5751
Comments
I've recently become interested in using |
Sorry, I see I messed up the command. It should be |
I'm pretty confused by how to get keyring to work, without needing users to either change their path or manually install keyring and my keyring extension in every single repository venv that they work in. It would be good if there were some option to use the global keyring and extensions. |
If the global python is on the path, or more specifically the path where |
The issue is that we don't want to add that folder to the path since it causes issues when we have multiple versions of python on the machine (with pyenv). We find it's better to push people to use python -m module. I think I will try just calling |
Still not really working after manually installing keyring and our extension. This works fine and shows it pulling requests from my authenticated store (AWS code artifact):
But this didn't work right before it, complaining that it couldn't find any available version of
|
Looks like I got it working (with a warning).
|
That warning means (vendored & patched) pip was not able to get credentials and it disabled keyring lookup. Also, since you are using pyenv, does that mean you have people install pipenv for every python version? |
I'll check further, it didn't manage to lock before I told it to use keyring, it did succeed afterwards, but with those warnings. pipx sounds helpful thanks. We do use pyenv. |
I've got a bit further after debugging into pipenv. It seems that there are two types of call made to keyring, one succeeds the other fails, in pipenv.patched.pip._internal.network.auth try:
return self.keyring_provider.get_auth_info(url, username)
except Exception as exc:
logger.warning(
"Keyring is skipped due to an exception: %s",
str(exc),
) The first ones succeed as they pass in the full The ones that fail pass in Any idea if that is by design somehow? I couldn't work out the call stack to really understand where the two different calls come from. For the working call I see: For the failing call I see: |
The lack of username is easier to workaround than the lack of URL path, as we return different credentials for some url paths. |
ok, I know what it is.
# If we don't have a password and keyring is available, use it.
if allow_keyring:
# The index url is more specific than the netloc, so try it first
# fmt: off
kr_auth = (
self._get_keyring_auth(index_url, username) or
self._get_keyring_auth(netloc, username)
)
|
Sorry for the spam, the above is mostly a red herring. I have specified the same repository in both environment variables and Pipfile. I think the issue is just that the username is lost in the second call so it can't then locate the index in the Pipfile. I'll do more digging into why. |
Sorry for the screenshots rather than references in the repo, but below is where the source URL is dropped which then ultimately leads to the warnings. I think the fix would be to pass down the @matteius, I realise this is probably a bug report in itself. I'm off to bed shortly and might not get back to this for a while. But hopefully the fix is fairly simple and just needs another parameter passing through the call stack. |
I've put in a PR #5994 that fixes the warnings for me. Apologies it's a bit of a mess in terms of PR write-up etc. Feel free to amend the PR as needed |
That is the only way Pip, and thus Pipenv, was able to use keyring. This is no longer the only way.
virtualenv --upgrade-embed-wheels
if that is not the case, or look at the output ofvirtualenv --help
if that doesn't cause the version to change.)pip config set --global keyring-provider subprocess
(or use --user if you prefer)oauth2accesstoken
for keyrings.google-artifactregistry-authVssSessionToken
for artifacts-keyringWith the above you configure Pip.
Pipenv then requires the right index urls.
So improving the documentation seems like the better way to go about this.
If you disagree, let me introduce you to virtualenv's seeder concept. My keyring-subprocess package provides a seeder which seeds itself into new virtual environments.
PS. I contributed the
--keyring-provider
flag to Pip, eventually new Python versions ship with a wheel of Pip greater than or equal to 23.1 in theirensurepip
module. Then Python'svenv
module will also create virtual environments with a Pip version >=32.1...Originally posted by @Darsstar in #4706 (comment)
The text was updated successfully, but these errors were encountered: