Publishing Python Packages to PyPI

2021-07-15

Overview

How to build and publish sliderule-python for PyPI.

Steps

The sliderule PyPI package is located at https://pypi.org/project/sliderule/.

1. Clear Out Existing Outputs

Run the ./clean.sh script in the base directory of the sliderule-python repository to remove all existing outputs. Later steps may inadvertently use them.

2. Build Binary Distribution

Run python setup.py bdist in the base directory of the sliderule-python repository. This uses git describe to grab the version of the package it builds.

3. Upload to PyPI

First, make sure you have twine installed. If not, then from the desired Python environment, run pip install twine.

Then, run twine upload dist/* from the same location you ran setup.py.

This will upload the versioned package to PyPI. NOTE: if the version already exists, then the upload will fail. So make sure this is only performed on releases.