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

Uploaded Source

Built Distributions

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

Uploaded Python 2 Python 3 Windows x86-64

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

Uploaded Python 2 Python 3 Windows x86

clang_format-15.0.7-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.7-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.7-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.7-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.7-py2.py3-none-macosx_10_9_universal2.whl (2.5 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.7.tar.gz.

File metadata

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

File hashes

Hashes for clang-format-15.0.7.tar.gz
Algorithm Hash digest
SHA256 60954c571394354200912e72ce10454b96016af879771df39d09d605ceaec035
MD5 5bc9b12a0d6a6666e65dc9ad57c9495b
BLAKE2b-256 9af561b4c55df2a3a966ce9c97ccd1cbc81810bfdb562cc8d298d382ed92a983

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3a2712fc3a252aec5196958a97642f2cf637fee34058352e6acfe0d2d3be1965
MD5 58e67c0e039d8c3407bf0d1346d26377
BLAKE2b-256 30e8d43b84e7cf053422cd0cc8788e9b28aff000cd38237c46ef803b1a813adf

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 c5fa1420c08f6293c6dfa90ca137e6e7ac5ee8838e151522816da43f375bc93f
MD5 0cf72a6de329a0a4cb74d37e7864bd27
BLAKE2b-256 056d1052cc33d1dfe76c07033feb21f176feca0d7a98a89cae52405214edbb8a

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 0343cd5f0cf33c3d552ebacbd2604e1a1342163ed7e5cb750c0a1495aae96340
MD5 27c541d518a1646a3195e4dccc202b09
BLAKE2b-256 1c73b2bec18c8c4bfa15ef0a7f4793032c3a07536fdd42e30d245cfd1214da8b

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 a81115f042e59a042e6600d034d15a75dbd2830fae98eb806830380054f49fe7
MD5 6c3114a67f5b431fbf410037291a59f3
BLAKE2b-256 40d3d19eee7328238c74f543e67fa68a986f785e689799030b54372cf4f8fb09

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5a7815754c48cd9ffb14b2f306690f08b8ad8050cc7735c05c6caba046faee3
MD5 3a03731b0b49a89c5866b6ce79a66738
BLAKE2b-256 e2de9afd3245007dac0ac64caec68c27b765ddba2325b261dc01643100dacd93

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6bb879288a08cf646e2930f1f69b197bae90003a6c6abacd7beabed340a9752f
MD5 91cf3332712de1b3055cc660cdafe8ec
BLAKE2b-256 04d3d76f880a779b52a483a6a25a0721b1307a97c1ec54ee270fa808da4806fa

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for clang_format-15.0.7-py2.py3-none-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0983aa108920a84a84358a1a045537311ad77c3fcb60fdec2af0aad71d53bd1d
MD5 e7706bdc52bdcb40fa655c6ef32de073
BLAKE2b-256 8bc588311aa52cb936776f42c246c66a75da21fd9ce2e6058779544dcc316982

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