skillfed

pysonar

Sonar Scanner for the Python Ecosystem

pysonar v1.7.0.5143 321.3K downloads/30d#7,624 on PyPI22
Copyleft license LGPL-3.0-only Active released

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 pysonar

uv

uv add pysonar

poetry

poetry add pysonar

Installing 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

Environment :: ConsoleIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Quality Assurance

Tags

sonarqube scanner pythoncode quality analysis toolsonarcloud integrationpython static analysissonar project scannercode coverage reportingquality gate automation
code-qualityci-cdstatic-analysis

More Quality Assurance packages