Qt for Python: details about the 6.1 release 🐍

Last week, we announced Qt 6.1, and with that, we wanted to announce the new release of our official set of Python bindings: Qt for Python

It took us a bit longer than usual, due to last-minute-issues 😬, but everything is solved now

You can get the latest release with a simple:

pip install PySide6

Polishing the offering 

We have introduced a couple of features in the previous releases, mainly the __feature__ options. Thanks to their popularity, people have been able to file bug reports of corner cases that we overlooked for the initial release. Most of the major issues have been solved already, and we added some documentation about it, so we are thankful for the adoption of these options. 

We also took the time to polish the examples, so they are better written and adopting the latest Qt changes. 

Considering that we are not supporting Python 2, for PySide 6.x, we noticed that our workaround function exec_() was not needed anymore, so now you can safely use exec() 😅. 

Adding missing modules 

Qt 6.1 added newly ported and improved modules that we offered in the Qt 5 releases, so we are enabling them again! 

This release will additionally include: 

  • ActiveQt, 
  • QtCharts 
  • QtDataVisualization 
  • QStateMachine 

We also removed an extra namespace for the QtCharts and QtDataVisualization modules. Now, they are easier to use and consistent with all the other modules: 


Experimental: Interaction with Qt Designer 

Complex widgets are often developed with the help of Qt Designer, and since we include the pyside6-designer tool in the PySide6 package it made sense to improve the interaction with other PySide components. 

A new experimental plugin for Linux and Windows is shipped that provides support for writing custom widgets in Python, which can then be selected from Qt Designer to be used in layouts. Some extra magic is required to enable this on macOS. We hope to have it ready in 6.1.1 🧙 

You can read more about the process in our tutorial. 

To register a widget: 

  • Create a registerX.py file, where X points to the name of the widget you want to register (you can find an example here), and 
  • Point the PYSIDE_DESIGNER_PLUGINS environment variable to where the registration script is located. 

Experimental: Better Python integration with QtCharts 

We know QtCharts is important to many users due to the smooth integration with Qt applications, but we also know how important NumPy is for our users, so we decided to extend a bit the compatibility by adding new methods to two of the most common types to graphically interact with data: QXYSeries, and QPointF

These methods will be enabled only as an experimental feature, so they will not be available by default, you will need to build PySide from source to try it. The reason for this, which sounds a bit inconvenient, is due to compatibility issues between our Python limited API implementation and NumPy. 

The new methods are: 

  • QXYSeries.appendNp(PyArrayObject*, PyArrayObject *) 
  • QXYSeries.replaceNp(PyArrayObject*, PyArrayObject *) 
  • QPainter.drawPointsNp(PyArrayObject*, PyArrayObject*) 

Both arguments are compatible with Numpy Arrays, so we hope this little change can improve your experience while using those Qt classes. 

Video Tutorials 

Considering the tutorials and examples we currently have in our documentation we have noticed a high demand for new topics and video tutorials. More importantly, we are aware that the contribution process is not so straightforward for many of our new users. Even once everything is set up, navigating inside the pyside-setup repository might be challenging, since the structure is not common for other Python projects. We wanted to tackle that also with a series of video tutorials.

Here you can watch a general overview of all the Qt for Python related resources and websites:

Additionally, if you are interested into diving into the main repository of the project, but there are too many things inside and you are not certain where to look, we got you covered too:

We are currently preparing a couple more, so in case you want a specific topic Let us know!  🥳 

Initial Nuitka Support 

Compiling Python applications is complicated work, and many Qt for Python users are always looking for ways to deploy standalone binaries from their Python applications. This is why we created all the tools tutorials in our documentation

So far, all the solutions are based on the idea of packaging the Python code, and distributing it, but none of them was focused on compiling the code, here is where Nuitka ticks all the boxes. 

We love Nuitka, and we are certain you will love it too! 

If this name is new to you, in a nutshell we can tell you that it’s a Python compiler written in Python, you can read more in their website

We are thankful for all the time Kay Hayen took to make Nuitka compatible with PySide 6.1, and we are looking forward to hearing from your own experiences what we could improve from this joint effort. 

Commercial Offering: Shiboken Wizard 

We know generating bindings for C++ projects can be a difficult task when we are not familiar with the necessary boilerplate code related to the objects discovered, used primitive types, the typesystem configuration, and even the required cmake file, so we wanted to start making the product smoother. 

This version includes a Technical Preview for a new tool we have been developing for our commercial customers, called Shiboken Wizard, which is an easy-to-use UI to configure and generate your bindings. 

Here you can find a video of the workflow with one of our examples: 

We would love to hear back from you on how we can keep improving the tool 🙌. 

What’s next? 

We are still working on new features, because our goal is to provide much more than just Python bindings for Qt, and we want to improve the project to be more compatible with the Python ecosystem and improve the development experience. 

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 👍. 

One of the things we are working on is the interaction with the pathlib module, to properly handle everywhere in our API when we work with paths and filenames. Finally, we are trying to address an old but exceedingly popular feature request: be PyPy compatible. 

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 in JIRA .

Blog Topics: