-
Notifications
You must be signed in to change notification settings - Fork 7
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 (see here)
- ...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
The twine docs explain how to do that
here,
just run:
keyring set https://upload.pypi.org/legacy/ __token__and then paste in the API token and you'll save it to your [Python] keyring,
and when you run python3 -m twine upload dist/* it'll automatically resolve
to that repository URL and since that matches the keyring with username
__token__ it won't ask for your credentials and just upload immediately.