Home > Software design >  How to upload Python Package to PyPi from Azure Pipeline
How to upload Python Package to PyPi from Azure Pipeline

Time:05-27

I have been able to setup an Azure pipeline that publishes a python package to our internal Azure Feed. Now I am trying to have it publish directly to PyPi. This is what I have done already:

  1. I have setup a PyPi "Service Connection" in the Azure Project with the following configuration

    • Authentication Method = Username and Password

    • Python Repository Url for upload = https://upload.pypi.org/legacy

    • EndpointName: I wasnt too sure about this but I set it as the package name on PyPi

And I named this Service Connection PyPi.

In the pipeline I will run the following authentication task:

- task: TwineAuthenticate@1
  inputs:
    pythonUploadServiceConnection: 'PyPi'

Then I build the wheel for publishing.

Whenever I try to publish to the internal Azure feed it works, but when I try to upload that same package to pypi it gets stuck on this:

Uploading distributions to https://upload.pypi.org/legacy/

Are there any clear issues anyone can see that can have it get stuck trying to upload to pypi?

CodePudding user response:

Twine authenticate probably isn't actually providing credentials to the twine upload command, so it's hanging waiting for user input. Try adding --non-interactive to your twine command like this twine upload --non-interactive dist/*. It will probably end up showing an error.

  • Related