Skip to main content

Set of pragmatic tools to automate working with Azure Devops

Project description

Azure DevOps Practical Tools

Python Development Status PyPI version License

GitHub CI

uv ruff pre-commit pytest


To Augustin, a PM with an imperturbable annoyance for all things Azure DevOps.. Without your daily complaints, this project would not exist.



Azure DevOps Practical Tools is a set of tools to automate working with Azure Devops. The tools are developed as a CLI tool adopt to easily manage your Azure Devops project. The tool is actively being developed and tools are continuously being added. Suggestions for new tools are always welcome and can be requested via the GitHub issues or, even better, by contributing to the project.

Installation

The preferred way to install adopt to use as a global CLI tool is to install it via uv and run it via uvx, the pipx variant for the uv package manager.

If you don't have uv and uvx installed yet, you can install it by running:

winget install --id=astral-sh.uv

or by following the instructions on the uv website.

After installing uv, you can install adopt as a uv tool by running:

uv tool install adopt@latest

and then run the tool by running:

uvx adopt

Alternatively, you can install adopt as a CLI tool using pip or globally using pipx:

python -m pip install adopt

Or install it as a global CLI tool using pipx:

pipx install adopt

Getting Started

Adopt is developed as a CLI tool to easily manage your Azure Devops project. You can discover which tools are available by displaying the help page of the console script:

adopt --help

For each command, you need to provide different arguments to connect to your specific Azure Devops project and team.

Luckily, a lot of these arguments can be stored in a configuration file, so you don't have to provide them each time you run a command. More information on how to configure the tool can be found in the Configuration section.

Backlog Print

Get a nicely formatted overview of your backlog in your terminal.

adopt backlog print --url <azure_devops_org_url> --token <azure_devops_personal_token> --project <azure_devops_project> --team <azure_devops_team> --category <azure_devops_backlog_category>

Backlog Sort

Tired of cleaning up your backlog by dragging work items each time you had a backlog refinement or planning session? With this short command you can automatically sort the backlog following the specific order you like.

adopt backlog print --url <azure_devops_org_url> --token <azure_devops_personal_token> --project <azure_devops_project> --team <azure_devops_team> --category <azure_devops_backlog_category> --sort_key <azure_devops_work_item_field>

The --sort_key argument determines the order in which the work items will be sorted in the backlog. The value of the --sort_key argument should be a string of characters, where each character represents a field of the work item. The order of the characters in the string determines the order in which the work items will be sorted. In lower case, an acending order is used. When capitalized, the item will be sorted in descending order. The following characters are supported:

Key Field
i Iteration path of item
p Priority of item
t Title of item
r Rank of parents in their backlog

For example, the default sorting key Iprt command will sort the work items in the backlog first by iteration path in descending order (bringing the latest iteration on top), then followed by priority, parent rank and title in ascending order, bringing highest prio work items to the top, with additional sorting by parent item ranking and finally title.

Backlog Check

Check the backlog for any inconsistencies. The following checks can be performed:

  • Check if all work items have a parent
  • Check if all work items have are assigned
  • Check if all work items have story points assigned

Each check can be enabled separately by using the --check-{option} argument, or all at once using the --check-all argument.

adopt backlog check --url <azure_devops_org_url> --token <azure_devops_personal_token> --project <azure_devops_project> --team <azure_devops_team> --category <azure_devops_backlog_category> [--check-all] [--check-parent] [--check-assigned] [--check-points]

Backlog Fix

The backlog fix command can automatically fix inconsistencies in the backlog. The following fixes can be performed:

  • Update the parent work item State based on the state of the child work items
  • Update the parent work item Iteration Path based on the assigned to of the child work items

Each fix can be enabled separately by using the --fix-{option} argument, or all at once using the --fix-all argument.

adopt backlog fix --url <azure_devops_org_url> --token <azure_devops_personal_token> --project <azure_devops_project> --team <azure_devops_team> --category <azure_devops_backlog_category> [--fix-all] [--fix-state] [--fix-iteration]

Debug logging

Each command has logging functionality built in. The level of logging can be set by using the --log-level argument. The default log level is INFO.

Configuration

For each command, you need to provide different arguments to connect to your specific Azure Devops project and team. To make the (re)execution of adopt commands easier and facilitates its use in different environments, multiple pathways are provided to configure the tool.

Each configuration option will load predefined values for the required arguments as environment variables, so the first option to provide the required arguments is by setting these variables in the (local) environment.

Argument Environment Variable Description
--token ADOPT_AZURE_DEVOPS_PAT A personal access token to authenticate with Azure Devops
--url ADOPT_AZURE_DEVOPS_ORGANIZATION_URL The URL of your Azure Devops organization
--project ADOPT_AZURE_DEVOPS_PROJECT_NAME The name of the project you want to work with
--team ADOPT_AZURE_DEVOPS_TEAM_NAME The name of the team you want to work with

These values can also be loaded, or overwritten, by a local .env file in the working directly from which adopt is executed.

