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: v14.0.1
  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.

Acknowledgments

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

Uploaded Source

Built Distributions

clang_format-14.0.1-py2.py3-none-win_amd64.whl (1.0 MB view details)

Uploaded Python 2 Python 3 Windows x86-64

clang_format-14.0.1-py2.py3-none-win32.whl (833.5 kB view details)

Uploaded Python 2 Python 3 Windows x86

clang_format-14.0.1-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.2 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ s390x

clang_format-14.0.1-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.9 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ ppc64le

clang_format-14.0.1-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ ARM64

clang_format-14.0.1-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.1 MB view details)

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

clang_format-14.0.1-py2.py3-none-manylinux_2_12_i686.manylinux2010_i686.whl (1.3 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.12+ i686

clang_format-14.0.1-py2.py3-none-macosx_10_9_universal2.whl (1.0 MB view details)

Uploaded Python 2 Python 3 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file clang-format-14.0.1.tar.gz.

File metadata

  • Download URL: clang-format-14.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for clang-format-14.0.1.tar.gz
Algorithm Hash digest
SHA256 9966930f6951c3ce64e24a8abae1c130df07feb6da2d132de62e1e3077bcbc54
MD5 07a1aa1177c4f275a750478432f5c530
BLAKE2b-256 d3acb8d6bfa8074bfc581ee326a2b11b97264be2316d55a6c8016f244db0be2f

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 b61c296f0aa8890185ce7bbb123e992ae9b1a12d5b3709af33aff07632d635bb
MD5 e735f44b8b3db9c70cc3ee8d8220ea3f
BLAKE2b-256 74eebe89dc82806ed1bc6b6e9b3e76f02f76414f320048122a610b7a1c19da54

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 a47dc24f79ed853429405946f899c05776d136b1b3fa71170d763f5a6b4374e5
MD5 ab0ae28e579e6acaea05b560c8aec1a8
BLAKE2b-256 e7c6e0388c1bc153768c900c0855bf1307a7cb5e8ab4d42e6092294c2e727971

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 09e12ca1c6abd5f679febdcf861ac999d5dc88d13e8bbb0007796fd120536a4e
MD5 487fdba67718bdb1bd90c97cbae9263b
BLAKE2b-256 b6e68ac20e53fd1f298eacbe36faaad7d8393cfe260d2ca8e65a492546d50b6e

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6f0bb21450f853e10032f8b14f2a44ca1ac29cd5bf160fcd847931b843330256
MD5 f79a9edbe1eaba94f5ebba2d88866fa8
BLAKE2b-256 ec63a2fc6c4ef7fbed5cd6d99faa267f80fcdb67e058ac93d0b8dcb9aeb66470

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0dd7a3262491609d53b60c00255acd276cb47ae4b9d16bbd12d8ae56e0a0fcbc
MD5 a113a29ac537d8e5b5f6b7121b31d4cb
BLAKE2b-256 fef4283e525aff15087a5802b2c9966e89bf3628d0d789a013c521c5450d2976

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-14.0.1-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9ed34d6e7106fd9c26612c3510af6bc92013424b103773782880390477aba63d
MD5 fbc427ba9a8f550b374a7b961d36a355
BLAKE2b-256 19d5bd717df94b3a9bbb6fe9efd2bcabe12e580fcc1a01f418c11538a0657397

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-14.0.1-py2.py3-none-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 2e7dc9b2016b68e475b52c08290fb8767210017af7ca2e918702ace1e2f9c7ea
MD5 563148afe207341d35335baedb6088c9
BLAKE2b-256 4e4192d7ad1f3a075a52c8217119140c29f3d71560038d47a48511994bacea36

See more details on using hashes here.

Provenance

File details

Details for the file clang_format-14.0.1-py2.py3-none-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for clang_format-14.0.1-py2.py3-none-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5141ee7336e45e32db2f7f3b4a761f1a32bbcad6de65189f75951b884a0cb051
MD5 cc33fab6746f7c6301f4b10f429df78c
BLAKE2b-256 607f16f8a6b704336e44fdea7b9e8a597cd36bdc85980b3ee9bbf5acc874141c

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