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.2.tar.gz (19.0 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.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: azapidevops-0.0.2.tar.gz
  • Upload date:
  • Size: 19.0 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.2.tar.gz
Algorithm Hash digest
SHA256 8fb4617497a01e183025d41b5ecdf6838bf0d623800b37f83cd59194694758c3
MD5 928a414e22853f7d377e190632bc2e14
BLAKE2b-256 4aa9e7beb3873dd2d5695684999468396a75379c36741154f4ade23bd94de6ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: azapidevops-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 888b1d20c5a2f925d7c66b964e12cb30e92551ebe04aa022339d2cd3c333bd8f
MD5 fc1387521c445f5937d6556926970c99
BLAKE2b-256 a8c034e1cd25827473c6bbce8d7c38647b6d59f2f87a645aba5b310018907a7e

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