Authenticate PyPI uploads with API tokens - #227
Merged
Merged
Conversation
Both deploy workflows sent PYPI_USERNAME/PYPI_PASSWORD, but (Test)PyPI removed password-based uploads, so twine got a bare 403 Forbidden after a successful build and upload transfer. Switch to the only supported scheme: the literal user '__token__' with an API token as the password. Test PyPI and PyPI are separate services with separate accounts, so they need separate token secrets rather than the one shared credential pair used before.
This was referenced Aug 22, 2026
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
0.2.1testpypi upload built and transferred the 16.1 MB wheel fine, then died onHTTPError: 403 Forbidden from https://test.pypi.org/legacy/.Cause: both deploy workflows authenticate with
TWINE_USERNAME/TWINE_PASSWORDset from thePYPI_USERNAME/PYPI_PASSWORDsecrets. PyPI and Test PyPI have since removed password-based uploads entirely — API tokens are the only accepted credential. The 403 is the server rejecting the scheme, not the package.This switches both workflows to the supported form (the same one
torchquaduses): the literal user__token__with an API token as the password. Test PyPI and PyPI are separate services with separate accounts, so they get separate token secrets instead of the single shared pair.deploy_to_test_pypi.yml->secrets.TEST_PYPI_TOKENdeploy_to_pypi.yml->secrets.PYPI_TOKENRelated to #224
Important
This needs two new repository secrets before either workflow can upload:
TEST_PYPI_TOKENpaseos(or account-wide for the first upload)PYPI_TOKENpaseosPaste the token including its
pypi-prefix. The oldPYPI_USERNAME/PYPI_PASSWORDsecrets are unused after this and can be deleted.Test plan
TEST_PYPI_TOKENandPYPI_TOKENrepository secretsreleaseand confirm it uploadspaseos 0.2.1pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple paseos