clang-format
Clang-Format is an LLVM-based code formatting tool
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-formatuv
uv add clang-formatpoetry
poetry add clang-formatInstalling 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
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
clang-tidyPackages the clang-tidy C++ linter and related…
permissive · top 15,000 on PyPI
shfmt-pyProvides a Python-installable wrapper that…
permissive · top 15,000 on PyPI
cppyy-clingProvides Cling, an LLVM-based interactive C++…
copyleft · top 15,000 on PyPI
llvm-testing-toolsProvides LLVM testing utilities like FileCheck…
unclear · top 15,000 on PyPI
clangProvides Python bindings to libclang, allowing…
permissive · top 5,000 on PyPI
cmakeDistributes CMake 4.4.2 as a Python package,…
permissive · top 5,000 on PyPI
scikit-buildscikit-build bridges setuptools and CMake to…
permissive · top 5,000 on PyPI
reformat-gherkinAutomatically formats Gherkin feature files to…
permissive · top 15,000 on PyPI
pre-commit-uvIntegrates uv as the virtual environment and…
permissive · top 15,000 on PyPI
clangd-tidyclangd-tidy wraps clangd to provide faster…
permissive · top 15,000 on PyPI