PyPI

This article is only to complement the official documentation here because even though it’s recommended to use testpypi first, the documentation strangely didn’t specify how. So read them first before reading this article.

Create Account

After you create and account and create ~/.pypirc file, you should modify them and includes testpypi site.

[distutils]
index-servers =
  pypi
  testpypi

[pypi]
username = <username>
password = <password>

[testpypi]
repository = https://test.pypi.org/legacy/
username = <username>
password = <password>

It maybe obvious for some people, but I have no idea at all that you should or even could specify index-servers like that.

Note

Is that ini file syntax?

Upload Distributions

Before uploading your package to pypi, let’s test them first in testpypi site.

> twine upload -r testpypi dist\*

The first thing you should inspect is the long description. Even if you use README file from GitHub or GitLab and all seems fine, if the document contains unrecognized options, the whole document will be treated as plain text. In my case I use ..code-block: none, while GitHub or GitLab simply ignore that, PyPI is merciless.

After everything is okay, you can now upload it to pypi.