Andy McKay

May 08, 2015

Building Python packages from Travis


If you've got a Python package that you push to pypi and you run your tests on Travis then I strongly recommend that you set up uploading your Python packages to pypi using Travis. There's a few reasons for this:

  • builds are clean and do not contain any artifacts that might be present on your local system
  • anyone with commit access to the repository can do a release by tagging and not just the owner on pypi (really useful at Mozilla)
  • the step is automated and that's a win

Follow this documentation. Basically, alter travis.yml:

deploy:
  provider: pypi
  user: marketplacedevsinternal
  on:
    all_branches: true
    tags: true

Then run:

travis encrypt --add deploy.password.

Job done. This also works for npm and a pile of other stuff.