Year of the Snake: Qt for Python 6.9 is out!

mastodon qt

2025 is the year of the snake! 🐍 and for that we are happy to tell you that the Qt for Python development keeps moving forward, by improving our modules PySide6 and shiboken6, but also envisioning the future of Qt and Python integrations.

On this release, we focused on improving the new features we included in 6.8, added new support for a new platform, and we started new initiatives, keep reading to check them out!

Here you will find a few highlights of this new release, and if you need more details, feel free to check out changelog here.

Formalizing Qt Design Studio integration 

If you missed our last blog post, Qt Design Studio has an option to export projects for Python developers starting from version 4.5. With our last  6.8 release we were able to use our deployment tool pyside6-deploy to facilitate deployment of Qt DS projects. Initially, the process involved workaround which consisted of monkey patching the main.py file generated by Qt Design Studio.  

The new approach starting from 6.9 is much more efficient, as it identifies all the file dependencies of the Qt Design Studio Python project from the QRC file, and includes the compiled Python resource file in the Python executable. The idea is to run pyside6-rcc first to create the compiled Python resource file followed by running pyside6-deploy, OR you can simply run pyside6-project, which will automatically build the project by running pyside6-rcc to create the compiled resource file and you can deploy the project using pyside6-project deploy command. 

This streamlined process ensures a smoother and more efficient workflow for developers using Qt Design Studio with PySide6, making it easier to manage and deploy their projects. 

We will soon publish a new tutorial with all the details and user cases.

Qt Creator and PySide tools support for pyproject.toml 

Qt Creator uses a custom project configuration file for PySide projects with the pyproject extension. These files simple contain a JSON object with an array of the project files. To align with the Python standard guidelines widely adopted in the community, support for using pyproject.toml as a replacement of pyproject files has been introduced, expanding also the future capabilities and integrations with PySide and Qt tools.

The pyproject.toml file offers a wide range of project metadata such as a required Python version, package dependencies, code formatting settings and more! You can find more info in the Python Packaging User Guide.

Doing a migration of an existing project is straightforward thanks to a new option added to pyside6-project command pyside6-project migrate-pyproject. Let us look at the following example in our respository:

(env) ➜  tetrix git:(dev) tree
.
├── doc
│   ├── tetrix.rst
│   └── tetrix-screenshot.png
├── tetrix.py
└── tetrix.pyproject

2 directories, 4 files
(env) ➜  tetrix git:(dev) cat tetrix.pyproject
{
    "files": ["tetrix.py"]
}
(env) ➜  tetrix git:(dev) pyside6-project migrate-pyproject
Created "/home/crmaurei/dev/pyside-setup/examples/widgets/widgets/tetrix/pyproject.toml"
(env) ➜  tetrix git:(dev) cat pyproject.toml
[project]
name = "tetrix"

[tool.pyside6-project]
files = ["tetrix.py"]

 

The tool will read an existing *.pyproject file and create a new pyproject.toml file if one does not exist already. If a pyproject.toml file already exists, it will prompt the user for confirmation before updating its contents to ensure a safe behavior. 

We expect to enhance integration within Qt Creator, and other IDEs like Visual Studio code by supporting pyproject.toml as the project configuration file. Stay tuned!

Type hints improvements 

Numerous users have been reporting issues with our type hints pyi files (Python interface stub), which has been very useful in order to improve them further on. It is important to note that reflecting those improvements in the file is not as simple as editing them, because they don't exist in the repository.

The generation of .pyi files is automated rather than manual, directly from Qt source code by extracting function signatures, class structures and type information. As Python evolves and new PEPs introduce changes to type hinting rules, this automated process ensures that .pyi files remain matched with the latest standards. 

In the .pyi files, imports of Callable, Iterable and Sequence were updated  to collections.abc, as their usage from typing is deprecated since Python 3.10. Additionally, object inheritance has been removed from classes, as all classes implicitly inherit from object in Python 3, making it redundant - a remnant from the days of Python 2 support in Qt for Python.

There are many issues that we will continue fixing in the following 6.9 releases, so make sure to file more reports of corner cases, bugs or suggestions you believe will be worth including.

Shiboken updates and binary size reduction

Generating bindings usually requires a lot of information in order to discover possible errors, making the output too verbose. To reduce the output, we have introduced an additional log file, mjb_shiboken.log, besides the other log files like mjb_rejected_classes.log. Informational messages about command line arguments, instantiated containers and similar are redirected to this log file. This helps to reduce clutter and makes warning-type messages stand out more on standard error, which can be easily missed.

Continuing the efforts that were started in 6.8, we managed to reduce the generated modules sizes by applying several optimizations to the code generated for virtual functions.  In total, we found cases were around 35% reduction was found, while other modules reached around 2%.

We improved the detection of default-constructibility and copy-constructibility for value types, and we added a way to override this in the type system. 

Additionally, we added a way of specifying rules for automatically discarding overloads for equivalent types, and  we improved the way of generating doc strings for classes from injected documentation snippets.

Windows ARM64 support is now in Technical Preview

We are looking forward to expand our platform support and ensuring that PySide6 runs smoothly on a wide range of platforms. With the new 6.9.0 release, we are excited to announce the release of Windows ARM64 wheels as a Technical Preview. This release aims to provide an early access to our Windows ARM64 wheels so that developers can try it out and provide feedback. 

Watch out for updates regarding full support of Windows ARM64 wheels in the upcoming releases. 

Qt Remote Objects contributions

We received a contribution from the maintainer of Qt Remote Objects, which greatly improves the Python support of Qt Remote Objects. rep files can now be read from Python to create dynamic types for communication.  We are very thankful for the contribution!

Considering the support is in technical preview, we encourage you try it out and provide comments so we discover user-cases that could be supported in the future.

What else is cooking? 

Since PEP 730 was accepted, we have seen a lot of interest of people wanted to bring PySide applications to iOS from Qt users. Considering the good success of the Android support, we expect to continue our research on iOS during the following releases.

Before the 3.13 release, we performed a few tests in order to be compatible with Free threaded Python that looked very promising. Considering the feature is still experimental, we paused further development but plan to explore a proper implementation for future versions once the feature exits the experimental phase.

Last but not least, we expect you know that generating bindings for the Qt Framework is not a simple task. Many languages have attempted this, but not many have managed to fully support Qt. This is understandable and brings a new set of questions of `does Python users really need all Qt modules? `, `can this be stripped down a bit in order to solve different use cases?` and more importantly, `how difficult could it be to officially support another language?`

Our team has joined forces with many other engineers that are currently working a new exciting project, that aims to offer an effortless way to connect your Python code to a Qt Quick application. The main goal of this project is to enable Python developers to use Qt Quick without all the required steps that PySide provides and Qt knowledge. Reducing the amount of code to bridge Python and Qt will enable developer to focus only in the backend aspect of Python and Qt applications, by seamlessly integrate complex data structures with their Qt Quick UIs. 

Besides Python and C++, we do love other programming languages too! We have seen how even Python projects have been leveled up thanks to other languages that solve known issues, so we expect this can be the case for Qt as well.

Adding more languages to the Qt ecosystem via bindings is nothing new, but this time we are envisioning a different approach in order to (1) Not providing a full set of bindings, (2) bring the strengths of other programming languages to the Qt ecosystem faster, (3) Increase our Qt community with new developers, and (4) Make Qt a better framework!

Stay tuned as we bring these powerful integrations to life! 

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