pcpp
A C99 preprocessor written in pure Python
Decision gist · record as of 2026-08-14
Yes, if you need C99 preprocessing in a Python environment. The package is stable and dependency-free, making it easy to integrate. However, the 2021 release date and aging maintenance status mean it may not track the latest C standards or receive active bug fixes—suitable for established workflows but verify compatibility with your specific C/C++ code patterns first.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with no runtime dependencies.
- Package is in production/stable status but aging—last release was in 2021, though the repository remains active with recent commits.
License · maintenance · safety
BSD (permissive) — BSD license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
last release 2021-10-29 (1750 days) · last repo commit 2026-01-22 · 251 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 791,555 downloads/mo, #5,046 on PyPI
Alternatives
Verify before relying
pip install pcpp
from pcpp.preprocessor import Preprocessor
prep = Preprocessor()
prep.parse(open('input.h').read())
print(prep.write())- Whether Python 2 support (listed in classifiers) is actively maintained given the 2021 release date
- Current performance characteristics under modern Python versions compared to the stated 0.84x–2.62x range under PyPy
What it is and what it does
pcpp is a C99 preprocessor written entirely in Python, designed to handle C and C++ preprocessing tasks at build or packaging time. It processes #include directives, macro definitions, and conditional compilation blocks, and can output either fully expanded code or partially preprocessed code with selective pass-through of certain directives. The package is useful for collapsing header-only C++ libraries into single files, preparing code for documentation tools like Doxygen, or integrating preprocessing into Python-based build pipelines.
The preprocessor passes a modified mcpp unit test suite and handles complex recursive macro expansions that conform to C99 standards. It offers both a Python API (by subclassing the Preprocessor class) and a command-line tool that mimics conventional C preprocessors. Partial preprocessing modes allow fine-grained control over which directives are executed versus passed through, making it flexible for different build scenarios.
Use it for
- Collapse header-only C++ template libraries into single-file includes for easier distribution
- Preprocess C code before feeding it to documentation generators like Doxygen that have limited preprocessor capabilities
- Expand macros and resolve conditional compilation in C source files as part of a Python-based build system
- Benchmark and analyze header file complexity to identify optimization opportunities in build times
- Selectively expand nested includes while preserving system header references in generated output
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need C99 preprocessing in a Python environment.
The package is stable and dependency-free, making it easy to integrate. However, the 2021 release date and aging maintenance status mean it may not track the latest C standards or receive active bug fixes—suitable for established workflows but verify compatibility with your specific C/C++ code patterns first.
Install
pcpp on PyPI
Before you install
Low install friction with no runtime dependencies. Package is in production/stable status but aging—last release was in 2021, though the repository remains active with recent commits.
License in practice
BSD license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install pcpp
from pcpp.preprocessor import Preprocessor
prep = Preprocessor()
prep.parse(open('input.h').read())
print(prep.write())
Verify before relying
- Whether Python 2 support (listed in classifiers) is actively maintained given the 2021 release date
- Current performance characteristics under modern Python versions compared to the stated 0.84x–2.62x range under PyPy
Package facts
| License | BSD permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 1,750 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 791,555 / month, #5,046 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software Development :: Build Tools |
Evidence: pcpp-1.30-py2.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 › “C preprocessor Python”
- pcppA pure Python implementation of a C99 preprocessor that can…
- fyppFypp is a Python-powered preprocessor for Fortran that adds…
- pyScssCompiles Sass/SCSS stylesheets to CSS, supporting approximately 95%…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also fypp · pycparser · cxxheaderparser · barectf · pcodedmp · sip · ctypesgen · lesscpy · CppHeaderParser · hello-world