-
Notifications
You must be signed in to change notification settings - Fork 134
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
Look for PyPI tokens in keyring when uploading #649
Conversation
I'm going to try this branch the next time I have a package to upload, before I merge it. |
61307b6
to
364209e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should try that as well next time to make sure it works on MacOS
flit/upload.py
Outdated
url: str | ||
username: Optional[str] = None | ||
password: Optional[str] = None | ||
is_warehouse: bool = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to update that naming to is_legacy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_pypi
might be a better name now - it's distinguishing PyPI (the new site, aka Warehouse) from other servers like devpi, and originally from PyPI classic.
It's only used for the 'Package is at' log message, so it's not too important that it's always right.
I forgot about this for a long while, and then for a while longer I didn't upload any packages through Flit. Now I just have again, and putting a token in my keyring with username |
The username for keyring should look like
pypi_token:project:<project_name>
(using the normalised name), orpypi_token:user:<username>
. If neither are found, it falls back to looking for a password (but if you have 2FA enabled on PyPI, uploads have to use tokens now).I'd like to make some more tooling for conveniently creating tokens, but there isn't a PyPI API for it yet.
While I'm looking at this code, I've also simplified things a bit so that
FLIT_USERNAME
andFLIT_PASSWORD
environment variables override details in.pypirc
even if you use--repository
, and it figures out the repository details before building the packages.