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.0
  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 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.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Python 2 Python 3 Windows x86-64

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

Uploaded Python 2 Python 3 Windows x86

clang_format-18.1.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0.tar.gz.

File metadata

  • Download URL: clang-format-18.1.0.tar.gz
  • Upload date:
  • Size: 9.6 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.0.tar.gz
Algorithm Hash digest
SHA256 0b92fe203c28fda45078b977f003ad715a57e1c3feb98e7daa20619a0da74363
MD5 2b02567983cc9a01b0ce763ee09eac0c
BLAKE2b-256 95001267b62bb51776c3477437300cdd28bb23195531961cb8835ebaedd9a81e

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b998ee5e486e9251badc18dadcffbdeed54a93ee8c25e72f4cbf49abcfd31c97
MD5 f4c4968cb79a288f73621f32506df55c
BLAKE2b-256 d5182df9ddf91f7e930b67d84e9f9043381b9a59415d7cf2225f71d5793e83be

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 e503acd8940038de2972714eac8e4b0f1f9d2ad979844fc073658adcadbca3eb
MD5 1242b4435956ec879a2d2fef88838c0e
BLAKE2b-256 8ce6d6ee73620e12cf8966fb27d0c48f688bf14b6b8a4f201162053c565cc3c8

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a155484eef592256de365813078618da41152e08e8490a18adab514ec74f9e5e
MD5 5d65a831cb8fcdd0dabd409f5e50fd3b
BLAKE2b-256 944f9c01a7fd6c7f4fbbc5b8afd84f8b67b95b2f9e49cf889d81cfbbf64c2929

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-musllinux_1_1_s390x.whl
Algorithm Hash digest
SHA256 0d3c9782d1ba57a839373702bd0a723ad2f3e057bcb9f46419c7d1b388e92c8f
MD5 92ef3fd0351e61faeb90355619179c0f
BLAKE2b-256 5a86acb00253a914f881389781c15ea743d95e30998e467115d8666fe6b00959

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-musllinux_1_1_ppc64le.whl
Algorithm Hash digest
SHA256 5aab358811018144206563fcf8686c9907806405e279738c33c5ce53ce70cd42
MD5 6c65497b008d1169ff2224fb0bcf7c04
BLAKE2b-256 d4983d6f5feca0ed55561b38201fc2c2ffd5c30f489bf2645838001a9cbe0307

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 aff56678c13982332b5f0863002e0f0e90290c55e30a750dd12f3ab044fb2d34
MD5 9b37a85c603ddf002338c7e828aca157
BLAKE2b-256 e4e166a4cdf48f1c052bd47bea4dfb83bfb0af878b08b3fca50b454d34040963

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 e27bd06e57598ee9d4dae73ffbd44ac8af151981e62f261d3ecd0250d2516ff4
MD5 19311644ec3ec652ef52815e2dfbf4b8
BLAKE2b-256 f5172ea0cf3dbd5aa8f6c29135b66f72b7f682a396d69ddbb2b9204f6c27171a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b3ab6dd9c7a3f22b2f1e5da0eada2afdcb9635875a0770dd92e4bd9ee29db07
MD5 0bf9c3fddf8b35c59fd4af581ae34f26
BLAKE2b-256 6e533bf609363915844dad4a12fce50f6bb7a4b41e610b9063354f5a4fa70318

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 3e32e56c9ee0ade40c87e423f29c14308719a4b2a7e404fc29d8656fe6b5a256
MD5 f2045535996be9dcbadd43a344409adb
BLAKE2b-256 5ea9b353090eb69728bf6753a182701aa9669ec59fc4db0c620f3250c69e582a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ea21827f84c4360077d8fc99216022d0628c8dbebab1dce5c855dd702485765f
MD5 b02c97b318c8ec1b81826568efc03a27
BLAKE2b-256 e58a6e06171bf1065bd4b6eb58f576ca733d7d67349c717fa0eed7d0e3ca1744

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 01faf25df9e93511f87a956dffb020ee675ce75b1b5d57f49fd3335943059581
MD5 8446f33b7a7df09bfaeb4b9f33aa08db
BLAKE2b-256 02194199b3de32d2621ab00755f259c1facd0c6d576f7c0cd22cdfb8d8050258

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c4149a0e6c5970882d97102b6917801e7b0998dc4f1902848ddeaeb799f406fa
MD5 40e91aeccb7875b0489ccb4b49ab2fc0
BLAKE2b-256 21a01f1d20420d980fa8991a3bbe68c54f4b1637e03d2e21c95c95969dfe389b

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9663fa55317062c36349622d2dc6f7e5a153c2fd4a3ba3001fb9c7aeb3127174
MD5 0eeac346f2ad0c92e80c78f8327f27e4
BLAKE2b-256 460a85c73b6a00fbf2cc50b67dad19e28213e04f3c8f61bc4583d4fc673a6375

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-18.1.0-py2.py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 93c219eb7604bc6d1f83a278234d8421bf90b9f3f23a8381b065b052c4b72ce1
MD5 a95000d2e2db00b6f5844f8e863ea8ae
BLAKE2b-256 3997bb79ceef17d14c571be036a02c151962f5f38e30599d336ef01ca3e6dfeb

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