Easily install clang-format, clang-tidy, clang-query, and clang-apply-replacements static binaries or Python wheels using the clang-tools CLI.
Important
This package only manages binary executables (& corresponding symbolic links) that are installed using this package's executable script. It does not intend to change or modify any binary executable installed from other sources (like LLVM releases).
For Python wheels, this CLI only support clang-format and clang-tidy tools.
Support clang tools binaries and Python wheels.
Binaries are statically linked for improved portability.
Binaries can be specified installed for increased flexibility.
Binaries are checked with SHA512 checksum. This ensures:
- Downloads are not corrupted.
- Old binary builds can be updated.
Installed binaries are symbolically linked for better cross-platform usage. For example (on Windows), the
clang-tidy-13.exebinary executable can also be invoked with the symbolic link titledclang-tidy.exeNote
To create symbolic links on Windows, you must enable developer mode from the Windows settings under "Privacy & security" > "For developers" category.
Customizable install path.
Tip
It is recommended to use this package in a virtual environment.
# create the virtual env in the working directory
python -m venv env-name
# to activate on Linux:
source env-name/bin/activate
# to activate on Windows:
./env-name/Scripts/activateThis will ensure that
- there are no permission problems when installing the tool
- the installed path (for MacOS and Windows) is within the environment's
variable
PATH.
Install clang-tools command with pip
pip install clang-toolsInstall clang-tools from git repo
pip install git+https://github.com/cpp-linter/clang-tools-pip.git@mainFor a list of supported Command Line Interface options, see the CLI documentation
Use clang-tools command to install version 13 binaries.
clang-tools --install 13Or install to a specified directory
clang-tools --install 13 --directory .Or install a specified tool, such as clang-format and clang-query version 14.
clang-tools --install 14 --tool clang-format clang-queryIf the installed directory is in your path, you can run the installed tools.
clang-format-13 --version
clang-format version 13.0.0clang-tidy-13 --version
LLVM (http://llvm.org/):
LLVM version 13.0.0
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: skylakeAfter installing the clang-tools CLI, you can install the Python wheels using the clang-tools-wheel command.
Important
The clang-tools-wheel command is primarily intended for cpp-linter projects to simplify installing clang tools Python wheels.
For general use, it is recommended to install the wheels directly using pip, pipx, uv, or similar tools.
# Install latest clang-format wheel
clang-tools-wheel --tool clang-format
# Install specific version clang-format wheel
clang-tools-wheel --tool clang-format --version 21
# Install latest clang-tidy wheel
clang-tools-wheel --tool clang-tidy
# Install specific version clang-tidy wheel
clang-tools-wheel --tool clang-tidy --version 21The following table shows the supported versions of clang-format, clang-tidy, clang-query, and clang-apply-replacements binaries for each platform:
| Platform | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linux | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Windows | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| macOS | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
For more details, visit the clang-tools-static-binaries repository.
The following Python wheels are supported:
Check the respective PyPI pages for available versions and platform support.