I'd like Travis CI to build and deploy the following artefacts to PyPI whenever a new commit hits the master branch:
To make this happen, I've added the following to .travis.yml:
language: python
python:
  - '2.7'
  - '3.5'
  - '3.6'
deploy:
  on:
    branch: master
  provider: pypi
  distribution: bdist_wheel sdist
For normal build/test, the configuration works great. However, it introduces a race condition when deploying to PyPI:
Uploading distributions to https://upload.pypi.org/legacy/
Uploading PyOTA-2.0.0b1.tar.gz
HTTPError: 400 Client Error: File already exists. for url: https://upload.pypi.org/legacy/
What changes should I make to .travis.yml to get Travis CI to deploy the correct artefacts to PyPI?
I ran into this problem today and eventually found this under-documented gem:
deploy:
  provider: pypi
  skip_existing: true
  ...
I use skip_existing: true on a project to get source and wheels published once even though I test across a couple of different configurations and python versions. Handy. More details in this resolved github issue. I also submitted a documentation diff.
Some days I think outside the box; other days it's just a really big box.
Previously, this project needed separate wheels for Python 2 and Python 3, so I needed Travis CI to build wheels using different versions of Python.
But recently I got the project to build universal wheels correctly, so now Travis can build all of the deployment artefacts using any one version of Python.
I modified .travis.yml accordingly, and everything is working great:
deploy:
  on:
    branch: master
    python: '3.6'
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With