libclang
Clang Python Bindings, mirrored from the official LLVM repo: https://github.com/llvm/llvm-project/tree/main/clang/bindings/python, to make the installation process easier.
Decision gist · record as of 2026-08-14
Yes, if you need Python-based access to Clang's parsing and analysis capabilities without installing LLVM separately. The package is production-stable, permissively licensed, and widely used (top 5000 PyPI packages). Dormant maintenance is a minor concern, but the February 2025 commit and zero known vulnerabilities suggest it remains functional. Install friction is medium due to platform-specific wheels, but this is typical for packages bundling native libraries.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- The bundled libclang is platform-specific; ensure your OS and architecture match one of the distributed wheels (macOS arm64/x86_64, Windows amd64/arm64, Linux x86_64/aarch64/armv7l, or musllinux x86_64).
- Medium install friction due to platform-specific wheel distributions; the package is dormant (880 days since last release) but remains in production status with a recent repository commit in February 2025, suggesting minimal but active maintenance.
License · maintenance · safety
Apache License 2.0 (permissive) — Licensed under Apache License 2.0, a permissive license that allows commercial and private use with minimal restrictions; derivative works and modifications are permitted provided the license and copyright notice are retained.
last release 2024-03-17 (880 days) · last repo commit 2025-02-03 · 102 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 14,104,820 downloads/mo, #1,246 on PyPI
Alternatives
Verify before relying
pip install libclang
import clang.cindex
index = clang.cindex.Index.create()
tu = index.parse('file.c')- Whether the bundled libclang version 18.1.1 is compatible with all supported Python versions (2.7 through 3.12) in practice.
- Performance characteristics and memory overhead compared to using system-installed LLVM.
- Specific use cases or limitations when parsing C++ code versus C.
- Whether library_path configuration is required for the bundled native library to be located automatically.
What it is and what it does
libclang is a Python wrapper around Clang's C API, distributed with prebuilt libclang shared libraries to avoid requiring a full LLVM installation. It exposes Python bindings that allow code to parse C and C++ source files, inspect their abstract syntax trees, and access semantic information like type definitions and symbol locations. The package bundles static-linked libclang binaries for multiple platforms, making it straightforward to install via pip without manual LLVM setup.
The package is maintained as a mirror of the official LLVM Python bindings, with packaging and distribution infrastructure added to make it pip-installable. It targets developers who need programmatic access to Clang's parsing and analysis capabilities—such as code generators, linters, refactoring tools, or static analysis frameworks—without the overhead of managing LLVM toolchain installation.
Use it for
- Build code analysis and linting tools that need to parse and inspect C/C++ source files programmatically.
- Generate bindings or wrapper code from C/C++ headers by inspecting their AST structure.
- Implement custom static analysis or code transformation passes on C/C++ codebases.
- Extract symbol information, type definitions, or documentation from C/C++ source for IDE or documentation generation.
- Automate refactoring or code migration tasks that require understanding C/C++ syntax and semantics.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need Python-based access to Clang's parsing and analysis capabilities without installing LLVM separately.
The package is production-stable, permissively licensed, and widely used (top 5000 PyPI packages). Dormant maintenance is a minor concern, but the February 2025 commit and zero known vulnerabilities suggest it remains functional. Install friction is medium due to platform-specific wheels, but this is typical for packages bundling native libraries.
Install
libclang on PyPI
Before you install
Medium install friction due to platform-specific wheel distributions; the package is dormant (880 days since last release) but remains in production status with a recent repository commit in February 2025, suggesting minimal but active maintenance.
The bundled libclang is platform-specific; ensure your OS and architecture match one of the distributed wheels (macOS arm64/x86_64, Windows amd64/arm64, Linux x86_64/aarch64/armv7l, or musllinux x86_64).
License in practice
Licensed under Apache License 2.0, a permissive license that allows commercial and private use with minimal restrictions; derivative works and modifications are permitted provided the license and copyright notice are retained.
Quickstart
pip install libclang
import clang.cindex
index = clang.cindex.Index.create()
tu = index.parse('file.c')
Verify before relying
- Whether the bundled libclang version 18.1.1 is compatible with all supported Python versions (2.7 through 3.12) in practice.
- Performance characteristics and memory overhead compared to using system-installed LLVM.
- Specific use cases or limitations when parsing C++ code versus C.
- Whether library_path configuration is required for the bundled native library to be located automatically.
Package facts
| License | Apache License 2.0 permissive |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 880 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 14,104,820 / month, #1,246 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Compilers |
Evidence: libclang-18.1.1-1-py2.py3-none-macosx_11_0_arm64.whl; libclang-18.1.1-py2.py3-none-macosx_10_9_x86_64.whl; libclang-18.1.1-py2.py3-none-macosx_11_0_arm64.whl; libclang-18.1.1-py2.py3-none-manylinux2010_x86_64.whl; libclang-18.1.1-py2.py3-none-manylinux2014_aarch64.whl; libclang-18.1.1-py2.py3-none-manylinux2014_armv7l.whl; libclang-18.1.1-py2.py3-none-musllinux_1_2_x86_64.whl; libclang-18.1.1-py2.py3-none-win_amd64.whl; libclang-18.1.1-py2.py3-none-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “clang python bindings”
- libclangProvides Python bindings to Clang's C API, bundled with prebuilt…
- clangProvides Python bindings to libclang, allowing you to…
- scan-buildRuns the Clang static analyzer on C/C++ projects using a compilation…
Give your agent the search over MCP, or paste the wish link into any chat.
More Compilers packages
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
Cython is a source code translator that compiles Python code to C, enabling optional static typing and direct C/C++ interoperability to generate efficient native extensions.
Install it if you need to optimize Python performance, wrap C/C++ libraries, or build fast native extensions.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
Numba is a just-in-time compiler that accelerates numerically-focused Python code by compiling it to machine code via LLVM, with support for NumPy functions, loop parallelization, and GPU code generation.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
llvmlite provides a lightweight Python binding to LLVM's IR builder, optimizer, and JIT compiler APIs, enabling you to write JIT compilers and code generators without needing the full LLVM C++ API surface.
See also clang · clang-tidy · clang-format · clangd-tidy · amalgam-lang · llvm-testing-tools · lit · cppyy-cling · pyclang