--- id: libclang version: "18.1.1" license: Apache License 2.0 license_treatment: permissive maintenance: dormant --- # 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. License: permissive · Maintenance: dormant · Downloads: 14.1M/mo ## 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 above — verify before relying. Provides Python bindings to Clang's C API, bundled with prebuilt libclang shared libraries for macOS, Windows, and Linux, eliminating the need to install LLVM separately. 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 pip install libclang uv add libclang poetry add libclang ## Installing libclang 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. 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') 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). 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: unspecified - Install friction: medium - Maintenance: dormant - Downloads: 14.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags clang python bindings, libclang bindings, clang c api python, parse c code python, ast parsing clang, llvm python interface, c code analysis python, c-parsing, ast-analysis, code-generation [View on SkillFed](https://skillfed.io/packages/libclang) · [View on PyPI](https://pypi.org/project/libclang/)