Clang-Format is an LLVM-based code formatting tool
Project description
clang-format Python distribution
This project packages the clang-format
utility as a Python package. It allows you to install clang-format
directly from PyPI:
python -m pip install clang-format
This projects intends to release a new PyPI package for each major and minor release of clang-format
.
Use with pipx
You can use pipx
to run clang-format, as well. For example, pipx run clang-format <args>
will run clang-format without any previous install required on any machine with pipx (including all default GitHub Actions / Azure runners, avoiding requiring a pre-install step or even actions/setup-python
).
Use from pre-commit
A pre-commit hook is also provided, use like this:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c++, c, cuda]
In contrast to many other pre-commit hooks, the versioning of the hook matches the versioning of clang-format
.
If you are required to stick with a given major/minor version of clang-format
with your pre-commit-hook, you can use this alternative hook repository that also receives backports of older versions of clang-format.
Currently, all major/minor versions of LLVM >= 10 are supported.
It is best to subscribe to releases of the hook repository to get notified of new backport releases, as pre-commit
's auto-upgrade functionality will not work in that case.
Building new releases
The clang-format-wheel repository provides the logic to build and publish binary wheels of the clang-format
utility.
In order to add a new release, the following steps are necessary:
- Edit the version file
- In the form
llvm_version.wheel_version
, e.g.18.0.2.1
- In the form
- Tag the commit with this version to trigger the GitHub Actions release workflow
- e.g.
git tag v18.0.2.1 && git push origin v18.0.2.1
- e.g.
Alternatively, the workflow can be triggered manually:
On manual triggers, the following input variables are available:
llvm_version
: Override the LLVM version (default:""
)wheel_version
: Override the wheel packaging version (default"0"
)skip_emulation
: Set which emulation builds to skip, e.g."qemu"
(default:""
)deploy_to_testpypi
: Whether to deploy to TestPyPI instead of PyPI (default:false
)
The repository with the precommit hook is automatically updated using a scheduled Github Actions workflow.
Acknowledgements
This repository extends the great work of several other projects:
clang-format
itself is provided by the LLVM project under the Apache 2.0 License with LLVM exceptions.- The build logic is based on scikit-build-core which greatly reduces the amount of low level code necessary to package
clang-format
. - The
scikit-build
packaging examples of CMake and Ninja were very helpful in packagingclang-format
. - The CI build process is controlled by cibuildwheel which makes building wheels across a number of platforms a pleasant experience (!)
Special thanks goes to mgevaert who initiated this project and maintained it until 2021.
We are grateful for the generous provisioning with CI resources that GitHub currently offers to Open Source projects.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for clang_format-18.1.8-py2.py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca6768270e291495174faa6d8c082aa0181722b29ef8e36558b397069fa4a2d |
|
MD5 | 6f1268b1ed0823715a673e3cc46efd1a |
|
BLAKE2b-256 | e8809b7ac1db31369307a74178ece94af2d7f800bb948af3b6d68fe2266f32b0 |
Hashes for clang_format-18.1.8-py2.py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03e0a762b4b504750ce4999174fa50a3c4d6b83d7999481e1b6a1b3bc2915121 |
|
MD5 | f60f6b122354877377f420c7c4bf6254 |
|
BLAKE2b-256 | c3b572fad56b06caef8dd41bcc40618ebf90e0ff881fef80b61c826a7bba9bef |
Hashes for clang_format-18.1.8-py2.py3-none-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4762e95ea887d522bf664c1411d93d4d41fc9eb059835dd88b9ad54bc3cb08e0 |
|
MD5 | 93b1d197500e751788643ce578f47259 |
|
BLAKE2b-256 | c8b17bdec805dfa84eb4d2f3cbe65a419eaeb4cb0d67634c68d0915f54a32b88 |
Hashes for clang_format-18.1.8-py2.py3-none-musllinux_1_2_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a41b7c7c3e65fa56763f5712f919111b35d7a8e857f8bef4ad5a4cdc1be131 |
|
MD5 | 4afa1b072de0ac080878f275920b658a |
|
BLAKE2b-256 | d89a1b390ff1eb080a96f113e813bb9f0104c8b998e3ebe78ad6222d1b563d3a |
Hashes for clang_format-18.1.8-py2.py3-none-musllinux_1_2_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c5dd546efa80a838bb9fd4cf6f6e37d85301c0bca13cd79ab5749422ca35a1 |
|
MD5 | dd3ba34b64dca1e106f8b0f003a2e92c |
|
BLAKE2b-256 | c0995d15eacc59a447afb0a2a3ffd1a5aace3a8eae4ff20be06530cc043fe9b1 |
Hashes for clang_format-18.1.8-py2.py3-none-musllinux_1_2_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea103b3ae5b0941152cd29c67eab086aafc98675370ac13581005807680132aa |
|
MD5 | e02505fb0030c9c41613d42b5661bd39 |
|
BLAKE2b-256 | b210d691db9818417687627ae388417ef97f6ca8b8e489a2ca071a8f32ea438e |
Hashes for clang_format-18.1.8-py2.py3-none-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d71869103d0f27be3c4930bea59dc6325177a259ba321a04663a231432ec343 |
|
MD5 | d21aa77617f6b7e4d09c0da4fdac449e |
|
BLAKE2b-256 | a79348c0fd19ac5d6221059049facf0e1a91572e7f811e57f94d4882e37ee8a7 |
Hashes for clang_format-18.1.8-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2de122b8aa78ba49e326f974131caab2c79f4ae877c227cd4e3e5d82a98d21e5 |
|
MD5 | dddec7b45c700ed348cd5a70f719de21 |
|
BLAKE2b-256 | 05a8d94adc8025c6a313bed5da994c421fff7dc4288d20028b309b1d45e15032 |
Hashes for clang_format-18.1.8-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a73a50e17c94325712631c15e5b210e374841bbeefb915f12934b902310df7b |
|
MD5 | f41c25ee9bb91be4076425632d7a3b8e |
|
BLAKE2b-256 | 08205b2928c74c3d8ceab9d60348d26e177e7c2dc39c43a5e6a8b9865aa66c84 |
Hashes for clang_format-18.1.8-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11ecdae9cd9068ed010b7cc5fa9d3d2ae08de8bbfa493df865774ad63fd7d76 |
|
MD5 | d28d7755192baa0e826d53bf43fa078c |
|
BLAKE2b-256 | 4f22937978c6ef5604a6441c214d7350d347d6796f69acd127631e0aa24f1933 |
Hashes for clang_format-18.1.8-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 310206c21fa8177c019a3871de8c5400e51867376cae630ee3d1610aa6c93816 |
|
MD5 | 206510f794aa5cb35a68cd42d0b4f173 |
|
BLAKE2b-256 | df64ce934b3d1002fdb87994fd15e7fd2eb7eb4e6770ccf9dac46f03d74edbe6 |
Hashes for clang_format-18.1.8-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2db077523bd4517b41fa6adb2e5ee63fc91bc7b641dc6e28b959fa8050cf41b |
|
MD5 | ac7edaa9ef84f7b872ad267217c90da5 |
|
BLAKE2b-256 | 3700bd44b4d3e5d80560297d49ee7be0ed87260453a5115c6f613527f122a2e2 |
Hashes for clang_format-18.1.8-py2.py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4be2b5d983a0cc1ef90a224b599f5928d82ce31154ba69accfdcb670aea62f40 |
|
MD5 | 89fe936b12293c10f2ab8a245d92516d |
|
BLAKE2b-256 | 184c5f82861a89cbdd99b1525c353a35a034d2eb3ee392348b4ba713dc697a3e |
Hashes for clang_format-18.1.8-py2.py3-none-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c41e2521b7e6ba706cc5d1c3e95eed9a41c1522244e23624e1518991f02a604 |
|
MD5 | 8563d88a0d4dfd3ee27db160a0f2b898 |
|
BLAKE2b-256 | 1536974be8a5b9776d39a2f96746db80c3d963b232ab9660fd0891765b5b6a17 |