[PySide] How to create Qt lib bindings and publicate it to pip
icfwm at gmx.net
icfwm at gmx.net
Sat May 2 14:19:10 CEST 2020
you have to use shiboken2 for creating the bindings. In the bindings xml
description, use the options
<load-typesystem name="typesystem_core.xml" generate="no" />
<load-typesystem name="typesystem_core_common.xml" generate="no" />
for being able to use QtCore (the xml files are part of PySide2). You
will need the shiboken2_generator package. I am using the binary package
provided at qt.io, even though this is not really recommended.
From my understanding, PySide2 does not maintain binary compatibility
between minor versions (this is different to the C++ Qt library). This
means that the bindings are valid only for a specific PySide2 version
(such as 188.8.131.52) and this specific version should be set as a
dependency in your setup.py. via install_requires=["PySide2==184.108.40.206",
If you want to provide binary packages for linux, you probably want to
go the manylinux2014 path (see the manylinux1 discussion a few threads
above). I have had troubles to get shiboken2_generator run correctly on
this platform, so my solution is to generate the sources on a different
linux system and compile them on the manylinux2014 container.
You can use any binary compatible version of QT for developing the
library (e.g., 5.14.0). However, when you load your library in python,
you have to ensure that the correct QT library is loaded beforehand.
Therefore, before importing your bindings, you have to make sure that
PySide2.QtCore (and all other PySide2 modules) are imported before the
bindings of your lib.
You may want to have a look at my work-in-progress package for
reference: https://github.com/ifm/nexxT, relevant portions are
nexxT/src/cnexxT.xml and nexxT/__init__.py (where QtCore is imported
before actually importing the bindings cnexxT).
Hope this helps
On 26.04.20 22:31, Михаил Миловидов wrote:
> I have open source project
> - https://marketplace.qt.io/collections/featured/products/daggy
> I want to create python bindings for my lib such as separate python
> package and publicate it in pip.
> The lib - https://github.com/synacker/daggy/tree/master/src/DaggyCore)
> - that I want to publicate based on Qt framework and has signals/slots
> It means, that lib must be binary compatable with pyside2 python
> package, for using signals and slots.
> I think, that this lib can give boost for using Qt in python in
> non-gui cases, because it gives solution that not exists on python:
> There are no direct ways for local or remote data streaming and
> aggregation, but my lib will offer to do this in simple way with Qt
> signals/slot async model.
> Therefore, I'm very motivated in python bindings, but still not
> understand, how to ensure binary compatibility with pyside2 python
> Is there any tutorials, examples or may be docker containers for
> building Qt lib python bindings with the same envoronment, such as
> pyside2 in pip?
> At this time, I understand, how to compile my Qt lib python bindings
> compatable with pyside2 only for local compilation from source, but
> don't understand how to ensure compatibility with pyside2 from pip.
> Thank you for attention!
> PySide mailing list
> PySide at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide