python poetry 1.0.0 private repo issue fix

On December 12th 2019, poetry v1.0.0 was released. With it, came a bad surprise for me: My CI/CD jobs as well as my Docker image builds started failing.

After investigating, I’ve found out that the password key/value was now missing from the  .config/pypoetry/auth.toml file. Digging some more, I’ve found out that poetry relies on a library called keyring to manage passwords.

Here is what I did to fix the problem.

First, I’ve noticed that poetry falls back to the previous method if keyring returns RuntimeError when it is called. Nice. It turns out that keyring comes with a backend aptly named “fail” which does that whatever the call is. So, it’s only a matter of configuring it.

As the keyring documentation states it, run python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())" to find where to put the configuration file. Then, in that directory, create keyringrc.cfg and put the following content in it:

[backend]                                    
default-keyring=keyring.backends.fail.Keyring

That’s it. Now you can call poetry config http-basic.... the same way you used to and the password will be stored in auth.tomllike before.

Comments

  1. For anyone living in the future:
    I just discovered it’s now .config/python_keyring/ as opposed to .local/share/python_keyring, interestingly.

    After following the steps here, this was the output:

    `Keyring config exists only in the old location /root/.local/share/python_keyring/keyringrc.cfg and should be moved to /root/.config/python_keyring/keyringrc.cfg to work with this version of keyring.`

    When I moved keyringrc.cfg there, I found Poetry in motion 😉

  2. This problem has been a huge headache for me over the last several days, can verify this solution works, thank you for posting!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.