clang-format 22.1.2


pip install clang-format

  Latest version

Released: Mar 27, 2026


Meta
Author: Dominic Kempf

Classifiers

Programming Language
  • C
  • C++

Operating System
  • OS Independent

License
  • OSI Approved :: Apache Software License

Intended Audience
  • Developers

Topic
  • Software Development :: Quality Assurance

clang-format Python distribution

PyPI Release

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: v22.1.2
  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:

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 packaging clang-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.

22.1.2 Mar 27, 2026
22.1.1 Mar 11, 2026
22.1.0 Feb 24, 2026
21.1.8 Dec 16, 2025
21.1.7 Dec 04, 2025
21.1.6 Nov 19, 2025
21.1.5 Nov 04, 2025
21.1.2 Sep 24, 2025
21.1.1 Sep 15, 2025
21.1.0 Aug 28, 2025
20.1.8 Jul 10, 2025
20.1.7 Jun 26, 2025
20.1.6 Jun 11, 2025
20.1.5 May 21, 2025
20.1.4 May 07, 2025
20.1.3 Apr 28, 2025
20.1.0 Mar 10, 2025
19.1.7 Jan 14, 2025
19.1.6 Jan 03, 2025
19.1.5 Dec 09, 2024
19.1.4 Nov 21, 2024
19.1.3 Oct 30, 2024
19.1.2 Oct 15, 2024
19.1.1 Oct 01, 2024
19.1.0 Sep 23, 2024
18.1.8 Jun 28, 2024
18.1.7 Jun 21, 2024
18.1.6 Jun 03, 2024
18.1.5 May 06, 2024
18.1.4 Apr 19, 2024
18.1.3 Apr 04, 2024
18.1.2 Mar 21, 2024
18.1.1 Mar 11, 2024
18.1.0 Mar 06, 2024
17.0.6 Nov 29, 2023
17.0.5 Nov 15, 2023
17.0.4 Nov 02, 2023
17.0.3 Oct 17, 2023
17.0.2 Oct 04, 2023
17.0.1 Sep 19, 2023
16.0.6 Jun 14, 2023
16.0.5 Jun 12, 2023
16.0.4 May 17, 2023
16.0.3 May 03, 2023
16.0.2 Apr 21, 2023
16.0.1 Apr 10, 2023
16.0.0 Mar 21, 2023
15.0.7 Jan 16, 2023
15.0.6 Dec 14, 2022
15.0.4 Nov 04, 2022
14.0.6 Jun 27, 2022
14.0.5 Jun 13, 2022
14.0.4 Jun 03, 2022
14.0.3 May 05, 2022
14.0.1 Apr 13, 2022
14.0.0 Apr 11, 2022
13.0.1.1 May 05, 2022
13.0.1 Feb 17, 2022
13.0.0 Oct 01, 2021
12.0.1.2 May 05, 2022
12.0.1.1 Feb 17, 2022
12.0.1 Sep 27, 2021
11.1.0.2 May 05, 2022
11.1.0.1 Feb 17, 2022
11.1.0 Sep 27, 2021
11.0.1.2 May 05, 2022
11.0.1.1 Feb 17, 2022
11.0.1 Sep 27, 2021
10.0.1.1 Feb 17, 2022
10.0.1 Sep 27, 2021
9.0.0 Nov 20, 2019
8.0.1 Nov 20, 2019
7.1.0 Nov 09, 2019
6.0.1 Nov 04, 2019

Wheel compatibility matrix

Platform Python 2 Python 3
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux_2_26_aarch64
manylinux_2_26_i686
manylinux_2_26_ppc64le
manylinux_2_26_s390x
manylinux_2_27_x86_64
manylinux_2_28_aarch64
manylinux_2_28_i686
manylinux_2_28_ppc64le
manylinux_2_28_s390x
manylinux_2_28_x86_64
manylinux_2_31_armv7l
musllinux_1_2_aarch64
musllinux_1_2_armv7l
musllinux_1_2_i686
musllinux_1_2_ppc64le
musllinux_1_2_s390x
musllinux_1_2_x86_64
win32
win_amd64
win_arm64

Files in release

No dependencies