Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Some exploration around what would be needed to simplify (through code) the process of releasing python package versions
  • Make sure has all new functionality you want in the release

    • Summarize changes since last release that are missing from Unreleased
  • Pick new version based on semver rules

  • Run unit tests / tox

  • Run flake8

  • Check to ensure

    • There are contents in unreleased
    • The new version number isn't present
  • Verify version is newer than newest version in

    pip install ${PACKAGE_NAME}== 2>&1 | grep "Could not find a version" 
  • Increment version in

  • Update

    • Create new section with the new version number
    • Update links at the bottom to accomodate the new version number
  • Ensure there is no distribution in CWD already

  • Build the distribution

    python3 sdist bdist_wheel --universal
  • Install the newest version of twine (and maybe setuptools?)

  • twine check distribution

    twine check dist/*
  • Upload the distribution to with twine

    echo test | gpg --clearsign --armor # sign something to cache the gpg passphrase
    twine upload -r pypitest -s dist/*
  • Provision virtualenv

    virtualenv --python=python3 /tmp/${PACKAGE_NAME}-${NEW_VERSION}
  • Install -r requirements.txt

    /tmp/${PACKAGE_NAME}-${NEW_VERSION}/bin/pip install -r requirements.txt
  • Install the package from

    /tmp/${PACKAGE_NAME}-${NEW_VERSION}/bin/pip install -i ${PACKAGE_NAME}==${NEW_VERSION}
  • Test

    . "/tmp/${PACKAGE_NAME}-${NEW_VERSION}/bin/activate"
  • Clean up the virtualenv

    rm -rf /tmp/${PACKAGE_NAME}-${NEW_VERSION}/
  • Either

    • Commit the updated and directly to upstream
      • Tag the commit
      • Push the commit and the tag
      • Create a GitHub release for the tag
    • PR the updated and
      • Merge the PR
      • Create a GitHub release which creates a tag
  • Upload distribution to with twine

    twine upload -s dist/*
  • Provision and activate virtualenv

    virtualenv --python=python3 /tmp/${PACKAGE_NAME}-${NEW_VERSION}
  • Install the package

    /tmp/${PACKAGE_NAME}-${NEW_VERSION}/bin/pip install --upgrade ${PACKAGE_NAME}==${NEW_VERSION}
  • Verify the version number is correct

  • Test

    . "/tmp/${PACKAGE_NAME}-${NEW_VERSION}/bin/activate"
  • Delete dist build etc

  • Clean up the virtualenv

    rm -rf /tmp/${PACKAGE_NAME}-${NEW_VERSION}/
  • Parseing and dealing with

  • Some of this in GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.