Installation¶
Recommended Installation¶
Install autopxd2:
autopxd2 uses headerkit, which vendors LLVM clang Python bindings for LLVM 18–23 directly. There is no need to install a separate clang2 or clang Python package.
You only need the system libclang shared library (libclang.so, libclang.dylib, or libclang.dll).
Automatic libclang Installation¶
HeaderKit provides a built-in installer to automatically download and set up libclang for your platform:
Without LLVM: the tree-sitter Backend¶
If you cannot install a system libclang, install the treesitter extra instead:
Then pass --backend tree-sitter:
This backend parses only the file you give it: it does not follow #include
directives, does not extract #define macros, does not detect system include
paths, and rejects --std and --clang-arg. See Parser Backends.
System Package Managers¶
Alternatively, you can install LLVM / libclang using your system's package manager:
macOS¶
Ubuntu / Debian¶
Alpine Linux / musl¶
Fedora / RHEL¶
Windows¶
- Install LLVM from releases.llvm.org or via
winget install LLVM.LLVM - Ensure the LLVM
bindirectory is in yourPATH
Headless CI & Build Containers (cibuildwheel, Docker)¶
In minimal Docker containers or CI build environments (such as Alpine/musllinux, manylinux, or slim Debian images) where libclang is not present, you can:
- Install
libclangin the container: - Alpine / musllinux:
apk add clang-dev - Debian / Ubuntu:
apt-get install -y libclang-dev - RHEL / manylinux:
dnf install -y clang-devel
(For example, in cibuildwheel config in pyproject.toml:)
- Or use the Tree-sitter backend (no system packages required):
Declare
autopxd2[treesitter]in your build dependencies: and pass--backend tree-sitterin your build script (e.g.meson.build).
Development Installation¶
For development, clone the repository and install with development dependencies:
Docker (No Installation Required)¶
Use the Docker image for pre-configured libclang support without installing anything on your host system:
See Docker Usage for more details.
Verifying Installation¶
Check that autopxd2 can find libclang:
If libclang is installed correctly, you will see:
Available backends:
libclang Full C/C++ support via LLVM [available] (default)
tree-sitter Fast C/C++ parsing without system LLVM dependencies [available]
Default: libclang
The tree-sitter line appears once the treesitter extra is installed; it is listed
as unavailable otherwise.