Alternatively, a TOML-styled configuration file .adopt can be used locally in the project directory or globally in the user's home directory to set these required arguments:

[adopt]
token = "<azure_devops_personal_token>"
url = "<azure_devops_org_url>"
project = "<azure_devops_project>"
team = "<azure_devops_team>"

[!NOTE] A combination between the configuration file and an environment variable for your Azure Personal Access Token is recommended to safely manage these predefined arguments.

Nightly Backlog Management

Adopt can be used to automatically manage your backlog on a nightly basis. The easiest way to do this is to add a DevOps pipeline to your project that runs the required adopt commands on a nightly basis. An example YAML pipeline to run the backlog sort command can be found below:

trigger: none

parameters:
- name: logLevel
  displayName: 'Log Level'
  type: string
  default: 'INFO'
  values:
  - DEBUG
  - INFO
  - WARNING
  - ERROR
  - CRITICAL

variables:
  url: "https://dev.azure.com/<your_organization>"
  project: "<your_project>"
  team: "<your_team>"

schedules:
- cron: "0 0 * * *"
  displayName: Nightly run
  branches:
    include:
    - main

pool:
  vmImage: 'ubuntu-latest'

jobs:
- job: ManageBacklog
  displayName: 'Manage Backlog'
  variables:
    ADOPT_AZURE_DEVOPS_ORGANIZATION_URL: $(url)
    ADOPT_AZURE_DEVOPS_PROJECT_NAME: $(project)
    ADOPT_AZURE_DEVOPS_TEAM_NAME: $(team)
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.x'
      addToPath: true
    displayName: 'Use Latest Python'

  - script: |
      python -m pip install --upgrade pip
      pip install adopt
    displayName: 'Install latest version of adopt'

  - script: |
      adopt backlog sort --token $(System.AccessToken) --log-level "${{ parameters.logLevel }}" 2>&1 | tee adopt_output.log

      exit_code=${PIPESTATUS[0]}
      if [ $exit_code -ne 0 ]; then
        echo "##vso[task.logissue type=error]adopt backlog sort failed with exit code $exit_code"
        exit $exit_code
      elif grep -q "WARNING" adopt_output.log; then
        echo "##vso[task.logissue type=warning]WARNING detected in adopt backlog sort output"
        echo "##vso[task.complete result=SucceededWithIssues;]WARNING found but continuing pipeline"
        exit 0
      else
        echo "No warnings detected - sort completed successfully"
        exit 0
      fi
    displayName: 'Sort backlog'

  - script: |
      adopt backlog check --token $(System.AccessToken) --log-level "${{ parameters.logLevel }}" 2>&1 | tee adopt_check_output.log

      exit_code=${PIPESTATUS[0]}
      if [ $exit_code -ne 0 ]; then
        echo "##vso[task.logissue type=error]adopt backlog check failed with exit code $exit_code"
        exit $exit_code
      elif grep -q "WARNING" adopt_check_output.log; then
        echo "##vso[task.logissue type=warning]WARNING detected in adopt backlog check output"
        echo "##vso[task.complete result=SucceededWithIssues;]WARNING found but continuing pipeline"
        exit 0
      else
        echo "No warnings detected - check completed successfully"
        exit 0
      fi
    displayName: 'Check backlog'

Contribute

In adopt, the incredibly fast package manager uv is used to setup and manage the project. To get started with the project, you can install uv by running:

winget install --id=astral-sh.uv

or by following the instructions on the uv website.

After installing uv, you can setup the project by running:

uv sync

For convenience, most operations required to contribute or manage this project are available as make commands.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adopt-0.5.3.tar.gz (115.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adopt-0.5.3-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file adopt-0.5.3.tar.gz.

File metadata

  • Download URL: adopt-0.5.3.tar.gz
  • Upload date:
  • Size: 115.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adopt-0.5.3.tar.gz
Algorithm Hash digest
SHA256 78f4ab83985eb9ee59bade0d575c9f87cc860c1158860d4d93516412984e2120
MD5 252740510732f843af7f0c464e17b572
BLAKE2b-256 06b931d0ad42a62c0b08cf0623fb1a45d573d5c612b0629bac6d4bcbf0114288

See more details on using hashes here.

Provenance

The following attestation bundles were made for adopt-0.5.3.tar.gz:

Publisher: publish_and_release.yaml on cvandijck/azure-devops-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adopt-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: adopt-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adopt-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ca1a9f8fc797f8b892e0cd07beed4dd1f45d3638282707c5784cb9bcd6ced57c
MD5 23297a0315bff86bdc75f9bed0601585
BLAKE2b-256 516af55723c60d1a00a103d5e8db2d990d15533a09e8c5e8b14326b7ff364e32

See more details on using hashes here.

Provenance

The following attestation bundles were made for adopt-0.5.3-py3-none-any.whl:

Publisher: publish_and_release.yaml on cvandijck/azure-devops-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page