--- id: clang version: "21.1.7" license: Apache-2.0 with LLVM exception license_treatment: permissive maintenance: aging --- # clang — libclang python bindings License: permissive · Maintenance: aging · Downloads: 1.1M/mo ## 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 above — verify before relying. Provides Python bindings to libclang, allowing you to programmatically parse, analyze, and interact with C and C++ code through LLVM's clang compiler infrastructure. 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 pip install clang uv add clang poetry add clang ## Installing clang Before you install: Low install friction with a pure-Python wheel. Last release was 239 days ago; maintenance status is aging, suggesting infrequent updates. 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') Requires libclang system library to be installed separately; the package contains only Python bindings. 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: unspecified - Install friction: low - Maintenance: aging - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags libclang python bindings, clang c++ code analysis, llvm python interface, parse c code programmatically, clang ast python, code-analysis, llvm, c-cpp [View on SkillFed](https://skillfed.io/packages/clang) · [View on PyPI](https://pypi.org/project/clang/)