ctidy packages clang-tidy, clang-apply-replacements, LLVM resource headers, and a bundled run-clang-tidy.py into a Python wheel.
Use it when you want a reproducible clang-tidy setup from Python packaging without depending on a system LLVM install.
ctidy always runs the bundled tools:
clang-tidyclang-apply-replacementsrun-clang-tidy.pylib/clang/<major>/includeresource headers
It never falls back to a system clang-tidy.
Recommended for project environments: uv
uv add ctidyRecommended for one-off runs: uvx
uvx ctidy --version
uvx ctidy -p build --checks='modernize-*' src/foo.ccYou can also install with pip:
pip install ctidyThe examples below assume your virtual environment is already activated, so you can invoke ctidy directly.
Check that the wrapper is available:
ctidy --versionctidy expects a compilation database. In practice that means your project needs a compile_commands.json.
For CMake projects:
cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ONAfter that, run ctidy from the project root or pass -p <build-dir> explicitly.
If you do not pass -p or --build-path, ctidy automatically looks for compile_commands.json in these locations relative to the current working directory:
build/compile_commands.json.build/compile_commands.jsonout/build/compile_commands.jsoncompile_commands.json
If none of them exist, ctidy exits with an error and asks you to provide -p <build-dir>.
Run a check on one file:
ctidy src/foo.ccRun with an explicit build directory:
ctidy -p build src/foo.ccRun only selected checks:
ctidy -p build --checks='modernize-*,performance-*' src/foo.ccApply fixes:
ctidy -p build --fix src/foo.ccRun across the whole project with multiple jobs:
ctidy -p build -j 8Restrict diagnostics to project headers:
ctidy -p build --header-filter='^(src|include)/' src/foo.ccctidy is a wrapper around the bundled LLVM run-clang-tidy.py. Aside from --version and build-path auto-discovery, CLI arguments are forwarded to that runner.
Use the upstream help output to inspect available flags:
ctidy --helpA common project flow looks like this:
cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
uv add ctidy
ctidy -p build --checks='bugprone-*,modernize-*' -j 8
ctidy -p build --fix src/foo.ccctidy does not build LLVM in this repository. During wheel builds it only:
- downloads pinned prebuilt static binaries from
muttleyxd/clang-tools-static-binaries - verifies their
.sha512sumfiles - downloads official LLVM release headers for
lib/clang/<major>/include - bundles the upstream LLVM
run-clang-tidy.py
PyPI releases are wheel-only. ctidy does not publish an sdist.
Supported wheel platforms are limited to the LLVM 20 assets available in the pinned prebuilt release:
- Linux
x86_64 - macOS
x86_64 - macOS
arm64 - Windows
x86_64
If the upstream static build release does not publish an asset for your OS/CPU pair, ctidy does not build a wheel for that platform.