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: v15.0.4
  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-15.0.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distributions

clang_format-15.0.4-py2.py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 2 Python 3 Windows x86-64

clang_format-15.0.4-py2.py3-none-win32.whl (1.1 MB view details)

Uploaded Python 2 Python 3 Windows x86

clang_format-15.0.4-py2.py3-none-musllinux_1_1_x86_64.whl (2.1 MB view details)

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

clang_format-15.0.4-py2.py3-none-musllinux_1_1_i686.whl (2.2 MB view details)

Uploaded Python 2 Python 3 musllinux: musl 1.1+ i686

clang_format-15.0.4-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

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

clang_format-15.0.4-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ i686

clang_format-15.0.4-py2.py3-none-macosx_10_9_universal2.whl (1.3 MB view details)

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

File details

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

File metadata

  • Download URL: clang-format-15.0.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for clang-format-15.0.4.tar.gz
Algorithm Hash digest
SHA256 29ec4c30226398cc4c78417cca380d5d2f9bfd3aa234eb9d6fe2c9bc605183cb
MD5 1b7ee70cdfbe1edb3acc43c939955624
BLAKE2b-256 313d83a35768932c398476595509812aae58b352a7052909dab1e2a941fb89f2

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 ad265649a6eebf8c5c0d9b3f09fe49c335f1e4a7f14465019fad0766903450cb
MD5 8a9221242e22a2a64be7c0d9513e7ebf
BLAKE2b-256 af021a124e47735968fba40fa6f4e59c3a024ef3a8bb915bedadb460079aa0ea

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 83e8a112588ebbc9e11028ea65ca9034ac8a931f02d101c7e10f73ca3d211f18
MD5 26a61641f91f775cc8935e6fe0d22690
BLAKE2b-256 2d7c45a97681a715962daa1833a28fadf3a696eeba34cf8f4e819b9d303aa942

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 715f1de800ebc00a5073c23e0e26d29233b9586921478bacedfb34015f0aa034
MD5 2a41a980b1f8ac233c34479a2be267f0
BLAKE2b-256 a64ffc140276652c90b4e20c795f65e401673565e8424237f61aca8696d2ce94

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 357b0641c7c4c15bf72706323baa484def57593720dee2d58f1c429e122c9990
MD5 173171f96046bc9965e3a50d52ac0214
BLAKE2b-256 020f8f91f66de83c7b7f8b7b9547a3dc99012d5a9bd50dba81437fb0aa6fa8e4

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adc2f1fa2cc8ffcb55a51eac0c380bbe519a8cf256196eb39dc1fe69b74c0910
MD5 0729d698687dc9bc2099aaa2490af243
BLAKE2b-256 f9736b9418f5edba26adad5c3fedee62711a705ec592d52cdd15cee68aa67027

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6ae3cbf9a13afd957b99615ef466d085f675f719a2a035454d858646e328e7c5
MD5 76205991072d51e34dcb8e70cdd0f3ad
BLAKE2b-256 9022d9748e66acc9da69f7ecbeacaa7f226e7f0cdd39e5b6ae8a9c20eb11e137

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.4-py2.py3-none-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 32d2d0927d229418c0d8135fa266cb58ff1c482e15a0b0152d98fd74be156289
MD5 8031540a56c55fef3a6818aaa5ea8781
BLAKE2b-256 974f4855a57fa5bc73d8f340df7a1f206548a56737d39ec0fc46b7ff61aa570f

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