Package: PyPI Publisher task (deprecated)

Azure Pipelines

Use this task in a build or release pipeline to create and upload an sdist or wheel to a PyPI-compatible index using Twine.

This task builds an sdist package by running python setup.py sdist using the Python instance in PATH. It can optionally build a universal wheel in addition to the sdist. Then, it will upload the package to a PyPI index using twine. The task will install the wheel and twine packages with python -m pip install --user.

Deprecated

Warning

The PyPI Publisher task has been deprecated. You can now publish PyPI packages using twine authentication and custom scripts.

Demands

None

Prerequisites

A generic service connection for a PyPI index.

Tip

To configure a new generic service connection, go to Settings -> Services -> New service connection -> Generic.

  • Connection Name: A friendly connection name of your choice
  • Server URL: PyPI package server (for example: https://upload.pypi.org/legacy/)
  • User name: username for your PyPI account
  • Password/Token Key: password for your PyPI account

YAML snippet

# PyPI publisher
# Create and upload an sdist or wheel to a PyPI-compatible index using Twine
- task: PyPIPublisher@0
  inputs:
    pypiConnection: 
    packageDirectory: 
    #alsoPublishWheel: false # Optional

Arguments

Argument Description
PyPI connection A generic service connection for connecting to the package index.
Python package directory The directory of the Python package to be created and published, where setup.py is present.
Also publish a wheel Select whether to create and publish a universal wheel package (platform independent) in addition to an sdist package.

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

Q & A

Do I need an agent?

You need at least one agent to run your build or release. Get an agent for Linux, macOS, or Windows.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.