Skip to main content

High level library for Azure Devops REST API interface!

Project description

AzApi

AzApi is a complementary Python library designed to simplify and unify access to various Azure DevOps services via the REST API.

Status: Early development stage, not all features are implemented yet. The library is under active development and new features are being added regularly.

Current progress and expected features are described in CHANGELOG.md on the repository. All progress can be tracked on the GitHub repository.

Features

AzApi provides a modular, object-oriented interface to the most commonly used Azure DevOps services with logger support:

  • Boards – work items, queries, iterations, and more
  • Repos – repositories, branches, pull requests
  • Agents – agent pools and agents management

Requirements

  • Tested on Python 3.11 and above, lower versions may work but are not guaranteed
  • A Personal Access Token (PAT) with appropriate Azure DevOps permissions

Installation

Clone the repository:

git clone https://github.com/MRosinskiGit/AzureDevopsApi.git

and install dependencies from pyproject.toml or from requirements.txt:

or install directly from PyPi:

pip install azapidevops

Authentication

Authentication is handled via a Personal Access Token (PAT). You will need to provide the token when initializing the main API class and pass it to AzApi class as token attribute.

Usage

See the examples.py file on the repository for practical usage of each module. Short example:

from azapidevops.AzApi import AzApi
from azapidevops.utils.AzApi_boards import WorkItemsDef, WorkItemsStatesDef

api = AzApi(organization="ORGANIZATION_NAME", project="PROJECT_NAME", token="PAT")
api.repository_name = 'REPO_NAME'
api.agent_pool_name = 'POOL_NAME'

task_id = api.Boards.create_new_item(
    WorkItemsDef.Task, item_name="Review Task", description="Review Task for Documentation"
)
api.Boards.change_work_item_state(task_id, WorkItemsStatesDef.Task.Done)
all_branches_list = api.Repos.get_all_branches()
prs = api.Repos.get_active_pull_requests()
pr_id = api.Repos.create_pr("Test PullRequest", "TestBranch", "main", "Testing API Request.")
api.Repos.add_pr_reviewer(pr_id, "user1@gmail.com")

Logging

AzApi supports logging via the standard Python logging module. You can configure the logger to output to a file or console as needed. The library provides detailed logs for API requests and responses, which can be useful for debugging.

Testing

The repository includes both unit and integration tests, located in the ut_AzApi folder and system tests in st_AzApi directory. System tests require systemtest.env with environment variables for Azure DevOps connection (example with required parameters in systemtest.env.template)

For testing install production dependencies:

pip install -r requirements.txt

To run all tests set working directory to main project dir and run:

pytest 

or open terminal in tools as cwd directory and run ./run_test.bat for full unit and system test report with coverage logs.

License

This project is licensed under the Apache License 2.0.

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

azapidevops-0.0.3.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

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

azapidevops-0.0.3-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file azapidevops-0.0.3.tar.gz.

File metadata

  • Download URL: azapidevops-0.0.3.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for azapidevops-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cd8ecc3a3139240cae8986e8c7891c499bbd3e9c8f9ac66da7f8d15434227e2f
MD5 5eef66b281ba7a679d137dce734fbbb6
BLAKE2b-256 1c06d5feeacd09a4c85f91aced2cb1b216aa7127e63a856d21812cd2a32403d2

See more details on using hashes here.

File details

Details for the file azapidevops-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: azapidevops-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for azapidevops-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f857ab04433312281c1a57600caf156ba3d8c29db2cb19bdd330305addd05d3b
MD5 6b28139d4b9c24ee15cee53219c6a4cf
BLAKE2b-256 db3d0fb39f3c6b0ed0ea7203daf7b7ee178de0be57ae9e53a93431edae70b339

See more details on using hashes here.

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