Search code examples
pythonpippypi

How can I create an API token on pypi for a new project?


I am trying to upload a package to PyPI using API tokens. I would like to use a project specific API token instead of an account specific token, as this seems more secure. However, since the project is not created on PyPI yet, there is no project for me to select when I try to create a new API token on the PyPI website.

Since I have activated 2-factor authentication, I get an authentication error when trying to upload with twine.

This is closely related to How to upload package to PyPi with Two Factor enabled?, except that the accepted answers does not address the particular issue of project versus account API tokens. I have also tried browsing through https://pypi.org/help/, but cannot seem to find any information there.

So the question is then, how can I create an API token for a not-yet-created PyPI project?


Solution

  • So the question is then, how can I create an API token for a not-yet-created PyPI project?

    You cannot, for sure! Create and use a token for the account; later you can replace it with a project token.