Qt for Python 6 released

It is with great pleasure to announce that we have released a new version of Qt for Python for Qt 6 and a range of new features 🐍. PySide was initially released for Qt 4 and PySide2 for Qt 5.12. We have decided to follow the general Qt release versioning with this release, explaining the version leap to PySide6 and Shiboken6.    

Let us explore the updates you will find with this release! 🎉

General information 

We have included the number '6' in the project name, making the Python Package Index (PyPi) different, so to pip install, you will need to refer to the packages as "pyside2/shiboken2" for 5.x and "pyside6/shiboken6" for 6.x releases, rather than pip install pyside6==5.15.0, nor pyside2==6.0. 

You can install the new release via:  pip install pyside6


Another important update is that we support Python 3.9, and we have raised the minimum version to 3.6. We have performed a "Python 2 exorcism" in our code base, removing the language's deprecated version. Our users can achieve many benefits by adopting the newer versions of the language. It will enable you to use excellent language features in your Python code, such as f-strings, underscores in numerical literals, syntax for variable annotations, etc. 


With Qt 5.15.2, we introduced a new option called __feature__, enabling you to switch between camelCase and snake_case for most Qt APIs. With Qt 6.0, you can directly access Qt properties from your Python code, leaving aside the setters and getters, with the new true_property feature. 

Check this comparison between the common code and what you can get with these new features together: 

Normal Code Enabling the feature option
# Common Qt structure

table = QTableWidget()
button = QPushButton("Add") button.setEnabled(False)
layout = QVBoxLayout() layout.addWidget(table) layout.addWidget(button)
from __feature__ import snake_case, true_property

table = QTableWidget()
table.column_count = 2
button = QPushButton("Add") button.enabled = False
layout = QVBoxLayout() layout.add_widget(table) layout.add_widget(button)


You will also encounter all the new QML features described in the previous blog post: Improved QML Support for Qt for Python 6.


A new major release allows us to clean our code base, so we took this opportunity to go through all the corners of Shiboken, removed unused functionality, added new features, and re-organized the different internal processes, like the interaction with the ApiExtractor or the CppGenerator. 

For the binding generation, we added more options to our type system, for example enabling selecting the order of function overloads to use in the decisor. We also made it possible to declare properties, and finally, optionally expose a snake_case name for your camelCase functions while generating the bindings for your non-Qt based modules, complementing the switchable features of PySide6 for Qt-based modules. 

On the C++ support for the binding generation, we improved the interaction with smart pointers. We extended it to handle the modern C++ features used in Qt 6, for example, the template type alias from QVector to QList, new exception specification keywords, operators written as hidden friends, and many more. 


Many people want to contribute to the Qt for Python project, improving our documentation. Still, they encounter a hurdle when checking minor changes into our rst files: building the whole project. The doc building process required you to build the complete API documentation (QDoc and friends), so it was a slow process. To make this easier, we introduced a build option to create local rst documentation, without including the API documentation, build_rst_docs.



Even though we included this on 5.15.2, we want to keep an eye on what else can be done for our users to facilitate the contribution process. 

With the __feature__ functionality in place, it is time to get our imagination to work and start thinking about the future of Qt for Python. For this, we require your help, and we would like to get feedback on the functionality you would like us to develop. Should we improve interaction with other Python modules, add new modules for specific use cases? Please let us know in the comment section below! 🙌 

External Add-ons and commercial offering 

Due to the changes in Qt Add-ons such as Image Formats, Shader Tools, etc, we are looking at some options to distribute them via Python packages better. The distribution will also affect commercial modules in 5.15.x, like CoAP, MQTT, and OpcUA. Another blog post will come when we have a new structure in place. 

Blog Topics: