$ show MeVisLab/pythonqt
PythonQt is a dynamic Python binding library for the Qt framework, focused on embedding CPython into C++ Qt applications. The runtime in src/ exposes Qt objects to Python through custom Python type objects, signal/slot bridging, automatic type conversion, property access, and ownership transfer. Key entry points are PythonQt::init(), the PythonQt_QtAll extension, PythonQtObjectPtr, and the PythonQtScriptingConsole widget. The project is a library and code-generation toolchain rather than a standalone application; it contains no data pipelines or research components. The repository also ships a complete binding generator under generator/, which parses Qt C++ headers with a custom lexer/parser/simplecpp preprocessor pipeline, applies type-system XML rules, and emits wrapper code. Pre-generated bindings for Qt 5.15 are checked in under generated_cpp_515/, following a consistent Shell/PublicPromoter/Wrapper pattern that enables Python subclassing of Qt classes and exposure of protected methods. The project includes numerous examples and a functional test suite, and CI workflows exercise builds against multiple Qt versions including Qt 6.x. The codebase is professionally maintained but carries significant legacy from the Nokia Qt Script Generator lineage. The custom C++ parser has known limitations, the generated code is voluminous and tied to specific Qt versions, and many modules use extensive #if QT_VERSION branches. Overall it is a competent, specialized binding framework with a few genuinely reusable building blocks, but it is not a modern, lightweight codebase.
The LLM identified 3 files worth highlighting for reuse:
A C++ smart pointer that manages PyObject ownership with reference counting, null-safety, and QVariant interop. It solves the recurring problem of safely holding Python objects in C++ code and is a foundational utility for any embedded-Python C++ project that needs to pass Python objects through Qt's type system.
Bridges Qt signals to Python callables by tracking sender lifetimes, acquiring the GIL only during dispatch, and cleaning up connections when the sender is destroyed. This is a self-contained cross-language event integration pattern that can be adapted for other Qt/C++ to Python bridging scenarios.
A ready-made QWidget-based interactive Python console with command history, completion, and stdout/stderr redirection. It can be embedded in any Qt application linked against PythonQt to provide a debugging or user scripting surface, and demonstrates a clean reusable widget pattern.