代码之家  ›  专栏  ›  技术社区  ›  todofixthis

使用Travis CI将多个发行版部署到PyPI时防止冲突

  •  7
  • todofixthis  · 技术社区  · 7 年前

    我希望Travis CI在新提交时构建并将以下人工制品部署到PyPI master

    • Python 2车轮
    • Python 3车轮

    .travis.yml :

    language: python
    python:
      - '2.7'
      - '3.5'
      - '3.6'
    deploy:
      on:
        branch: master
      provider: pypi
      distribution: bdist_wheel sdist
    

    对于正常的构建/测试,配置工作得很好。然而,它引入了竞争条件 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/
    

    我应该做什么更改 让Travis CI将正确的人工制品部署到PyPI?

    2 回复  |  直到 7 年前
        1
  •  5
  •   user2076663    6 年前

    我今天遇到了这个问题,最终在文档中发现了这个问题:

    deploy:
      provider: pypi
      skip_existing: true
      ...
    

    我使用 skip_existing: true 在一个项目中,即使我测试了几个不同的配置和python版本,也要发布一次源代码和控制盘。方便的更多详细信息 resolved github issue documentation diff .

        2
  •  5
  •   todofixthis    7 年前

    有时我会跳出框框思考;其他时候它只是一个很大的盒子。

    之前,这个项目需要Python 2和Python 3单独的轮子,所以我需要Travis CI使用不同版本的Python构建轮子。

    我修改了 .travis.yml everything is working great :

    deploy:
      on:
        branch: master
        python: '3.6'