Jump to content

GSoC/2024/StatusReports/ManuelAlcaraz

From KDE Community Wiki

Python bindings for KDE Frameworks

KDE Frameworks is a collection of C++ addon libraries to Qt that provide common functionality for desktop applications built with the Qt framework. While Qt itself provides support for developing applications using other programming languages, such as Python, KDE Frameworks does not.

This project aims to create Python bindings (along with comprehensive developer documentation) for a subset of the KDE Frameworks using the same technologies (Shiboken) that Qt uses for their Python port.

Mentor

Carl Schwan

Work report

Summary

I have added a new module to Extra CMake Modules (ECM) that handles the generation of Python bindings using Shiboken. It's currently waiting to be merged while we figure out some building errors on some distributions.

Using the new module, I wrote Python bindings for the following libraries:

  • KWidgetsAddons
  • KUnitConversion
  • KCoreAddons
  • KGuiAddons
  • KI18n
  • KNotifications
  • KXmlGui

The first two of them have open merge requests. The rest will be upstreamed once the ECM one is merged and they are on a separate repository where I started working on the project until it was ready to be upstreamed.

Writing the definitions of the bindings was mostly a repetitive task (that sometimes became boring), although sometimes Shiboken didn't properly handle some functions and required some manual tweaking.

Future work

This project only added Python bindings to a few KDE Frameworks, so writing bindings for the rest of them is an expansion point.

Due to the language differences between Python and C++, some functions can't be ported properly (namely those which have pointers as arguments, e.g. bool*). This wan't addressed on the project.

Merge requests

Links to Blogs and other writing