--- id: pybindgen version: "0.22.1" license: unclear license_treatment: copyleft maintenance: abandoned --- # PyBindGen — Python Bindings Generator License: copyleft · Maintenance: abandoned · Downloads: 82.7K/mo ## What it is and what it does PyBindGen is a code generator that reads C or C++ function and class definitions and produces Python extension code that wraps them. Instead of writing binding code by hand or using a template-heavy system like Boost.Python, you describe your API in Python and PyBindGen emits clean, self-contained C or C++ code that can be compiled into a Python module. The generated code has no external dependencies beyond Python headers. The package supports a wide range of binding scenarios: simple functions, classes with virtual methods, reference-counted objects, templated classes, multiple inheritance, and in/out/inout parameters. It can optionally parse C++ headers using gccxml if available. However, it does not support converting Python exceptions to C++ or implementing callbacks, and the project has been inactive since early 2023. Use it for: - Wrapping a legacy C library to make it accessible from Python without rewriting it - Exposing a C++ class hierarchy as a Python module while preserving virtual method dispatch - Generating bindings for a templated C++ class to use from Python code - Creating a Python interface to a performance-critical C function without manual binding code - Maintaining existing PyBindGen-generated modules in a stable codebase ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PyBindGen generates clean C or C++ code that wraps C/C++ libraries as Python modules, without requiring Boost.Python or external runtime libraries. Yes, if you need to generate or maintain Python bindings for C/C++ code and have no active development requirements. The package is stable and has no known vulnerabilities, but it is abandoned—no new features or bug fixes since 2022. Install it only for existing projects or when you are confident the generated code will not need updates. For new binding projects, consider actively maintained alternatives. ## Install pip install pybindgen uv add pybindgen poetry add pybindgen ## Installing PyBindGen Before you install: Installation is straightforward with low friction (pure Python package, no runtime dependencies), but the project is abandoned—last release was 2022-03-30 and no commits since 2023-03-16. Use only if you need to maintain existing bindings or have specific compatibility requirements. License in practice: Licensed under LGPLv2+, a copyleft license. Any Python module you generate with PyBindGen and distribute must comply with LGPLv2+ terms, including providing source code or a written offer for it. Quickstart: pip install PyBindGen==0.22.1 from pybindgen import Module, param m = Module('mymodule') m.add_function('add', retval(int), [param('int', 'a'), param('int', 'b')]) m.generate(open('mymodule.cpp', 'w')) A C/C++ compiler and Python development headers are required to compile the generated bindings; PyBindGen itself is pure Python but exists to generate code that must be compiled. Verify before relying: - Whether the generated code remains compatible with modern Python versions (3.9+) despite the project's abandonment - Current state of optional gccxml/pygccxml integration and whether it works with Python 3 - Whether the generated bindings work reliably with recent C++ standards and compiler versions ## Package facts - License: not declared (copyleft) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 82.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python c++ bindings generator, wrap c code python, python c bindings, generate python module from c++, c library python wrapper, python binding code generation, c++ to python bindings, binding-generation, c-cpp-interop [View on SkillFed](https://skillfed.io/packages/pybindgen) · [View on PyPI](https://pypi.org/project/pybindgen/)