Based on: https://gist.github.com/audreyr/5990987
-
Update version number in
setup.py. -
Update version number in
package\__init__.py. -
Update
HISTORY.rstwith information on the changes for this version. -
Install latest version in development mode
pip install -e . -
Test
python setup.py test -
Create source distribution and wheels
# clean previous build environment python setup.py clean --all python setup.py sdist python setup.py bdist_wheel -
Test if the sdist installs
mktmpenv cd project/dist pip install project-version.tar.gz # test if package works deactivate -
Commit changes
git add [modified files] git commit -m "Release 0.2.5" -
Upload to PyPI using twine
Create or update
~/.pypirc[distutils] index-servers=pypi [pypi] repository = https://upload.pypi.org/legacy/ username = <username> password = <password>Reference: https://packaging.python.org/distributing/#create-an-account
Then upload packages using twine to an existing PyPI project
twine upload dist/project-version.tar.gz twine upload dist/project-version.whlIf this is a new package, register package on PyPI. The
PKG-INFOfile found underpackage.egg-infocan be uploaded to prepopulate the form fields.Check PyPI listing to make sure the description and changelog/history displays properly. If not, check rst syntax using
python setup.py --long-description | rst2html > output.htmlor
-
Test if package can be installed using
pipmktmpenv pip install package # test if package works deactivate -
Tag the last commit
git tag -a 0.2.5 -
Push changes to Git
git push git push --tags -
Edit the release notes on Github and draft a new release with a title.