|
2 | 2 |
|
3 | 3 | `cppllvm` is a monorepo for Python-packaged C/C++ LLVM command-line tools. |
4 | 4 |
|
5 | | -Today it contains: |
| 5 | +[](https://pypi.org/project/ctidy/) |
| 6 | +[](https://pypi.org/project/cformat/) |
| 7 | +[](https://github.com/BayernMuller/cppllvm/actions/workflows/checks.yml) |
| 8 | +[](https://github.com/BayernMuller/cppllvm/actions/workflows/wheel-ctidy.yml) |
| 9 | +[](https://github.com/BayernMuller/cppllvm/actions/workflows/wheel-cformat.yml) |
| 10 | +[](https://github.com/BayernMuller/cppllvm/actions/workflows/release-ctidy.yml) |
| 11 | +[](https://github.com/BayernMuller/cppllvm/actions/workflows/release-cformat.yml) |
6 | 12 |
|
7 | | -- `ctidy`: bundled `clang-tidy` and `clang-apply-replacements` |
| 13 | +The repository currently publishes two wheel-only packages: |
| 14 | + |
| 15 | +- `ctidy`: bundled `clang-tidy`, `clang-apply-replacements`, LLVM resource headers, and `run-clang-tidy.py` |
8 | 16 | - `cformat`: bundled `clang-format` |
9 | 17 |
|
10 | | -Install them independently: |
| 18 | +Each package ships its own executable and always uses the bundled LLVM tools. There is no fallback to a system-installed `clang-tidy` or `clang-format`. |
| 19 | + |
| 20 | +## Overview |
| 21 | + |
| 22 | +`cppllvm` makes it easy to set up a consistent C/C++ developer environment with Python packaging. |
| 23 | + |
| 24 | +Instead of asking every developer or CI job to install and manage a matching LLVM toolchain by hand, you can install `ctidy` and `cformat` with `uv` and immediately get reproducible `clang-tidy` and `clang-format` commands in your environment. |
| 25 | + |
| 26 | +This is useful when you want: |
| 27 | + |
| 28 | +- fast setup for new developers |
| 29 | +- the same lint/format tool versions in local development and CI |
| 30 | +- LLVM tooling without depending on a system package manager |
| 31 | +- Python-managed C/C++ tooling that is easy to add, pin, and upgrade |
| 32 | + |
| 33 | +## Releases |
| 34 | + |
| 35 | + |
| 36 | +| Package | PyPI project | Release trigger | Package docs | |
| 37 | +| --- | --- | --- | --- | |
| 38 | +| `ctidy` | [ctidy](https://pypi.org/project/ctidy/) | `ctidy-v*` tag | [packages/ctidy/README.md](packages/ctidy/README.md) | |
| 39 | +| `cformat` | [cformat](https://pypi.org/project/cformat/) | `cformat-v*` tag | [packages/cformat/README.md](packages/cformat/README.md) | |
| 40 | + |
| 41 | + |
| 42 | +PyPI releases are wheel-only. Neither package publishes an `sdist`. |
| 43 | + |
| 44 | +## Platform Availability |
| 45 | + |
| 46 | +Available wheels are limited to the upstream LLVM 20 prebuilt assets pinned by this repository. |
| 47 | + |
| 48 | + |
| 49 | +| Platform | Python ABI | `ctidy` | `cformat` | |
| 50 | +| --- | --- | --- | --- | |
| 51 | +| Linux `x86_64` | `cp39+` | ✅ | ✅ | |
| 52 | +| macOS `x86_64` | `cp39+` | ✅ | ✅ | |
| 53 | +| macOS `arm64` | `cp39+` | ✅ | ✅ | |
| 54 | +| Windows `x86_64` | `cp39+` | ✅ | ✅ | |
| 55 | + |
| 56 | + |
| 57 | +If the upstream static build release does not publish an asset for an OS/CPU pair, this repository does not produce a wheel for that platform. |
| 58 | + |
| 59 | +## Installation |
| 60 | + |
| 61 | +Recommended package installation is with `uv`: |
11 | 62 |
|
12 | 63 | ```bash |
13 | 64 | uv add ctidy |
14 | 65 | uv add cformat |
15 | 66 | ``` |
16 | 67 |
|
17 | | -## `ctidy` |
18 | | - |
19 | | -`ctidy` packages `clang-tidy`, `clang-apply-replacements`, resource headers, and a bundled `run-clang-tidy.py` into a Python wheel so the tool can be invoked with: |
| 68 | +For one-off usage without modifying a project environment, use `uvx`: |
20 | 69 |
|
21 | 70 | ```bash |
22 | | -ctidy |
23 | | -uv run ctidy |
| 71 | +uvx ctidy --version |
| 72 | +uvx cformat --version |
24 | 73 | ``` |
25 | 74 |
|
26 | | -The package always uses the bundled binaries. It never falls back to a system `clang-tidy`. |
| 75 | +Package-specific usage and examples live in the package READMEs. |
| 76 | + |
| 77 | +## Build And Distribution Model |
27 | 78 |
|
28 | | -`ctidy` does not build LLVM in this repository. During wheel builds it only: |
| 79 | +This repository does not build LLVM from source. During wheel builds, each package only: |
29 | 80 |
|
30 | 81 | - downloads pinned prebuilt static binaries from `muttleyxd/clang-tools-static-binaries` |
31 | 82 | - verifies their `.sha512sum` files |
32 | | -- downloads official LLVM release headers for `lib/clang/<major>/include` |
33 | | -- bundles the upstream LLVM `run-clang-tidy.py` |
| 83 | +- for `ctidy`, downloads official LLVM release headers for `lib/clang/<major>/include` |
| 84 | +- for `ctidy`, bundles the upstream LLVM `run-clang-tidy.py` |
34 | 85 |
|
35 | | -PyPI releases are wheel-only for now. `ctidy` does not publish an `sdist`. |
| 86 | +## Repository Layout |
36 | 87 |
|
37 | | -Supported wheel platforms are limited to the LLVM 20 assets that exist in the pinned prebuilt release: |
| 88 | +```text |
| 89 | +packages/ |
| 90 | + cformat/ Python package for bundled clang-format |
| 91 | + ctidy/ Python package for bundled clang-tidy tools |
| 92 | +tests/ Repository-level tests for packaging and CLI behavior |
| 93 | +tools/ Release and maintenance helpers |
| 94 | +``` |
38 | 95 |
|
39 | | -- Linux `x86_64` |
40 | | -- macOS `x86_64` |
41 | | -- macOS `arm64` |
42 | | -- Windows `x86_64` |
| 96 | +## Local Development |
43 | 97 |
|
44 | | -If the upstream static build release does not publish an asset for your OS/CPU pair, `ctidy` will not build a wheel for that platform. |
| 98 | +Install the workspace tooling: |
45 | 99 |
|
46 | | -## `cformat` |
| 100 | +```bash |
| 101 | +uv sync --group dev |
| 102 | +``` |
47 | 103 |
|
48 | | -`cformat` packages `clang-format` into a Python wheel so the tool can be invoked with: |
| 104 | +Run the repository checks: |
49 | 105 |
|
50 | 106 | ```bash |
51 | | -cformat |
52 | | -uv run cformat |
| 107 | +PYTHONPATH=packages/ctidy/src:packages/cformat/src:. python -m unittest discover -s tests |
| 108 | +ruff check . |
| 109 | +ty check . |
53 | 110 | ``` |
54 | | - |
55 | | -Like `ctidy`, it is wheel-only, uses the pinned prebuilt static binary release, and only publishes wheels for the OS/CPU combinations that exist in that upstream release. |
|
0 commit comments