clang
libclang python bindings
Decision gist · record as of 2026-08-14
Yes, if you need programmatic C/C++ code analysis in Python and have libclang available on your system. The package is stable and permissively licensed, but verify that your system has libclang installed and that the binding supports your Python version before committing to it. Maintenance is aging, so expect infrequent updates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires libclang system library to be installed separately; the package contains only Python bindings.
- Low install friction with a pure-Python wheel.
- Last release was 239 days ago; maintenance status is aging, suggesting infrequent updates.
License · maintenance · safety
Apache-2.0 with LLVM exception (permissive) — Licensed under Apache-2.0 with LLVM exception, a permissive license that permits commercial and private use with minimal restrictions.
last release 2025-12-18 (239 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,123,027 downloads/mo, #4,331 on PyPI
Alternatives
Verify before relying
pip install clang==21.1.7
import clang.cindex
clang.cindex.conf.set_library_file('/path/to/libclang.so')
index = clang.cindex.Index.create()
tu = index.parse('file.c')- Exact Python version compatibility (requires_python is unspecified in metadata)
- Whether the bindings support the full libclang API surface or a subset
- How to locate or configure libclang on different operating systems
What it is and what it does
Clang is a Python wrapper around LLVM's libclang library, providing direct access to clang's C/C++ parsing and analysis capabilities. It exposes libclang's API as Python objects, letting you build tools that understand C and C++ code structure without reimplementing a parser. The package contains only the Python bindings—you must have libclang installed separately on your system for it to work.
Typical use cases include static analysis tools, code refactoring scripts, IDE plugins, and compiler-adjacent utilities that need to inspect or manipulate C/C++ source code. Since it wraps the official LLVM bindings, it stays aligned with clang's evolution, though updates are infrequent.
Use it for
- Build static analysis tools that inspect C/C++ code structure and semantics without parsing from scratch
- Write code refactoring or transformation scripts that need to understand and modify C/C++ source files
- Develop IDE plugins or language servers that require accurate C/C++ parsing and symbol resolution
- Analyze codebases to extract metrics, dependencies, or API surfaces from compiled C/C++ projects
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need programmatic C/C++ code analysis in Python and have libclang available on your system.
The package is stable and permissively licensed, but verify that your system has libclang installed and that the binding supports your Python version before committing to it. Maintenance is aging, so expect infrequent updates.
Install
clang on PyPI
Before you install
Low install friction with a pure-Python wheel. Last release was 239 days ago; maintenance status is aging, suggesting infrequent updates.
Requires libclang system library to be installed separately; the package contains only Python bindings.
License in practice
Licensed under Apache-2.0 with LLVM exception, a permissive license that permits commercial and private use with minimal restrictions.
Quickstart
pip install clang==21.1.7
import clang.cindex
clang.cindex.conf.set_library_file('/path/to/libclang.so')
index = clang.cindex.Index.create()
tu = index.parse('file.c')
Verify before relying
- Exact Python version compatibility (requires_python is unspecified in metadata)
- Whether the bindings support the full libclang API surface or a subset
- How to locate or configure libclang on different operating systems
Package facts
| License | Apache-2.0 with LLVM exception permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 239 days since the last release |
| First released | |
| Downloads | 1,123,027 / month, #4,331 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 LicenseProgramming Language :: Python :: 3Topic :: Software Development :: Compilers |
Evidence: clang-21.1.7-py3-none-any.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 c++ code analysis”
- clangProvides Python bindings to libclang, allowing you to…
- scan-buildRuns the Clang static analyzer on C/C++ projects using a compilation…
- libclangProvides Python bindings to Clang's C API, bundled with prebuilt…
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 libclang · cppyy-cling · clangd-tidy · ziglang · clang-tidy · clang-format · swig · scan-build · lit