Search code examples
python-3.xazurebuildpipazure-artifacts

How to consume/pip install a custom Python package artifact in another build pipeline in Azure Devops?


So I have build a custom Python package which has the end-purpose of serving as a shared Python library across multiple Azure repositories. This package is available as an Azure Devops artifact.

However, I can not find a way in which I can connect to the feed when building the repositories, which is of course needed to pip install the package as to make the library available to the repository that is being built.

I do get the package installed locally by adding a pip.conf with the right credentials to one of my local virtual environments. I would think that adding this pip.conf file to my Python github repositories and then pip installing the package during the build would work.

However, when I install locally I have to login to azure via browser to authenticate, which is of course not possible from within a build pipeline.

I cannot find any way to achieve what I'm trying to achieve in the Azure docs. Is there any way to make this work? Or else, is there a better way to set up a shared python library in Azure Devops?


Solution

  • How to consume/pip install a custom Python package artifact in another build pipeline in Azure Devops?

    There is a task Python pip authenticate, which provides authentication for the pip client that can be used to install Python distributions:

    enter image description here

    Then we just need to create a Service connections to connect the feed:

    enter image description here

    enter image description here