Release new version of Python lib to PyPI

November 27, 2021 ยท View on GitHub

  1. Generate changefile from git log
git log --pretty=format:"- %s%n%b" --since="$(git show -s --format=%ad `git rev-list --tags --max-count=1`)" | pbcopy
  1. Edit the changelog

  2. Bump version

  3. Commit

  4. Push to PyPi configure twine to upload to pypi and testpypi

git clean -dfX
tox -e build

# push to testPyPi
python3 -m twine upload --repository testpypi dist/*

# check if it works
python3 -m pip install --index-url https://test.pypi.org/simple/ gspread

# push to PyPi
python3 -m twine upload --repository pypi dist/*
  1. Tag in Git and push to remote
export RELEASE_NUM=`sed -En "s/__version__ = '([^']+)'/\1/p" gspread/__init__.py`
git tag v$RELEASE_NUM -m "Tagging release v$RELEASE_NUM"
git push --tags
  1. Go to https://github.com/burnash/gspread/releases

  2. Select 'Draft new release'

  3. Choose the latest tag

  4. put title: 'Release vX.Y.Z

  5. copy notes from HISTORY.rst file

  6. paste it in release description

  7. Hit "Publish release"

  8. Rebuild docs: https://readthedocs.org/projects/gspread/