Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
None
-
None
Description
I'm an engineer at GoPro, where we use pyside for our internal tooling.
By distributing the Qt libraries, pyside achieves isolation from the system at runtime: you don't need to have Qt installed to run a pyside app, which is good.
In some of our tools, we have Cython modules that use the Qt C++ classes directly, for performance reasons (mostly direct QImage access). These modules need to link with the Qt libs and have access to the headers, which we achieve by installing Qt on the system and configuring our extensions build parameters with pkg-config.
As a result, the apps link with both with pyside's vendored libs, and the system ones, which leads to warning messages at runtime:
objc[22124]: Class QMacAutoReleasePoolTracker is implemented in both /Users/flupke/src/.sx/stupeflix/lib/python3.7/site-packages/PySide2/Qt/lib/QtCore.framework/Versions/5/QtCore (0x112280030) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x116b34978). One of the two will be used. Which one is undefined.
This works fine as long as the pyside and system Qt versions match, but crashes hard as soon as they don't. There is not always a simple solution to this problem, for example on MacOS you can't easily install a specific version of Qt.
So here are my suggestions to achieve build-time isolation:
- Distribute Qt headers with pyside
- Add top-level functions to allow Python extensions to link with the pyside vendored libs. For example Pyside2.get_extra_compile_args() and Pyside2.get_extra_link_args(), which could be given directly to the corresponding distutils.core.Extension arguments (we can't use include_dirs and libraries, because Qt ships as frameworks on MacOS)
- Maybe also distribute a pkg-config file for extra flexibility
If my suggestions are approved, I would be glad to contribute this work myself