skillfed

pyclang

A python clang-tidy runner

pyclang v0.7.0 489.6K downloads/30d#6,375 on PyPI
Permissive license MIT Active released

What it is and what it does

Pyclang is a Python wrapper around clang-tidy, the LLVM static analysis tool for C and C++. It provides a chainable API to orchestrate clang-tidy runs across directories, allowing you to compose analysis workflows programmatically—configure the build environment, filter files, run the analysis, and normalize results—without writing shell scripts. The package includes a built-in command-line script (idf_clang_tidy) for ESP-IDF projects that chains common steps automatically.

The core design centers on the Runner class: you instantiate it with a list of directories, chain method calls to define your analysis pipeline, then invoke the instance to execute all steps. You can also subclass Runner and use the @chain decorator to add custom analysis steps. It depends on esp-pylib for environment handling and rich for terminal output formatting.

Use it for:

  • Automate clang-tidy analysis in CI/CD pipelines for C/C++ projects without writing shell wrappers
  • Run static analysis on ESP-IDF projects using the predefined idf_clang_tidy script with standard workflow steps
  • Build custom analysis workflows by chaining Runner methods to configure, filter, and normalize code quality checks
  • Integrate clang-tidy into Python-based build systems or project management tools that need programmatic control

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pyclang wraps clang-tidy to run static analysis checks on C/C++ code directories, with chainable methods for configuring analysis steps and a command-line interface for common workflows.

Yes, if you need to run clang-tidy from Python or automate it in a build pipeline. Low install friction, permissive license, no known vulnerabilities, and active maintenance make it a safe choice. Verify that clang-tidy itself is available on your system and that esp-pylib meets your environment requirements.

Install

pyclang on PyPI

pip

pip install pyclang

uv

uv add pyclang

poetry

poetry add pyclang

Installing pyclang

Before you install

Low install friction; pure Python wheel with only two runtime dependencies (esp-pylib and rich). Active maintenance with a release 32 days ago.

License in practice

MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.

Quickstart

pip install pyclang

import os
from pyclang import Runner

runner = Runner(['/path/to/code'])
runner.idf_reconfigure().normalize()
runner()

Requires clang-tidy to be installed and available on the system PATH; typically part of LLVM/Clang toolchain.

Verify before relying

  • Whether clang-tidy version compatibility is documented or constrained
  • Whether esp-pylib and rich are optional or always required at runtime
  • Performance characteristics when analyzing large codebases

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 2 — esp-pylib, rich
Maintenance actively maintained — 32 days since the last release
First released
Downloads 489,584/month — #6,375 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyclang-0.7.0-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating 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.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

clang-tidy runner pythonc++ static analysis automationcode quality checking wrapperclang-tidy cli toolidf project analysis
static-analysisclang-tidybuild-automation

More Quality Assurance packages