【问题标题】:Error while uploading python package with Azure Pipelines使用 Azure Pipelines 上传 python 包时出错
【发布时间】:2021-09-14 05:28:16
【问题描述】:

我正在尝试使用 Azure Pipelines 构建包并将其提交到 Azure Artifacts 源。天蓝色管道文件:

- script: |
    pip install wheel
    pip install twine
  displayName: 'Install wheel and twine'

- script: |
    python setup.py bdist_wheel
  displayName: 'Build package'
    
- task: TwineAuthenticate@1
  displayName: 'Twine Authenticate'
  inputs:
    artifactFeed: 'PythonPackages'

- script: |
    cat $(PYPIRC_PATH)
    python -m twine upload -r PythonPackages --verbose --config-file $(PYPIRC_PATH) dist/*.whl
  displayName: 'Publish package'

但我收到以下错误:

Uploading nxgeometry-0.1-py3-none-any.whl

  0%|          | 0.00/3.90k [00:00<?, ?B/s]
100%|██████████| 3.90k/3.90k [00:00<00:00, 4.12kB/s]
Content received from server:
{"$id":"1","innerException":null,"message":"The URL '#' is invalid.","typeName":"Microsoft.VisualStudio.Services.Packaging.Shared.WebApi.Exceptions.InvalidPackageException, Microsoft.VisualStudio.Services.Packaging.Shared.WebApi","typeKey":"InvalidPackageException","errorCode":0,"eventId":3000}
HTTPError: 400 Bad Request from https://pkgs.dev.azure.com/MyOrganization/_packaging/PythonPackages/pypi/upload
Bad Request - The URL '#' is invalid. (DevOps Activity ID: 6E1BE784-A98A-4052-BC7F-B4E4DB7231F0)
##[error]Bash exited with code '1'.
Finishing: Publish package

有什么想法吗?

【问题讨论】:

    标签: python azure azure-devops azure-pipelines


    【解决方案1】:

    在 setup.py 中,将 URL 设置为您尝试从中发布的存储库的 Azure DevOps 链接。该错误一定是由于您的 setup.py 中的 url 与存储库的 url 不同。

    例如

    setup(
        name='omega',
        packages=['omega'],
        description='Omega package for shared functions',
        version='0.1',
        url='https://dev.azure.com/<organization-name>/<project-name>/_git/<repository-name>',
        author='Bond, James Bond',
        author_email='bond@mi6.secret',
        keywords=['pip','omega']
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-25
      • 1970-01-01
      • 2019-11-19
      • 1970-01-01
      • 2022-07-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多