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

doc: using keyring with API key #1119

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

doc: using keyring with API key #1119

wants to merge 2 commits into from

Conversation

bukzor
Copy link

@bukzor bukzor commented Jun 21, 2024

Show how to use twine+keyring post 2024-01-01.

This is my attempt to prevent anyone else from being bitten by this change:

auth.py

    def username(self) -> Optional[str]:
        if cast(str, self.config["repository"]).startswith(
            (utils.DEFAULT_REPOSITORY, utils.TEST_REPOSITORY)
        ):
            # As of 2024-01-01, PyPI requires API tokens for uploads, meaning
            # that the username is invariant.
            return "__token__"

Show how to use twine+keyring post 2024-01-01.

This is my attempt to prevent anyone else from being bitten by this change:

`auth.py`
```python
    def username(self) -> Optional[str]:
        if cast(str, self.config["repository"]).startswith(
            (utils.DEFAULT_REPOSITORY, utils.TEST_REPOSITORY)
        ):
            # As of 2024-01-01, PyPI requires API tokens for uploads, meaning
            # that the username is invariant.
            return "__token__"
```
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.

2 participants