Creating PyPI Release#

Prepare your system#

Install package requirements

dnf install python-setuptools python-wheel

Store PyPI credentials in ~/.pypirc

[distutils]
index-servers =
    pypi

[pypi]
username: <username>
password: <password>

Build and upload release to PyPI#

Create the release with the following commands:

$ cd base/common/python
$ python setup.py release

To inspect the files before they are uploaded, do:

$ cd base/common/python
$ python setup.py packages
$ ls dist/

The packages and release aliases are defined in setup.cfg. It creates a source distribution and universal wheel. Then it registers a new version of the package and uploads both files to PyPI. A file can only uploaded once. PyPI refused to replace a file.

setup.py gets the version and release from specs/pki-core.spec. The Python script rewrites itself to include the version number in setup.py and to make the source distribution work without specs/pki-core.spec. Please revert changes to setup.py afterwards.

References#