Skip to main content

Clang-Format is an LLVM-based code formatting tool

Project description

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: v18.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:

On manual triggers, the following input variables are available:

  • use_qemu: Whether to build targets that require emulation (default: true)
  • llvm_version: Override the LLVM version (default: "")
  • wheel_version: Override the wheel packaging version (default "0")
  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clang_format-18.1.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distributions

clang_format-18.1.2-py2.py3-none-win_amd64.whl (1.4 MB view details)

Uploaded Python 2 Python 3 Windows x86-64

clang_format-18.1.2-py2.py3-none-win32.whl (1.2 MB view details)

Uploaded Python 2 Python 3 Windows x86

clang_format-18.1.2-py2.py3-none-musllinux_1_1_x86_64.whl (2.2 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ x86-64

clang_format-18.1.2-py2.py3-none-musllinux_1_1_s390x.whl (2.2 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ s390x

clang_format-18.1.2-py2.py3-none-musllinux_1_1_ppc64le.whl (2.5 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ ppc64le

clang_format-18.1.2-py2.py3-none-musllinux_1_1_i686.whl (2.4 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ i686

clang_format-18.1.2-py2.py3-none-musllinux_1_1_aarch64.whl (2.2 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ ARM64

clang_format-18.1.2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ x86-64

clang_format-18.1.2-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.7 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ s390x

clang_format-18.1.2-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (2.6 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ ppc64le

clang_format-18.1.2-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.9 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ i686

clang_format-18.1.2-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ ARM64

clang_format-18.1.2-py2.py3-none-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded Python 2 Python 3 macOS 11.0+ ARM64

clang_format-18.1.2-py2.py3-none-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded Python 2 Python 3 macOS 10.9+ x86-64

File details

Details for the file clang_format-18.1.2.tar.gz.

File metadata

  • Download URL: clang_format-18.1.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for clang_format-18.1.2.tar.gz
Algorithm Hash digest
SHA256 6605bd4f2719bd38fd02c8e7f2d3fbfa04eb5734dada9f444d2bd15ac167180f
MD5 3c1051974644cced1bae0f696379fc9b
BLAKE2b-256 8d33db0c76ee90947033d9bb14e4b724b6346f9b23957d00ecf7357c4df3796b

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0256bbefe62431dbeb1c8fb35013e188d908771b1a04f6e8e115043fc00845bc
MD5 8934c3eb002b929a1fe7a7eed36a64f4
BLAKE2b-256 148b6a22c123a9bbcd9c5771ffb06ae4ed5c2196a37328c34756c642629fdbd8

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-win32.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 c2c00e1d85d82f2ce071a9e347079355937c728ffdd8f98d133227cf048ae03b
MD5 f487ec42f14fb67dc5539ac90d7bc33d
BLAKE2b-256 aad02336b2620abfb698d1d15cfae82fddc8cb079e07a6a2d24b28be061aabd1

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c5fa4983ff1798c2dca1356497ca3417b50ba0867fe3023f779c6517b8a29dfe
MD5 0c104de29b6cba4a6082ae11e897d56d
BLAKE2b-256 9591fb8320d2a0eac943822821a0fd28cda892d1cbd082d5db2418b86f3cf0a8

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-musllinux_1_1_s390x.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-musllinux_1_1_s390x.whl
Algorithm Hash digest
SHA256 c393115242112e93950ba0c63f546e7ca524200feb97e99a17be369e53210543
MD5 b4db25f562c2a69e8b366e211c0194f2
BLAKE2b-256 9f3cc86fcdf3431bb35bf9848c838b4dd9a3578bb16b12650f6fff5410b78e42

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-musllinux_1_1_ppc64le.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-musllinux_1_1_ppc64le.whl
Algorithm Hash digest
SHA256 fe2b5784d7ae5e4ab1af624ae0d8ce53192f087103686e14e539b6d8ddbe5345
MD5 97b59c522ca5558cb1a14fc5c72387d1
BLAKE2b-256 aa0b0b1a2892f5300ea79c09c00e5693e91f60079ee6d2a871f5c0f3bced1ada

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 d59b2dfa80340abb3a31f8a8ba8b77094d29827a924485b6811bea209c00348b
MD5 067cedd5fde242cd7a4e6e8c2ee6611f
BLAKE2b-256 37e8fc6f14819201ed1931c7ad378a37c219ffa0d914a641c01641c0497c4c05

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 882758e41ab477fa56d612fb5cc644e2ca0d01339a9e9475f905b5e2607f807d
MD5 a85e8daa13592ae4c9ba65251eb4ba08
BLAKE2b-256 677860904906244501ad73f6ab9fbcd089f68f45e331b83a0812f2ba37e3ef4d

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f007e5822ef0b36f7c9f32ef8babcea91496626417779f4501b7f6d1316d0c4b
MD5 992e3152c9dbd5e4360fae1d1f6d1f80
BLAKE2b-256 1b7c62854546ada7053dba03168e715d2e0dffcebd7b9035174450325956796c

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 8a5e2adbd28ddc48fff449a9daf1c144b39ed7d29c548d236ce7f85ecc2f1cfa
MD5 52864c6d8fc5ebec15fd38396a9599d4
BLAKE2b-256 74090299905a584d767d893d8d3aa1d3e5b8cacb4c5dbd319e90e3ad2f76f98a

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 165d0535fe4e44fc0ddcefe7f9098ecb60ef687cccd18d00a3f0b9ec46831a6c
MD5 88e7ad67bb998d47c5f94f52ad5cc959
BLAKE2b-256 5739d7c90281eb6f441ad7848287763a9cc2ebd621bc1871d4d558334f30c41f

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 68a7d52115770f372cf65b40f6eccf3dc2d5248e0765ac2d34cd99415482fd58
MD5 ec56abbfdc15fb1c2a9d44b4eb5dd310
BLAKE2b-256 6a34c9dc34035754be8d6b37a2ede04da425f1b32176a0b495bd3fcee6b22fd3

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc5b243ab728eab7d53a2c5d41ed09124b4361cf844f8ddb0f7defbab5349874
MD5 a24c9f3e8779fb3b7c2367f2489d82af
BLAKE2b-256 e451f6a059eb0066489c3489dbc9cc22d86b9c7465c785e77aa059e555628986

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c1e08af1ac6de95fdbcd1fc0e9676d1c1dd61f9980b2cf6370a5ae73a5147f7
MD5 0d6dfa994660788cd5f9b7b25981be0d
BLAKE2b-256 e8e49e6b5934a20231c3778e083e95dc06ccf284a0d0814205041d7ac6f2ffe3

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-18.1.2-py2.py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for clang_format-18.1.2-py2.py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b8ff2eaf11e33c121076c7a37dcf4db1d812276a0c3e8b730f8d75a1a93a3eae
MD5 1e9f29b6d220549b4df0b7909f200653
BLAKE2b-256 56403d3a06d8cad939b578cde4e17cd3050ae98256a91eca623352fa520b12c1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page