pysonar
Sonar Scanner for the Python Ecosystem
What it is and what it does
pysonar is a Python wrapper around SonarQube's scanning infrastructure, designed to let developers run code quality analysis directly from the command line without needing the standalone SonarScanner binary. It reads your project configuration from multiple sources—CLI flags, environment variables, pyproject.toml, or a sonar-project.properties file—and communicates with a running SonarQube instance or SonarCloud to perform static analysis on your codebase.
The package depends on jproperties, requests, and tomli to parse configuration files, make HTTP calls to the Sonar server, and handle TOML parsing. It targets modern Python versions (3.10+) and is actively maintained by SonarSource. Configuration is flexible and can be layered across multiple sources with clear precedence rules, making it adaptable to both local development workflows and CI/CD pipelines.
Use it for:
- Integrate code quality gates into CI/CD pipelines by running pysonar as a build step before deployment.
- Analyze Python projects locally during development using pyproject.toml configuration without installing SonarScanner separately.
- Enforce organization-wide code standards by configuring sonar-project.properties and running scans across multiple repositories.
- Monitor code quality trends over time by submitting analysis results to SonarCloud for public or private projects.
- Combine with environment variables in containerized workflows to pass credentials and server URLs without hardcoding them.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A command-line scanner that integrates Python projects with SonarQube or SonarCloud for code quality analysis, supporting configuration via CLI arguments, environment variables, or pyproject.toml.
Yes, if you are already using SonarQube or SonarCloud and want a lightweight Python-native scanner. The low install friction, active maintenance, and flexible configuration make it a practical choice for Python projects. The copyleft license (LGPL-3.0-only) requires review in proprietary contexts but poses no barrier for internal or open-source use. No known vulnerabilities as of 2026-08-14.
Install
pysonar on PyPI
pip
pip install pysonaruv
uv add pysonarpoetry
poetry add pysonarInstalling pysonar
Before you install
Low friction installation with a pure Python wheel and minimal dependencies. Active maintenance with recent releases; last commit on 2026-08-13 and latest release on 2026-07-08 indicate ongoing support.
License in practice
Licensed under LGPL-3.0-only (copyleft). Derivative works and distributions must retain the same license and provide source code access; suitable for internal tools and open-source projects but requires careful review in proprietary contexts.
Quickstart
pip install pysonar
pysonar --token "MyToken" -Dsonar.projectKey=my:project
Requires SonarQube v10.6 or above (or SonarCloud account) running and accessible; Python 3.10 or above required.
Verify before relying
- Whether the scanner supports incremental analysis or only full scans.
- Performance characteristics when analyzing large codebases.
- Compatibility with CI/CD platforms beyond the documented examples.
Package facts
| License | LGPL-3.0-only (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — jproperties, requests, tomli |
| Maintenance | actively maintained — 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 321,349/month — #7,624 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pysonar-1.7.0.5143-py3-none-any.whl
Keywords: sonar, sonarqube, sonarcloud, cleancode
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
python-sonarqube-apiProvides a Python client library for…
agpl · top 15,000 on PyPI
picklescanScans Python Pickle files and related…
permissive · top 15,000 on PyPI
pysentry-rsPySentry scans Python projects for known…
permissive · top 15,000 on PyPI
bbotBBOT is a multipurpose reconnaissance and…
agpl · top 15,000 on PyPI
cisco-ai-mcp-scannerScans MCP (Model Context Protocol) servers and…
unclear · top 15,000 on PyPI
trufflehog3Scans Git repositories and source code for…
unclear · top 15,000 on PyPI
kingfisher-binKingfisher is a command-line secret scanner…
permissive · top 15,000 on PyPI
zaproxyPython client library for the OWASP ZAP…
permissive · top 15,000 on PyPI
cisco-ai-skill-scannerScans AI Agent Skills for prompt injection,…
permissive · top 15,000 on PyPI
python-nmapPython wrapper for the nmap port scanner that…
copyleft · top 15,000 on PyPI