CppHeaderParser
Parse C++ header files and generate a data structure representing the class
What it is and what it does
CppHeaderParser is a Python library that reads C++ header files and builds a dictionary-like data structure representing their contents. It extracts classes with their public, protected, and private methods and properties; namespaces and nested classes; free functions; preprocessor defines; and include directives. It also parses Doxygen-style documentation comments attached to methods and properties.
The package uses PLY (Python Lex-Yacc) to tokenize and parse C++ syntax. It is intended for code generation, documentation extraction, or automated analysis of C++ codebases from Python. However, it has been abandoned since 2016 and does not track modern C++ features. Use it only when you need to extract structure from legacy C++ headers or when no active parser meets your needs.
Use it for:
- Extract class and method signatures from C++ headers for automated code generation or wrapper creation.
- Parse Doxygen documentation from header files to build API documentation programmatically.
- Analyze C++ codebases to gather metrics on class hierarchies, method counts, or namespace organization.
- Generate Python bindings or language bindings for C++ libraries by introspecting header structure.
- Audit or refactor C++ code by extracting public/private method and property inventories.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses C++ header files and extracts their structure—classes, methods, properties, namespaces, and free functions—into a Python data structure for programmatic inspection.
No, unless you have a specific legacy codebase or no active alternative. The package is abandoned (last release 2016), has high install friction, and does not support modern C++ syntax. For new projects, use an active C++ parser or AST tool. For existing code depending on it, consider migration.
Install
cppheaderparser on PyPI
pip
pip install cppheaderparseruv
uv add cppheaderparserpoetry
poetry add cppheaderparserInstalling CppHeaderParser
Before you install
High install friction: the package is abandoned (last release 2016-11-22, no commits tracked). No runtime dependencies listed, but the description notes PLY as an external requirement. Maintenance status makes this a legacy choice; use only if no active alternative exists.
License in practice
BSD license (permissive) imposes no significant restrictions on use, modification, or distribution. Suitable for both open-source and proprietary projects.
Quickstart
import CppHeaderParser
try:
cppHeader = CppHeaderParser.CppHeader("example.h")
sampleClass = cppHeader.classes["SampleClass"]
methods = sampleClass["methods"]["public"]
except CppHeaderParser.CppParseError as e:
print(e)
PLY (Python Lex-Yacc) must be installed separately; the package requires a valid C++ header file path and does not handle all C++ syntax variations.
Verify before relying
- Whether PLY is automatically installed as a dependency or must be installed separately.
- Compatibility with modern C++ standards (C++11, C++17, C++20) beyond what the 2016 release supports.
- Whether the parser handles template declarations, constexpr, and other modern C++ features.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,552 days since the last release |
| First released | |
| Downloads | 82,079/month — #14,185 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: CppHeaderParser-2.7.4.tar.gz
Keywords: c++, header, parser, ply
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pyclibraryParses C header files and automates…
permissive · top 15,000 on PyPI
cxxheaderparserParses C++ header files into Python data…
permissive · top 15,000 on PyPI
cppyCppy is a C++ header library that simplifies…
permissive · top 15,000 on PyPI
sipSIP generates Python bindings for C and C++…
permissive · top 15,000 on PyPI
pcppA pure Python implementation of a C99…
permissive · top 15,000 on PyPI
exhaleExhale automatically generates C++ API…
permissive · top 15,000 on PyPI
hogql-parserParses HogQL query expressions and Hog programs…
permissive · top 5,000 on PyPI
pyqirPyQIR generates, parses, and analyzes QIR…
permissive · top 15,000 on PyPI
cppcleancppclean analyzes C++ source code to identify…
permissive · top 15,000 on PyPI
flake8-class-attributes-orderA flake8 extension that enforces a configurable…
permissive · top 15,000 on PyPI