Skip to content

Rebuild Python package for PyPi and republish

Louis Maddox edited this page Nov 22, 2020 · 12 revisions

After incrementing the package version number in setup.py, run the following to remove old distribution archives, regenerate them, and then reupload them to PyPi:

EGG_INFO=$(find ./ -iname "*.egg-info");
if [ -d "$EGG_INFO" ]; then
    rm -rf "$EGG_INFO";
fi;
rm -rf build/ dist/;
python3 setup.py sdist bdist_wheel;
python3 -m twine upload dist/*

Source: https://packaging.python.org/tutorials/packaging-projects/

Also note:

  • an API token may be generated,
  • ...and that API token may be saved with keyring (another Python module), preventing you from having to re-enter your credentials each time you reupload

Clone this wiki locally