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>/include resource headersIt never falls back to a system clang-tidy.
Recommended for project environments: uv
uv add ctidy
Recommended for one-off runs: uvx
uvx ctidy --version
uvx ctidy -p build --checks='modernize-*' src/foo.cc
You can also install with pip:
pip install ctidy
The examples below assume your virtual environment is already activated, so you can invoke ctidy directly.
Check that the wrapper is available:
ctidy --version
ctidy 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=ON
After 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.jsonIf 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.cc
Run with an explicit build directory:
ctidy -p build src/foo.cc
Run only selected checks:
ctidy -p build --checks='modernize-*,performance-*' src/foo.cc
Apply fixes:
ctidy -p build --fix src/foo.cc
Run across the whole project with multiple jobs:
ctidy -p build -j 8
Restrict diagnostics to project headers:
ctidy -p build --header-filter='^(src|include)/' src/foo.cc
ctidy 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 --help
A 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.cc
ctidy does not build LLVM in this repository. During wheel builds it only:
muttleyxd/clang-tools-static-binaries.sha512sum fileslib/clang/<major>/includerun-clang-tidy.pyPyPI 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:
x86_64x86_64arm64x86_64If the upstream static build release does not publish an asset for your OS/CPU pair, ctidy does not build a wheel for that platform.