How to upload your Python package to PyPI in 30 seconds

Prerequisite: Install twine:

sudo pip3 install twine

Before the next step, ensure you have no uncommitted files, because those will be deleted!

Also, ensure that your package is ready for release. Ensure that you have the correct version listed in

sudo chown -R $USER: .
git clean -xdf
python3 sdist
twine upload dist/*

Variant if you don’t have python3:

sudo chown -R $USER: .
git clean -xdf
python sdist
twine upload dist/*

For more detailed instructions see this post.

Detailed explanation of the commands:

  • sudo chown -R $USER: . Fix permission issues possibly introduced by sudo python3 install
  • git clean -xdf Remove uncommitted files and other fuzz
  • python3 sdist Build source package
  • twine upload dist/* This will ask you for user PyPI username and password and then upload the package.