The Azure Code Samples are currently available in English


This repo contains tested reference examples of using Python with Azure Pipelines.


This sample contains several Azure Pipelines for Python developers that showcase useful end-to-end patterns of varying complexity. All pipelines are in the .azure-pipelines folder and have been fully annotated and validated.

Pipeline results and sample Artifacts for the definitions contained in this repo can be viewed at the following Azure DevOps organization: az-samples


simple_package is a pure Python package with no external dependencies. It exists to give just-enough structure to show how to use Azure Pipelines with Python.


Build a simple package against a single Python version


  • Building for a project contained in a repo subfolder (separate src/tests folders)
  • Choosing a Python version
  • Installing build dependencies
  • Linting (pylint and flake8)
  • Running tests (pytest)
  • Building a source archive and built distribution
  • Capturing build artifacts


Build a simple package against multiple Python versions


  • Building for multiple Python versions
  • Capturing multiple artifacts per build


Build a simple package against multiple Python versions, then upload it to Azure Artifacts (private PyPI)


  • Setting job dependency order
  • Conditionally running pipeline jobs
  • Disabling code checkout to control the pipeline environment
  • Downloading previously uploaded build artifacts
  • Authenticating to Azure Artifacts
  • Publishing to a private Artifacts feed


simple_server is a minimal Flask application that takes a dependency on simple_package from the Azure Artifacts feed. It can be run as a standalone Python application, or can be built as a Docker container image.


Build a Python application that has a dependency on a package sourced from Azure Artifacts


  • Authenticating to Azure Artifacts for pip
  • Installing private dependencies
  • Distinguish between Python versions in pytest output


Build a Docker image using an application that pulls dependencies from Azure Artifacts


  • Customizing the build artifact download path
  • Building a containerized Python app with Azure Artifacts
  • Using multi-stage builds with pip


This project has been configured for Python development with VS Code using the following extensions: - Python - Azure Pipelines - Docker

To get started, clone the repo, and run the following commands to get started with a new environment

# Clone the repo
git clone
cd azure-pipelines-python

# Create a virtual environment at .venv
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r -U --upgrade-strategy eager

# Install packages in editable mode
python -m pip install -e src/simple_package
python -m pip install -e src/simple_server

# Start coding! :)
code .