Skip to content

Instantly share code, notes, and snippets.

@nicodv
Last active May 9, 2019 19:30
Show Gist options
  • Save nicodv/5bb910d55479f2bc2a0dee0ec1bbdf42 to your computer and use it in GitHub Desktop.
Save nicodv/5bb910d55479f2bc2a0dee0ec1bbdf42 to your computer and use it in GitHub Desktop.
pip package upload checklist

Prerequisites

  • Be inside the relevant virtualenv
  • virtualenv has the latest pip, setuptools, twine and wheel packages installed
  • Be inside the root of the relevant package
  • Have a .pypirc file in ~ (your home folder) that looks like:
    [distutils]
    index-servers = pypi
    [pypi]
    username = myuser
    password = mypassword

Steps

  1. Make code changes and check if your tests are passing locally
  2. Commit and upload to GitHub
  3. Check on GitHub if there are any new Codacy problems*
  4. Fix Codacy problems, and if necessary repeat 2 and 3
  5. Check on GitHub if Travis build succeeds**
  6. Fix Travis problems, and if necessary repeat 2 and 5
  7. If everything looks good, we can bump the version in the __init__.py file and commit this.
  8. Now we create a tag with the new version number: git tag -a 0.1.0 -m "tag 0.1.0"
  9. Push to GitHub, making sure tags are also pushed: git push --follow-tags
  10. Remove old builds from local dist/ directory
  11. Build packages with: python setup.py sdist
  12. Double check if the resulting .tar.gz in /dist contains all the necessary files in the package, and if PKG-INFO looks okay
  13. Build wheel with: python setup.py bdist_wheel --universal
  14. Upload to Pypi with: twine upload dist/*

* Note that I'm using Codacy for keeping track of code quality. You can fill in in your preferred service, or ignore steps 3 and 4.

** Note that I'm using Travies as CI service. You can fill in in your preferred service, or ignore steps 5 and 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment