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 setup.py
sudo chown -R $USER: .
git clean -xdf
python3 setup.py sdist
twine upload dist/*
Variant if you don’t have python3
:
sudo chown -R $USER: .
git clean -xdf
python setup.py 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 bysudo python3 setup.py
installgit clean -xdf
Remove uncommitted files and other fuzzpython3 setup.py sdist
Build source packagetwine upload dist/*
This will ask you for user PyPI username and password and then upload the package.