Registry / serialization / cxxheaderparser

cxxheaderparser

JSON →
library1.8.1pypypiunverified

A modern, Python-based parser for C++ header files. It can parse C++ headers into an AST and optionally generate a JSON representation. Version 1.7.0 supports Python >=3.6. Releases are occasional, with active maintenance.

pip install cxxheaderparser
INSTALL
IMPORT
SIG · CXXHEADERPARSER
C
cxxheaderparser
serializationpythonv1.8.1
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.8.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse_file
from cxxheaderparser import parse_file
from cxxheaderparser import parse_file

Parse a simple header string and access parsed functions.

from cxxheaderparser import parse_str code = ''' int add(int a, int b); ''' result = parse_str(code) print(result.namespace.name_qual) print(result.functions[0].name) # 'add'
Debug
Known issues
gotchaThe parser expects valid C++ syntax. Preprocessor macros (#define, #ifdef) are not resolved and may cause parse errors or unexpected AST. Use a preprocessor or pass already-preprocessed code.
fix
Run your code through a preprocessor (e.g., cpp) before parsing, or avoid macro-heavy headers.
affects: all
gotchaThe library does not fully support C++20 concepts, modules, or some newer features. Parsing may fail on modern templates or requires.
fix
Stick to C++17 or earlier for reliable parsing. Consider libclang-based alternatives if full standard support is needed.
affects: all
breakingBetween versions 0.x and 1.x, the API changed significantly. The old `cxxheaderparser.parse` module was restructured into `cxxheaderparser` package with new import paths.
fix
Use `from cxxheaderparser import parse_file` instead of `from cxxheaderparser import parse`.
affects: 0.x -> 1.0.0+
Upgrade
Version history
1.8.1latest on PyPI · released Jun 13, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
18
Resources
cxxheaderparser — pip install cxxheaderparser · libregistry