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

warehouse: Friendlier token "username", prefix #6342

Merged
merged 10 commits into from Aug 5, 2019

Conversation

woodruffw
Copy link
Member

@woodruffw woodruffw commented Aug 1, 2019

Changes the token username to __token__ and the prefix to pypi-.

Preserves the original @token username and pypi: token prefix for backwards compatibility during the beta.

Closes #6287.

@woodruffw
Copy link
Member Author

cc @di @ewdurbin

Copy link
Member

@ewdurbin ewdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't $ as a username prefix going to cause headaches for some shells?

Aside from that I'd just like to see us file an issue preemptively of merge and reference it for removal of backward compatibility for beta "grammar" of these.

warehouse/macaroons/auth_policy.py Outdated Show resolved Hide resolved
warehouse/macaroons/services.py Show resolved Hide resolved
@woodruffw
Copy link
Member Author

Isn't $ as a username prefix going to cause headaches for some shells?

Yeah, hadn't thought of that. I'll change it to ^; that shouldn't interfere with most things.

Aside from that I'd just like to see us file an issue preemptively of merge and reference it for removal of backward compatibility for beta "grammar" of these.

👍

@woodruffw
Copy link
Member Author

Alright, opened #6345 to track removal.

@pradyunsg
Copy link
Contributor

Caret (^) is an escape character in Windows batch scripts.

https://stackoverflow.com/questions/20342828/what-does-symbol-mean-in-batch-script

Is there a reason that we aren't using the "token" username here?

@woodruffw
Copy link
Member Author

Caret (^) is an escape character in Windows batch scripts.

😞

Maybe 'token or +token?

Is there a reason that we aren't using the "token" username here?

I listed some reasons in this comment: #6345 (comment)

@graingert
Copy link
Contributor

graingert commented Aug 3, 2019

I had a look at the regex used in warehouse for validating usernames and came up with some potentially nicer options:

_token, -token, .token
token_, token-, token.

and my personal favorite, because dunder magic has that feel of "this is a name specifically reserved for a specific use by PyPI"
__token__

@di
Copy link
Member

di commented Aug 3, 2019

FYI, 'token and -token would both require quoting in YAML as well.

@woodruffw
Copy link
Member Author

I like __token__! Will update the PR to reflect it while we continue to discuss.

@ewdurbin
Copy link
Member

ewdurbin commented Aug 5, 2019

Looks good to me, any concerns with the selected prefix or username of __token__ @di @dstufft ?

@ewdurbin ewdurbin merged commit 20436d4 into pypi:master Aug 5, 2019
@woodruffw woodruffw deleted the tob-travis-friendly-tokens branch August 5, 2019 19:55
philpep added a commit to pytest-dev/pytest-testinfra that referenced this pull request Aug 9, 2019
pypi API token is currently beta feature, since
pypi/warehouse#6342 pypi "token user" has changed to
"__token__".
@ZaxR
Copy link

ZaxR commented Aug 18, 2019

Just made the change, and __token__ is working well with Travis, but just an FYI that the hyphen in the token (pypi-xxx...) still needs to be escaped for Travis.

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

Successfully merging this pull request may close these issues.

Change username & API token prefix, to make Travis auth easier
7 participants