|
| 1 | +--- |
| 2 | +title: C and C++ tools, packaged |
| 3 | +description: clang-include-cleaner, clang-apply-replacements, llvm-cov and ccache as Python wheels on PyPI, and clang-format and clang-tidy on npm, Homebrew, asdf and Docker, for LLVM 12 to 23 on six platforms. |
| 4 | +hide: |
| 5 | + - navigation |
| 6 | +--- |
| 7 | + |
| 8 | +# C and C++ tools, packaged |
| 9 | + |
| 10 | +cpp-linter builds clang-format, clang-tidy and the LLVM tools around them as static binaries for |
| 11 | +every LLVM version from 12 to 23, on Linux, macOS and Windows, x86-64 and ARM64. The same files |
| 12 | +then go to PyPI, npm, Homebrew, asdf and Docker, so you install the tool at the version you pin, |
| 13 | +with the package manager your project already uses. There is no LLVM to install and nothing to |
| 14 | +compile. |
| 15 | + |
| 16 | +<div class="cl-stats" markdown> |
| 17 | + |
| 18 | +<div><strong>12–23</strong><span>LLVM versions, each at its newest release</span></div> |
| 19 | +<div><strong>6</strong><span>platforms: Linux, macOS and Windows on x86-64 and ARM64</span></div> |
| 20 | +<div><strong>540k+</strong><span>downloads of the static binaries</span></div> |
| 21 | +<div><strong>Attested</strong><span>each binary and wheel names the commit that built it</span></div> |
| 22 | + |
| 23 | +</div> |
| 24 | + |
| 25 | +## Python wheels |
| 26 | + |
| 27 | +`pip install`, `uv tool install` or `pipx install` puts the command on your `PATH`. The package |
| 28 | +version is the tool's version, so `pip install "llvm-cov==22.*"` installs llvm-cov from LLVM 22. |
| 29 | + |
| 30 | +<div class="grid cards cl-wheel-cards" markdown> |
| 31 | + |
| 32 | +- **clang-include-cleaner** <span class="cl-range">LLVM 22–23</span> |
| 33 | + |
| 34 | + --- |
| 35 | + |
| 36 | + Finds unused and missing `#include` directives in C and C++ files. |
| 37 | + |
| 38 | + ```bash |
| 39 | + pip install clang-include-cleaner |
| 40 | + ``` |
| 41 | + |
| 42 | + [PyPI](https://pypi.org/project/clang-include-cleaner/) · |
| 43 | + [GitHub](https://github.com/cpp-linter/clang-include-cleaner-wheel) |
| 44 | + |
| 45 | +- **clang-apply-replacements** <span class="cl-range">LLVM 16–23</span> |
| 46 | + |
| 47 | + --- |
| 48 | + |
| 49 | + Applies the fixes that `clang-tidy --export-fixes` writes to your source files. |
| 50 | + |
| 51 | + ```bash |
| 52 | + pip install clang-apply-replacements |
| 53 | + ``` |
| 54 | + |
| 55 | + [PyPI](https://pypi.org/project/clang-apply-replacements/) · |
| 56 | + [GitHub](https://github.com/cpp-linter/clang-apply-replacements-wheel) |
| 57 | + |
| 58 | +- **llvm-cov** <span class="cl-range">LLVM 12–23</span> |
| 59 | + |
| 60 | + --- |
| 61 | + |
| 62 | + `llvm-cov` and `llvm-profdata`, for clang's source-based code coverage. |
| 63 | +
|
| 64 | + ```bash |
| 65 | + pip install llvm-cov |
| 66 | + ``` |
| 67 | +
|
| 68 | + [PyPI](https://pypi.org/project/llvm-cov/) · |
| 69 | + [GitHub](https://github.com/cpp-linter/llvm-cov-wheel) |
| 70 | +
|
| 71 | +- **ccache-bin** <span class="cl-range">ccache 4</span> |
| 72 | +
|
| 73 | + --- |
| 74 | +
|
| 75 | + `ccache`, the C and C++ compiler cache, from ccache's own release binaries. |
| 76 | + |
| 77 | + ```bash |
| 78 | + pip install ccache-bin |
| 79 | + ``` |
| 80 | + |
| 81 | + [PyPI](https://pypi.org/project/ccache-bin/) · |
| 82 | + [GitHub](https://github.com/cpp-linter/ccache-wheel) |
| 83 | + |
| 84 | +</div> |
| 85 | + |
| 86 | +Every wheel: |
| 87 | + |
| 88 | +- holds the tool's binary unchanged, plus clang's builtin headers when the tool parses code; |
| 89 | +- contains no Python code, so it works with any Python 3, and is tested with pip, uv, |
| 90 | + `uv tool install` and `pip install --user` on every platform before it is released; |
| 91 | +- has Linux wheels for glibc 2.17 and later and for musl, so it also installs on Alpine; |
| 92 | +- is published from GitHub Actions with PyPI Trusted Publishing, with an attestation that names |
| 93 | + the commit it was built from. |
| 94 | + |
| 95 | +Pin the tools next to the rest of your development dependencies, and every laptop and CI job runs |
| 96 | +the same version: |
| 97 | + |
| 98 | +```toml title="pyproject.toml" |
| 99 | +[dependency-groups] |
| 100 | +dev = ["clang-include-cleaner==22.*", "llvm-cov==22.*", "ccache-bin"] |
| 101 | +``` |
| 102 | + |
| 103 | +Or run one without installing it, for example in CI: `uvx clang-include-cleaner --help`, or |
| 104 | +`pipx run llvm-cov --version` on GitHub-hosted runners, which ship with pipx. |
| 105 | + |
| 106 | +clang-format and clang-tidy already have widely used wheels on PyPI from another project, |
| 107 | +[clang-format](https://pypi.org/project/clang-format/) and |
| 108 | +[clang-tidy](https://pypi.org/project/clang-tidy/); cpp-linter-hooks installs those. For LLVM |
| 109 | +versions they do not have, or to install several tools at once, use |
| 110 | +[clang-tools](https://cpp-linter.github.io/clang-tools-pip/), which installs the static binaries |
| 111 | +by version: |
| 112 | + |
| 113 | +```bash |
| 114 | +pip install clang-tools |
| 115 | +clang-tools install clang-format clang-tidy --version 21 |
| 116 | +``` |
| 117 | + |
| 118 | +## Other package managers |
| 119 | + |
| 120 | +| Package | LLVM | Runs on | Install | |
| 121 | +| --- | --- | --- | --- | |
| 122 | +| [npm packages](https://github.com/cpp-linter/clang-tools-npm) | 12 to 23 | Linux, macOS, Windows on x86-64 and ARM64 | `npm install --save-dev @cpp-linter/clang-format@21 @cpp-linter/clang-tidy@21` | |
| 123 | +| [Homebrew tap](https://github.com/cpp-linter/homebrew-tap) | 19 to 23 | macOS | `brew install cpp-linter/tap/clang-format@21` | |
| 124 | +| [asdf plugin](https://github.com/cpp-linter/asdf-clang-tools) | 12 to 23 | wherever asdf runs | `asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git` | |
| 125 | +| [Docker images](https://github.com/cpp-linter/clang-tools-docker) | 7 to 23 | Docker on x86-64 and ARM64 | `docker pull ghcr.io/cpp-linter/clang-tools:21` | |
| 126 | +| [Static binaries](https://cpp-linter.github.io/clang-tools-static-binaries/) | 12 to 23 | Linux, macOS, Windows on x86-64 and ARM64 | one file from the download page | |
| 127 | + |
| 128 | +## One build behind every package |
| 129 | + |
| 130 | +<div class="cl-flow" markdown> |
| 131 | + |
| 132 | +<div class="cl-flow__step"><span class="cl-flow__label">Upstream</span><strong>LLVM release</strong><span>12 to 23, each at its newest patch release</span></div> |
| 133 | +<div class="cl-flow__step cl-flow__step--main"><span class="cl-flow__label">Built once</span><strong>Static binaries</strong><span>6 platforms, checksums and build attestations</span></div> |
| 134 | +<div class="cl-flow__step"><span class="cl-flow__label">Published to</span><strong>PyPI · npm · Homebrew · asdf · Docker</strong><span>the same files, unchanged</span></div> |
| 135 | + |
| 136 | +</div> |
| 137 | + |
| 138 | +A new LLVM release starts a build of the |
| 139 | +[static binaries](https://cpp-linter.github.io/clang-tools-static-binaries/) on all six |
| 140 | +platforms. When it is published, a bot opens the update pull request for each wheel, and the new |
| 141 | +wheels are released once they pass their tests on every platform. So an LLVM version runs the same |
| 142 | +`clang-tidy` whether it comes from clang-tools, npm, Homebrew, asdf or Docker. The build and |
| 143 | +release workflows the wheels share are in [cpp-linter/wheels](https://github.com/cpp-linter/wheels). |
| 144 | + |
| 145 | +## Check what you install |
| 146 | + |
| 147 | +Each static binary and each wheel has a build provenance attestation. To check one with the |
| 148 | +GitHub CLI: |
| 149 | + |
| 150 | +```bash |
| 151 | +gh attestation verify clang-format-22_linux-amd64 --repo cpp-linter/clang-tools-static-binaries |
| 152 | +pip download --no-deps "llvm-cov==22.*" |
| 153 | +gh attestation verify llvm_cov-*.whl --repo cpp-linter/llvm-cov-wheel |
| 154 | +``` |
| 155 | + |
| 156 | +The static binaries also come with `SHA512SUMS`. Their |
| 157 | +[download page](https://cpp-linter.github.io/clang-tools-static-binaries/) shows how to check a |
| 158 | +download, and the [security policy](https://github.com/cpp-linter/clang-tools-static-binaries/blob/master/SECURITY.md#checking-where-a-binary-was-built) |
| 159 | +explains what an attestation proves. |
0 commit comments