ctypesgen
Python wrapper generator for ctypes
Decision gist · record as of 2026-08-14
Yes, if you need to call C library functions from Python and want to avoid manual ctypes binding work. The low install friction and permissive license make it a practical choice. However, the aging maintenance status (last release October 2022) means you should verify that generated wrappers work correctly for your specific headers and libraries before committing to production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later; C header files and target library must be accessible on the system.
- Low install friction; pure Python wheel with no runtime dependencies.
- Maintenance is aging—last release October 2022, though the repository remains active with recent commits and no archived status.
License · maintenance · safety
BSD-2-Clause (permissive) — BSD-2-Clause (permissive) allows commercial and private use with minimal restrictions; redistribution requires retaining copyright notice and disclaimer.
last release 2022-10-19 (1395 days) · last repo commit 2025-05-07 · 336 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 168,644 downloads/mo, #10,441 on PyPI
Alternatives
Verify before relying
pip install ctypesgen
ctypesgen -lneon /usr/local/include/neon/ne_*.h -o neon.py- Whether generated wrappers handle all C constructs equally well or have known limitations with complex types.
- Current state of JSON output feature and compatibility with Mork for Lua binding generation.
- How preprocessor macro function translation handles edge cases in real-world headers.
What it is and what it does
ctypesgen is a command-line tool that reads C header files and generates Python code using ctypes to call functions in compiled C libraries. It handles preprocessor macros by translating them into equivalent Python functions, and can output either Python wrapper modules or JSON for use with other binding generators like Mork.
The tool is designed for developers who need to integrate C libraries into Python projects without writing manual ctypes bindings. It supports platform-specific library loading, handles calling conventions, and can manage dependencies between libraries. The generated wrappers use ctypes directly, so they work on any platform with Python 3.7+ and the target C library available.
Use it for
- Generate Python bindings for system libraries like APR or Neon to call their C functions directly.
- Automate wrapper creation for third-party C libraries to avoid hand-writing ctypes boilerplate.
- Create JSON output for generating Lua bindings via Mork using the alien module.
- Handle platform-specific library loading and calling conventions automatically.
- Translate C preprocessor macros into callable Python functions for library constants and utilities.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to call C library functions from Python and want to avoid manual ctypes binding work.
The low install friction and permissive license make it a practical choice. However, the aging maintenance status (last release October 2022) means you should verify that generated wrappers work correctly for your specific headers and libraries before committing to production use.
Install
ctypesgen on PyPI
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Maintenance is aging—last release October 2022, though the repository remains active with recent commits and no archived status.
Requires Python 3.7 or later; C header files and target library must be accessible on the system.
License in practice
BSD-2-Clause (permissive) allows commercial and private use with minimal restrictions; redistribution requires retaining copyright notice and disclaimer.
Quickstart
pip install ctypesgen
ctypesgen -lneon /usr/local/include/neon/ne_*.h -o neon.py
Verify before relying
- Whether generated wrappers handle all C constructs equally well or have known limitations with complex types.
- Current state of JSON output feature and compatibility with Mork for Lua binding generation.
- How preprocessor macro function translation handles edge cases in real-world headers.
Package facts
| License | BSD-2-Clause permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 1,395 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 168,644 / month, #10,441 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Build ToolsTopic :: Software Development :: Code GeneratorsTopic :: Software Development :: Pre-processors |
Evidence: ctypesgen-1.1.1-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 › “ctypes wrapper generator”
- ctypesgenctypesgen parses C header files and automatically generates Python…
- pyclibraryParses C header files and automates ctypes-based bindings to C…
- cintWraps ctypes integer types to perform arithmetic with C-like overflow…
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 pyclibrary · cxxheaderparser · comtypes · cwrap · pcpp · pycparser · pyseccomp · jaraco.windows · cint · pywin32-ctypes