Qt for Python release: 6.7 is now available! 🐍

qt release(1)

We’ve been hard at work to bring you the latest release of Qt to Python, and we’re proud to announce that for the first time, we’re releasing Qt for Python just as Qt 6.7 is launching hot off the presses! Every Qt release brings a lot of goodies, but the great thing about Qt for Python is that on top of Qt's new features and enhancements, we have our own cherry on top just for you Pythonistas. 🐍 This time is no different – read on to see what we have in store! We’ve got improvements to QtAsyncio, performance improvements, better Android support, better documentation, better support for Qt's awesome development tools, and more. 

As usual, the full changelog is also at your disposal. 

⚠️ Qt Multimedia: Due to a binary incompatibility change, the renaming from QAudio to QtAudio that happened in 6.7.0 will be reverted in 6.7.1 for Qt/C++ as well for Qt for Python.

Improving our asynchronous story 

We recently announced that QtAsyncio, the pure Python module for interoperability with the popular asyncio module, is now available in technical preview. The 6.7 release introduces a few important bug fixes and one new feature: It is now possible to disable the signal handler for SIGINT by passing a new handle_sigint parameter to QtAsyncio.run(). This means that you can now choose whether QtAsyncio or your own application should handle this signal, making QtAsyncio more flexible and ceding more power to your own code. Read our announcement of the technical preview to learn about everything we’ve introduced to QtAsyncio since Qt for Python 6.6! 

Lazy imports to improve the startup time 

We have implemented a lazy loader to drastically reduce startup times. Startup times became unpleasant after the new Python enumerations were introduced. By initializing thousands of such Python enumerations at the beginning, even if 99% of them are not used, there was a considerable loss of time, not to mention the waste of energy. 

The lazy loader is comparable to PEP 690 in its implementation and controls how the initialization of the elements of an import can be delayed. Although this was too general in PEP and is now obsolete, it was quite helpful for the inspiration of the PySide implementation. Instead of initializing all objects right at the beginning, this delays the deployment of a class until the first __getattr__ call. This way, the classes are not created earlier than when they are actually used.  

The effect is impressive 📈 The three basic modules QtCore, QtGui and QtWidgets are loaded about 35-40% faster. 

Also, the initial import of NumPy, required for our special NumPy Array compatibility API, has been found to cause a slowdown at startup, this is now also delay-loaded in order to improve the startup time.

Better Android support 

With more people using and testing our tool for deploying Python + Qt Quick based applications, we have noticed a few things that we could improve, so there were a few refactoring, simplification of the process, and better handling of some of the options. 

Our Android support now uses Python 3.11, and the versions of the NDK (r26b) and required tools have been raised to keep up with their latest changes. A fix to the python-for-android tool has been accepted upstream, so our private fork of it is no longer required, we are grateful to the team behind python-for-android for their guidance on the process, but also on the willingness to collaborate. 

While currently you have to cross-compile PySide6 for the specific Android platform to create wheels/binaries for that platform, this requirement is soon to go away. We are working on providing official Android wheels for all the available Android platforms. This makes the tool pyside6-android-deploy very easy to use. 

Documentation 

To enable people to easily find the details of the tools that are included in PySide,  we rewrote our tools overview page and added small descriptions for each tool, linking to the respective tutorials or with new documentation pages that can guide you into how to use it.  

Also, the API index pages are now better structured, listing decorators, global functions and enumerations separately. Examples have been re-ordered to show the relevant ones first, also displaying from which independent wheel they belong, for example Essentials or Addons. 

To show the functionality of recently added modules, new examples demoing the new REST API (colorpaletteclient) as well as Qt Graphs (hellographs) have been added. 

✨ As always, if you have been struggling with some specific module or functionality, feel free to request new example ideas! 

Qt Creator 13 with a better Python Support 

A couple of versions ago, the Qt Creator team has been putting a lot of effort to make our favorite Qt IDE speak Python. As a C++ based IDE, there were many ideas that needed to be rethink, and features that needed to be added, mainly to have a bare minimum for Python developers, to use Qt Creator as a Python IDE. 

2024-04-08-114745_5760x2160_scrot

(Selection to install Community and Commercial version of PySide6)

Perhaps you are familiar already with the options to select interpreters that are automatically found or have seen the tooltips when you open a Python project that offer the installation of the language server or PySide. Since then, more details have been added to Qt Creator in order to improve the functionality, like the easy creation of new virtual environments, the installation of commercial wheels (when using Qt Installer), etc. Lately, most of the effort have been put into adapting the concept of Qt Creator Kits, enabling the creation and modification of Python Kits. 

2024-04-08-114715_1295x1040_scrot

(Selection of a Python Kit while creating a new project)

We still have an extensive list of ideas that we believe will improve the experience while developing Python applications, particularly, PySide ones, but we are curious about your own use cases, pain points, and ideas to get Qt Creator to the level of any other Python IDE. 

Curious? Check this documentation to learn more. 

What else is cooking? 

We added bindings for the QtQuickTest module, allowing you to test your Qt Quick designs. The entire Python code base has been fixed to be free of flake8 (linter) warnings (using a custom configuration). Many older bugs have been fixed in a cleanup of our database. The pyside6-project tool can now do translations. 

Research on dynamic bindings  

Further work has been done on the dynamic bindings research project replacing the discontinued QtScript module, as announced in the 6.6 release blog. It had its first test, adding prototypical scripting support to Qt Creator. 

It will expose properties and invokable methods of QObject and gadget classes and provides an effortless way of registering other methods, also for non-QObjects. 

This is currently under heavy development, and we plan to release a Technical Preview during this year. 

Running your Qt Design Studio projects 

When you use Qt Design Studio to create a Qt Quick based application, you need to copy some files manually to be able to run it using PySide. This is not optimal, and due to the many requests, we have, we are currently in the last stage of testing the new complementary packages for PySide that include the Qt Quick components that Design Studio provides. 

The release of this new package will be tied to the Design Studio versions and will not follow the Qt for Python release schedule. 

We are hoping to make them available as a Technical Preview in the coming days, so we can be certain the new packages are helping your workflow. 

PySide applications in your Yocto-based systems 

Starting from 6.7.1 we are planning to include a Qt for Python installation in the Yocto images that you can get from the Qt Installer (Maintenance Tool), this is currently being assessed by the Boot2Qt team, and we plan to release regularly. 

Permission API support in macOS 

Qt introduced the permission API in 6.5 that allows an application to check and request explicit consent from the user for system permissions. For PySide6, this is relevant for Android and macOS. Although the permission API with PySide6 was already working with Android, it was not for macOS until 6.7. With 6.7, you can explicitly check and request all the permissions included with the Qt permission API with your application, provided that your application is deployed with pyside6-deploy. You can read more about this here.

Let's stay in touch!

We want to keep trying new experimental support, features, and Python module integration. What should we do next? Drop us a message or open a suggestion on JIRA 👍. 

We hope you enjoy the release, and as always, drop by our community platforms and let us know if something is not properly working by opening bug reports.

 


Blog Topics:

Comments