python

This are the steps I take when releasing a version of my Python package to PyPI.

Run some checks/cleaning. If any fail, start again. Recommend puttting these into pre-commit hooks.

pylint --disable=all --enable=unused-import **/*.py
mypy --disallow-untyped-defs --strict-optional package
isort -rc package
black **/*.py

Run tests.

pytest
rm -r .tox
tox  # Continue below while this is running

Update version in setup.py
Update supported Python versions in setup.py
Update CHANGELOG.md
Update documentation.

Commit:

git commit
git push
git tag (version)
git push --tags

Create the sdist and upload it:

rm -r dist
pip install -U pip setuptools twine
python setup.py sdist
twine check dist/*
twine upload dist/*

Update coverage badge:

pytest --cov-report term-missing --cov package tests
coveralls  # requires coveralls and pyyaml installed

Build readthedocs if there’s been changes.
Update related blog posts.