--- id: cxxheaderparser version: "1.9.2" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # cxxheaderparser — Modern C++ header parser License: permissive · Maintenance: active · Downloads: 365.7K/mo ## What it is and what it does cxxheaderparser is a pure-Python C++ header parser designed to extract structural information from C++ headers for use in binding generators and code analysis tools. It parses syntactically valid C++ including modern features (C++11 and beyond) and produces either a visitor-style interface for custom processing or a simple data structure containing all parsed elements. The parser does not produce a full AST, does not validate C++ correctness, and requires preprocessed input if macros are present—it trades completeness for practicality, aiming to handle common C++ patterns while acknowledging it may struggle with obscure or overly complex constructs. The package is a rewrite of CppHeaderParser, designed to provide a cleaner, documented API and better support for modern C++ features. It ships with a command-line interface for dumping parsed headers in multiple formats (pprint, JSON, dataclasses repr) and is actively maintained with support for Python 3.6+. Use it for: - Generate language bindings for C++ libraries by extracting function and class signatures from headers - Analyze C++ codebases to build documentation or dependency graphs without invoking a compiler - Extract type information and method signatures for IDE integration or code generation tools - Preprocess and parse C++ headers in build systems where full compilation is not feasible ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses C++ header files into Python data structures, extracting class definitions, functions, and modern C++ constructs without requiring a full AST or compiler validation. Yes, if you need to parse C++ headers for binding generation or code analysis. Low install friction, active maintenance, no security issues, and permissive licensing make it a practical choice. Caveat: not suitable if you need full AST semantics, C++ validation, or comprehensive C++17/20 support—use Clang or a compiler for those cases. ## Install pip install cxxheaderparser uv add cxxheaderparser poetry add cxxheaderparser ## Installing cxxheaderparser Before you install: Low friction: pure Python wheel with only dataclasses as a runtime dependency (built-in for Python 3.7+). Active maintenance with a release 25 days ago. License in practice: BSD-3-Clause permissive license allows commercial and private use with attribution; no restrictions on derivative works or distribution. Quickstart: pip install cxxheaderparser from cxxheaderparser import parse_file header_data = parse_file('myheader.h') print(header_data.classes, header_data.functions) Requires a C++ preprocessor if input headers contain macros; use pcpp, GCC, or MSVC preprocessing before parsing, or enable preprocessor support via cxxheaderparser.preprocessor module. Verify before relying: - Whether the package handles all C++17/20 constructs or only a subset (description notes not all are supported yet) - Performance characteristics when parsing very large or deeply nested header files - Accuracy of binding-generator output for complex template specializations ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 365.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags C++ header parser python, parse C++ headers, C++ binding generator, extract C++ declarations, C++ code analysis python, C++ header analysis, C++ to python bindings, c++-parsing, binding-generation, code-analysis [View on SkillFed](https://skillfed.io/packages/cxxheaderparser) · [View on PyPI](https://pypi.org/project/cxxheaderparser/)