--- id: pyclibrary version: "0.3.0" 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) license_treatment: permissive maintenance: active --- # pyclibrary — C binding automation License: permissive · Maintenance: active · Downloads: 399.7K/mo ## 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 above — 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 pip install pyclibrary uv add pyclibrary poetry add pyclibrary ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 399.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags c header parser python, ctypes bindings automation, c library wrapper generator, parse c headers, c struct type conversion, cdll windll binding helper, c function prototype parser, c-interop, ctypes, header-parsing [View on SkillFed](https://skillfed.io/packages/pyclibrary) · [View on PyPI](https://pypi.org/project/pyclibrary/)