skillfed

clang-format

Clang-Format is an LLVM-based code formatting tool

clang-format v22.1.8 4.3M downloads/30d#2,333 on PyPI39,797
Permissive license Apache 2.0 Active released

What it is and what it does

clang-format is a Python distribution of the LLVM clang-format utility, which automatically formats C, C++, and CUDA code according to a style guide. Instead of downloading and installing clang-format separately from your system package manager, you can install it directly from PyPI as a Python package, making it easier to pin a specific version and use in CI/CD pipelines or development workflows.

The package provides pre-built binaries for many platforms (Linux on x86_64, ARM, ppc64le, s390x; macOS on Intel and Apple Silicon; Windows on x86 and ARM64). It integrates well with pre-commit hooks and can be run via pipx for one-off invocations without a full installation. The versioning of the package matches the underlying clang-format release, so version 22.1.8 corresponds to LLVM clang-format 22.1.8.

Use it for:

  • Enforce consistent C/C++ code style in CI/CD pipelines by installing a pinned clang-format version without system dependencies
  • Use as a pre-commit hook to automatically format staged C++ files before commit
  • Run clang-format on demand via pipx in GitHub Actions or other CI runners without pre-installation steps
  • Distribute a development environment where all team members use the same clang-format version regardless of OS

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Packages the clang-format code formatter as a Python-installable tool, making it available via pip without requiring separate system installation.

Yes, if you need clang-format in a Python environment or CI pipeline. The package is actively maintained, has no runtime dependencies, carries a permissive license, and offers broad platform support. Install friction is moderate due to platform-specific wheels, but that is expected and handled transparently by pip. No known vulnerabilities.

Install

clang-format on PyPI

pip

pip install clang-format

uv

uv add clang-format

poetry

poetry add clang-format

Installing clang-format

Before you install

Medium install friction due to platform-specific binary wheels for multiple architectures (x86_64, ARM, ppc64le, s390x, and others across Linux, macOS, Windows). Package is actively maintained with a release 34 days ago and no runtime dependencies to manage.

License in practice

Licensed under Apache 2.0 with LLVM exceptions (permissive). Safe for commercial and private use; you may use, modify, and distribute it freely provided you include the license notice.

Quickstart

pip install clang-format
python -m clang_format --help
# Or use with pipx: pipx run clang-format --help

Verify before relying

  • Exact Python version compatibility (requires_python is unspecified in metadata)
  • Whether the package works on Python 2 despite py2 wheel names (modern clang-format may require Python 3)
  • Performance characteristics and formatting rule customization options

Package facts

License Apache 2.0 (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 34 days since the last release
Last repo commit
First released
Downloads 4,314,047/month — #2,333 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: clang_format-22.1.8-py2.py3-none-macosx_10_9_x86_64.whl; clang_format-22.1.8-py2.py3-none-macosx_11_0_arm64.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_26_i686.manylinux_2_28_i686.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_26_s390x.manylinux_2_28_s390x.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; clang_format-22.1.8-py2.py3-none-manylinux_2_31_armv7l.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_aarch64.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_armv7l.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_i686.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_ppc64le.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_s390x.whl; clang_format-22.1.8-py2.py3-none-musllinux_1_2_x86_64.whl; clang_format-22.1.8-py2.py3-none-win32.whl; clang_format-22.1.8-py2.py3-none-win_amd64.whl; clang_format-22.1.8-py2.py3-none-win_arm64.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: CProgramming Language :: C++Topic :: Software Development :: Quality Assurance

Tags

code formatting toolclang-format python packagec++ code formatterautomatic code stylellvm-based formatterinstall clang-format pippre-commit code formatting
code-formattingllvm-basedci-cd-friendly

More Quality Assurance packages