cxxheaderparser
Modern C++ header parser
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- 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.
- 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 · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause permissive license allows commercial and private use with attribution; no restrictions on derivative works or distribution.
last release 2026-07-20 (25 days) · last repo commit 2026-07-20 · 153 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 365,721 downloads/mo, #7,207 on PyPI
Alternatives
Verify before relying
pip install cxxheaderparser
from cxxheaderparser import parse_file
header_data = parse_file('myheader.h')
print(header_data.classes, header_data.functions)- 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
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 on this page. Verify before relying on it.
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
cxxheaderparser on PyPI
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.
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.
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)
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 the current Python release >=3.6 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedataclasses |
| Maintenance | Actively maintained 25 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 365,721 / month, #7,207 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: C++Programming Language :: PythonProgramming Language :: Python :: 3Topic :: Software DevelopmentTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Compilers |
Evidence: cxxheaderparser-1.9.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “parse C++ headers”
- cxxheaderparserParses C++ header files into Python data structures, extracting class…
- pyrfc6266Parses RFC 6266 Content-Disposition headers to extract filename and…
- eml-parserParses EML (email) files and extracts structured information…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also pycparser · tree-sitter-cpp · CppHeaderParser · cppclean · pcpp · ctypesgen · pybind11-global · pyclibrary · pybind11 · PyBindGen