Skip to content
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

No documentation on using keyring? #277

Closed
hynek opened this issue Oct 23, 2017 · 6 comments
Closed

No documentation on using keyring? #277

hynek opened this issue Oct 23, 2017 · 6 comments

Comments

@hynek
Copy link

hynek commented Oct 23, 2017

TIL from @glyph's blog post that twine supports the keyring module for storing PyPI creds, yay!

But there doesn’t seem any documentation at all, how to use it? There’s a changelog entry and there's setup.py that gives you the hint there might be more. However I wasn’t able to find any other docs.

I’m gonna update my PyPI blog post but you should really add some docs so people stop storing their password in plain ini files if the feature’s there!

@sigmavirus24
Copy link
Member

I'd be happy to accept a pull request documenting this. The fact of the matter is that I don't know how to use it. I didn't add the feature so I have no clue how to tell others to use it. I have similar password-manager based ways of doing what @glyph suggests.

@hynek
Copy link
Author

hynek commented Oct 27, 2017

Seems like the only documentation is the README? Since twine's original purpose was security, it may make sense to at least outline both approaches there?

@di
Copy link
Member

di commented Oct 27, 2017

You can set your password via:

import keyring
keyring.set_password("https://pypi.org/legacy/", username, password)

But arguably this isn't worth the effort, since the default access control granted by keyring is that any other Python application may access it (via keyring.get_password) and there doesn't seem to be a way to scope this just to twine (but perhaps I'm missing something).

@brainwane
Copy link
Contributor

Within the terminal you can, per #208 (comment), pip install keyring in your virtualenv and then:

With keyring installed, keyring set <URL> <username> where URL is the PyPI upload URL and username is the username in pypirc. That will prompt for the password and save it to the keyring.

I haven't yet been able to successfully get this to work -- I'm getting the RuntimeError: No recommended backend was available. Install the keyrings.alt package if you want to use the non-recommended backends. See README.rst for details. problem that implies I need to do Linux-specific things to get it to work.

But I figure this info should indeed go into the twine README, into some kind of command-line help within Twine, and into the packaging guide, per pypa/packaging.python.org#297.

@brainwane
Copy link
Contributor

I got keyring to work locally. :)

I'm working towards getting Twine 1.10.1 out in the next few days and would strongly welcome doc improvements related to keyring to get into that release!

brainwane pushed a commit that referenced this issue Mar 18, 2018
Add instructions on how to use keyring

Fixes #277.
@brainwane
Copy link
Contributor

Thank you @jonparrott for collaborating with me on IRC just now and adding these instructions! I anticipate this'll be part of the Twine 1.11.0 release tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants