Package: PyPI Publisher task (deprecated)

Azure DevOps Services

Use this task 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.

FAQ

Do I need an agent?

You need at least one agent to run your build or release.

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.

My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?

This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.