These are the steps I take when releasing a version of my Python package to PyPI.
First run your checks/cleaning. I have a post about this here. If any fail, start again.
pytest rm -r .tox; tox # Continue below while this is running
In a new branch (such as
- Update version in
CHANGELOG.md(stable releases only).
README.md, if any.
- Update documentation.
Once the release is uploaded, there’s no way to change the
README.md on PyPI,
or the documentation on Readthedocs, without releasing another version. So take
care with these in stable releases.
Commit, push and merge into main.
git commit -a git push origin head
Pull main, tag the commit and push the tag.
git checkout main git pull git tag x.x.x git push --tags
Create the sdist and upload it.
pip install --upgrade pip setuptools twine python setup.py sdist twine check dist/mypackage-x.x.x.tar.gz twine upload dist/mypackage-x.x.x.tar.gz
Update coverage badge.
pip install --upgrade pytest-cov coveralls pyyaml pytest --cov-branch --cov-report term-missing --cov mypackage tests coveralls
Build readthedocs if there were any documentation changes.
Update related blog posts/Stack Overflow posts.