Skip to content

Commit abaf1a2

Browse files
committed
docs: add a Packages page for the Python wheels and other packages
1 parent c2c5dc6 commit abaf1a2

7 files changed

Lines changed: 475 additions & 4 deletions

File tree

‎docs/getting-started.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ Ubuntu's packages and are no longer rebuilt. The same images are on Docker Hub a
132132
`xianpengshen/clang-tools`.
133133

134134
Single tools are also on PyPI as Python wheels: `clang-format` and `clang-tidy` (the wheels
135-
cpp-linter-hooks installs), [clang-apply-replacements](https://pypi.org/project/clang-apply-replacements/)
136-
(LLVM 16 to 23) and [clang-include-cleaner](https://pypi.org/project/clang-include-cleaner/)
137-
(LLVM 22 and 23).
135+
cpp-linter-hooks installs), and from cpp-linter
136+
[clang-include-cleaner](https://pypi.org/project/clang-include-cleaner/),
137+
[clang-apply-replacements](https://pypi.org/project/clang-apply-replacements/),
138+
[llvm-cov](https://pypi.org/project/llvm-cov/) and [ccache-bin](https://pypi.org/project/ccache-bin/).
139+
[C and C++ tools, packaged](packages.md) lists every package, with the LLVM versions each one has.

‎docs/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Set the same LLVM version in each tool, and laptops and CI run the same major re
2727
| Locally or in other CI | cpp-linter, the Python command behind the action | <https://cpp-linter.github.io/cpp-linter/> |
2828
| Just the clang tools, by LLVM version | clang-tools (pip), npm, asdf, Docker, Homebrew | <https://cpp-linter.github.io/clang-tools-pip/> |
2929
| Static clang-format and clang-tidy binaries | clang-tools-static-binaries | <https://cpp-linter.github.io/clang-tools-static-binaries/> |
30+
| LLVM tools and ccache as Python wheels, plus npm, Homebrew, asdf and Docker | clang-include-cleaner, clang-apply-replacements, llvm-cov, ccache-bin and more | <https://cpp-linter.github.io/packages/> |
3031
| Version 2, a rewrite in Rust (release candidates) | cpp-linter-rs | <https://cpp-linter.github.io/cpp-linter-rs/> |
3132

3233
The action and clang-tools cover LLVM 12 to 23. The clang-tidy pre-commit hook covers LLVM 13 to 23.

‎docs/overrides/home.html‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{% set links = [
1515
("Get started", "getting-started/" | url),
1616
("Tools", "#tools"),
17+
("Packages", "packages/" | url),
1718
("Playground", "playground/" | url),
1819
("Why cpp-linter", "why-cpp-linter/" | url),
1920
("Showcase", "showcase/" | url),
@@ -169,7 +170,7 @@ <h1 class="cl-hero__title">
169170
},
170171
{
171172
"title": "Just the clang tools", "name": "clang-tools", "icon": "octicons/package-24",
172-
"text": "clang-format, clang-tidy and friends for LLVM 12 to 23 via pip, npm or asdf, plus Docker images (up to 22) and a macOS Homebrew tap (19 to 23).",
173+
"text": "clang-format, clang-tidy and the LLVM tools around them, for LLVM 12 to 23, from PyPI, npm, Homebrew, asdf or Docker.",
173174
"code": "pip install clang-tools\nclang-tools install clang-format clang-tidy --version 21",
174175
"href": "https://cpp-linter.github.io/clang-tools-pip/", "cta": "Read the docs",
175176
},
@@ -237,6 +238,54 @@ <h3>{{ title }}</h3>
237238
</div>
238239
</section>
239240

241+
{% set packages = [
242+
("clang-include-cleaner", "Finds unused and missing #include directives.", "LLVM 22–23", "clang-include-cleaner"),
243+
("clang-apply-replacements", "Applies the fixes clang-tidy exports to your sources.", "LLVM 16–23", "clang-apply-replacements"),
244+
("llvm-cov", "llvm-cov and llvm-profdata, for source-based code coverage.", "LLVM 12–23", "llvm-cov"),
245+
("ccache-bin", "ccache, the compiler cache, from ccache's own release binaries.", "ccache 4", "ccache-bin"),
246+
] %}
247+
<section class="cl-band cl-band--white" id="packages">
248+
<div class="cl-wrap">
249+
<div class="cl-pkg">
250+
<div>
251+
<p class="cl-eyebrow">Also from cpp-linter</p>
252+
<h2 class="cl-h2">The tools themselves, for any package manager</h2>
253+
<p class="cl-sub">We build clang-format, clang-tidy and the LLVM tools around them as static binaries, then publish the same files to PyPI, npm, Homebrew, asdf and Docker. Install the version you pin, with no LLVM to install and nothing to compile.</p>
254+
<dl class="cl-facts">
255+
<div><dt>12–23</dt><dd>LLVM versions</dd></div>
256+
<div><dt>6</dt><dd>platforms</dd></div>
257+
<div><dt>540k+</dt><dd>binary downloads</dd></div>
258+
</dl>
259+
<a class="cl-link" href="{{ 'packages/' | url }}">See every package {{ arrow }}</a>
260+
</div>
261+
<div class="cl-window">
262+
<div class="cl-window__bar">
263+
<span class="cl-window__file">LLVM 22 from four package managers</span>
264+
</div>
265+
<pre class="cl-code cl-code--shell"><span class="c"># PyPI: pip, uv, pipx</span>
266+
<span class="p">$</span> pip install <span class="s">"llvm-cov==22.*"</span>
267+
<span class="p">$</span> uv tool install <span class="s">"clang-include-cleaner==22.*"</span>
268+
<span class="c"># npm</span>
269+
<span class="p">$</span> npm install -D <span class="s">@cpp-linter/clang-tidy@22</span>
270+
<span class="c"># Homebrew</span>
271+
<span class="p">$</span> brew install <span class="s">cpp-linter/tap/clang-format@22</span>
272+
<span class="c"># Docker</span>
273+
<span class="p">$</span> docker pull <span class="s">ghcr.io/cpp-linter/clang-tools:22</span></pre>
274+
</div>
275+
</div>
276+
<div class="cl-wheels">
277+
{% for name, text, range, pypi in packages %}
278+
<a class="cl-wheel" href="https://pypi.org/project/{{ pypi }}/">
279+
<span class="cl-wheel__top"><span class="cl-wheel__badge">PyPI</span><span class="cl-wheel__range">{{ range }}</span></span>
280+
<code class="cl-wheel__name">{{ name }}</code>
281+
<span class="cl-wheel__text">{{ text }}</span>
282+
<span class="cl-wheel__more">View on PyPI {{ arrow }}</span>
283+
</a>
284+
{% endfor %}
285+
</div>
286+
</div>
287+
</section>
288+
240289
<section class="cl-band">
241290
<div class="cl-wrap">
242291
<div class="cl-head">
@@ -457,6 +506,7 @@ <h2>Maintained by two volunteers</h2>
457506
<a href="https://github.com/cpp-linter/cpp-linter-hooks">pre-commit hooks</a>
458507
<a href="https://cpp-linter.github.io/cpp-linter/">Python CLI</a>
459508
<a href="https://cpp-linter.github.io/clang-tools-pip/">clang-tools</a>
509+
<a href="{{ 'packages/#python-wheels' | url }}">Python wheels</a>
460510
<a href="https://cpp-linter.github.io/clang-tools-static-binaries/">Static binaries</a>
461511
<a href="https://github.com/cpp-linter/clang-tools-npm">npm packages</a>
462512
<a href="https://github.com/cpp-linter/clang-tools-docker">Docker images</a>

‎docs/packages.md‎

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
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.

‎docs/stylesheets/extra.css‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,111 @@
4646
.md-typeset .compare table:not([class]) td:first-child {
4747
font-weight: 600;
4848
}
49+
50+
/* Packages page: the numbers under the title */
51+
.md-typeset .cl-stats {
52+
display: grid;
53+
grid-template-columns: repeat(4, minmax(0, 1fr));
54+
gap: 0.8rem;
55+
margin: 1.6em 0 0.4em;
56+
}
57+
58+
.md-typeset .cl-stats > div {
59+
display: flex;
60+
flex-direction: column;
61+
gap: 0.3rem;
62+
padding: 0.9rem 1rem;
63+
border: 1px solid var(--md-default-fg-color--lightest);
64+
border-radius: 0.6rem;
65+
}
66+
67+
.md-typeset .cl-stats strong {
68+
font-size: 1.5rem;
69+
font-weight: 750;
70+
line-height: 1.1;
71+
letter-spacing: -0.02em;
72+
}
73+
74+
.md-typeset .cl-stats span {
75+
color: var(--md-default-fg-color--light);
76+
font-size: 0.68rem;
77+
line-height: 1.45;
78+
}
79+
80+
/* Packages page: LLVM range beside a wheel's name */
81+
.md-typeset .cl-range {
82+
float: right;
83+
padding: 0.05rem 0.45rem;
84+
background: var(--md-accent-fg-color--transparent);
85+
border-radius: 1rem;
86+
color: var(--md-default-fg-color--light);
87+
font-size: 0.62rem;
88+
font-weight: 600;
89+
}
90+
91+
.md-typeset .cl-wheel-cards > ul > li > p:first-child strong {
92+
font-family: var(--md-code-font-family);
93+
}
94+
95+
/* Packages page: LLVM release -> static binaries -> package managers */
96+
.md-typeset .cl-flow {
97+
display: grid;
98+
grid-template-columns: repeat(3, minmax(0, 1fr));
99+
gap: 1.6rem;
100+
margin: 1.2em 0;
101+
}
102+
103+
.md-typeset .cl-flow__step {
104+
position: relative;
105+
display: flex;
106+
flex-direction: column;
107+
gap: 0.25rem;
108+
padding: 0.9rem 1rem;
109+
border: 1px solid var(--md-default-fg-color--lightest);
110+
border-radius: 0.6rem;
111+
}
112+
113+
.md-typeset .cl-flow__step + .cl-flow__step::before {
114+
position: absolute;
115+
top: 50%;
116+
left: -1.25rem;
117+
color: var(--md-default-fg-color--light);
118+
content: "→";
119+
transform: translateY(-50%);
120+
}
121+
122+
.md-typeset .cl-flow__step--main {
123+
border-color: var(--md-primary-fg-color);
124+
box-shadow: inset 0 0 0 1px var(--md-primary-fg-color);
125+
}
126+
127+
.md-typeset .cl-flow__label {
128+
color: var(--md-default-fg-color--light);
129+
font-size: 0.6rem;
130+
font-weight: 700;
131+
letter-spacing: 0.1em;
132+
text-transform: uppercase;
133+
}
134+
135+
.md-typeset .cl-flow__step > span:last-child {
136+
color: var(--md-default-fg-color--light);
137+
font-size: 0.68rem;
138+
}
139+
140+
@media screen and (max-width: 44.9375em) {
141+
.md-typeset .cl-stats {
142+
grid-template-columns: repeat(2, minmax(0, 1fr));
143+
}
144+
145+
.md-typeset .cl-flow {
146+
grid-template-columns: minmax(0, 1fr);
147+
gap: 1.4rem;
148+
}
149+
150+
.md-typeset .cl-flow__step + .cl-flow__step::before {
151+
top: -1.15rem;
152+
left: 1rem;
153+
content: "↓";
154+
transform: none;
155+
}
156+
}

0 commit comments

Comments
 (0)