pyclibrary
C binding automation
What it is and what it does
PyClibrary is a pure-Python C parser and ctypes binding automation library that reads C header files and extracts their definitions—macros, typedefs, structs, unions, enums, function prototypes, and global variables—then uses those definitions to simplify calling C libraries from Python. It evaluates typedefs down to their fundamental C types and can automatically build C structs and perform type conversions when invoking functions through ctypes' cdll or windll interfaces.
The package aims to be FFI-agnostic, presenting a backend-independent API; currently only ctypes is implemented, though a cffi backend is noted as theoretically possible. It depends only on pyparsing and runs on Python 3.10 and later. The library is a maintained fork of an earlier Launchpad project and is actively developed, making it suitable for projects that need to reduce boilerplate when wrapping existing C libraries.
Use it for:
- Automatically generate Python ctypes wrappers from C header files to call compiled C libraries without manual struct and type definitions.
- Parse and evaluate C macros and typedefs to determine their underlying C types for use in Python binding code.
- Simplify integration of legacy C libraries into Python projects by automating the extraction of function signatures and struct layouts.
- Build Python-friendly wrappers around Windows DLLs or Unix shared libraries with automatic type conversion on function calls.
- Reduce maintenance burden when C library headers change by regenerating bindings from the updated headers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses C header files and automates ctypes-based bindings to C libraries, handling macros, typedefs, structs, unions, enums, and function prototypes with automatic type conversion.
Yes. Low install friction, active maintenance, no known vulnerabilities, and permissive MIT license make this a safe choice. Install it if you need to call C libraries from Python and want to avoid hand-writing ctypes boilerplate; skip it if you prefer explicit control over bindings or are already using a dedicated FFI tool like cffi.
Install
pyclibrary on PyPI
pip
pip install pyclibraryuv
uv add pyclibrarypoetry
poetry add pyclibraryInstalling pyclibrary
Before you install
Low friction: pure-Python wheel with a single runtime dependency (pyparsing). Actively maintained as of 2026-07-17 with recent release history since 2015.
License in practice
MIT license (permissive): you may use, modify, and distribute this package freely in commercial and private projects, with minimal restrictions beyond preserving the license notice.
Quickstart
pip install pyclibrary
from pyclibrary import CParser
parser = CParser(['myheader.h'])
print(parser.defs['functions'])
Requires Python 3.10 or later; C header files must be present and syntactically valid for the parser to process them.
Verify before relying
- Extent of C syntax coverage beyond the documented macro, typedef, struct, union, enum, function prototype, and global variable support.
- Whether the ctypes backend handles all common calling conventions and platform-specific type mappings automatically.
- Real-world performance on large or complex header files with heavy macro nesting or conditional compilation.
Package facts
| License | The MIT License (MIT) Copyright (c) 2010 Luke Campagnola Copyright (c) 2015 Matthieu Dartiailh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyparsing |
| Maintenance | actively maintained — 345 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 399,719/month — #6,945 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyclibrary-0.3.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
CppHeaderParserParses C++ header files and extracts their…
permissive · top 15,000 on PyPI
ctypesgenctypesgen parses C header files and…
permissive · top 15,000 on PyPI
cwrapcwrap is a Python wrapper around C code that…
copyleft · top 15,000 on PyPI
pywin32-ctypesA pure-Python reimplementation of pywin32 that…
permissive · top 5,000 on PyPI
debug-mgrProvides a debug manager interface for C++…
permissive · top 15,000 on PyPI
glfwPython bindings for GLFW 3 that wrap the C…
permissive · top 5,000 on PyPI
abi3infoabi3info exposes CPython's limited API and…
permissive · top 15,000 on PyPI
jaraco.windowsProvides a pure-Python interface to Windows…
permissive · top 15,000 on PyPI
cffiCFFI enables Python code to call C functions…
permissive · top 100 on PyPI
pyseccomppyseccomp provides a pure-Python interface to…
permissive · top 5,000 on PyPI