Skip to main content

A fully-typed Python SDK for SonarQube API

Project description

SonarQube SDK

PyPI version Python versions License: MIT Documentation Status

A fully-typed Python SDK for the SonarQube API.

Features

  • Full API Coverage: Support for all 30+ SonarQube API domains
  • Type Safety: Complete type hints with Pydantic models
  • Authentication: Support for both token and basic authentication
  • Async Support: Built on httpx for modern async/sync HTTP handling
  • Python 3.9+: Compatible with Python 3.9 through 3.13

Installation

pip install sonarqube-sdk

Or with uv:

uv add sonarqube-sdk

Quick Start

from sonarqube import SonarQubeClient

# Initialize client with token authentication
client = SonarQubeClient(
    base_url="https://sonarqube.example.com",
    token="your-token"
)

# Or with basic authentication
client = SonarQubeClient(
    base_url="https://sonarqube.example.com",
    username="admin",
    password="admin"
)

# Create an application
app = client.applications.create(
    name="My Application",
    key="my-app",
    visibility="private"
)

# Add a project to the application
client.applications.add_project(
    application="my-app",
    project="my-project"
)

# Search for projects
projects = client.projects.search(q="backend")
for project in projects.components:
    print(f"Project: {project.name} ({project.key})")

# Get issues
issues = client.issues.search(
    project_keys=["my-project"],
    severities=["CRITICAL", "BLOCKER"]
)
for issue in issues.issues:
    print(f"Issue: {issue.message}")

API Domains

The SDK provides access to all SonarQube API domains through a namespace pattern:

Domain Description
client.applications Manage applications
client.projects Manage projects
client.issues Manage issues
client.rules Manage rules
client.qualitygates Manage quality gates
client.qualityprofiles Manage quality profiles
client.users Manage users
client.user_tokens Manage user tokens
client.permissions Manage permissions
client.settings Manage settings
... And 20+ more domains

Documentation

Full documentation is available at https://sonarqube-sdk.readthedocs.io

Development

Setup

# Clone the repository
git clone https://github.com/silasvasconcelos/sonarqube-sdk.git
cd sonarqube-sdk

# Install development dependencies
make dev

Common Commands

make help          # Show all available commands
make test          # Run tests
make test-cov      # Run tests with coverage
make lint          # Run linter
make format        # Format code
make type          # Run type checker
make security      # Run security checks
make check         # Run all checks
make tox           # Run tests on all Python versions
make docs          # Build documentation
make build         # Build package

Testing

# Run all tests
make test

# Run tests with coverage
make test-cov

# Run tests on all Python versions
make tox

# Run specific Python version
make tox-py312

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a history of changes.

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

sonarqube_sdk-0.1.0.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

sonarqube_sdk-0.1.0-py3-none-any.whl (64.3 kB view details)

Uploaded Python 3

File details

Details for the file sonarqube_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: sonarqube_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.12

File hashes

Hashes for sonarqube_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 01f815b4a60c1750610dcd2ce510b282d82c558209c314cdc19821ac8df92f98
MD5 ecc644fb848581f471b7628320c88f1e
BLAKE2b-256 9c2ed6e600d71b37feba14e5b353bb21a3b0a6cf940ed0a2b37f3d5971a415c0

See more details on using hashes here.

File details

Details for the file sonarqube_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sonarqube_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68638af43b07f7d9641ee3fa6a2d0f75cac818d3de37786505e0aa6f89332345
MD5 cdfb18356cca02a5611deb62eeab171b
BLAKE2b-256 5fad83a749def047bcdae4e4e5148cc8e22e3d2a375c7db2e943766d0361415a

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