[PyQt] problems porting a project from sip4 to sip5

Steve Borho steve at borho.org
Thu Apr 16 23:52:09 BST 2020


I maintain a couple of relates SIP projects that I am trying to port to sip5 and binary wheel distributions.  To keep things simple, lets say there is a C++ library for a widget foo, and Python wrappers that we’ll call pyfoo.

I have written a pyproject.toml for pyfoo such that sip-wheel can generate wheels which install a “foo” python package containing a pyfoo.so shared library. This wheel is 100% functional.

Next I have a fooapp which uses PyQt5 and has its own C++ functions which compile against Qt and the foo C++ library.  This gets compiled into qtfoo.so and it’s SIP wrapper includes:

%Import QtGui/QtGuimod.sip
%Import QtWidgets/QtWidgetsmod.sip
%Import QtNetwork/QtNetworkmod.sip
%Import foomod.sip

I have written a pyproject.toml for fooapp that sip-build can compile into a qtfoo.so and sip-wheel can create a wheel for it.  But no matter how I try and load the qtfoo.so it always errors with the message:

    from .qtfoo import get_qtfoo_version
RuntimeError: the foo.pyfoo module failed to register with the sip module

I get this error even though the previous line of Python code was able to import pyfoo.so from the foo package.  There is a binary dependency here that I can’t determine.

I read the documentation about standalone and package modules, and followed the steps to make a foo-sip wheel that installs foo/bindings/pyfoo/foomod.sip and the other sip files, but this did not seem to help with the library interdependency.

I’m missing something basic, any hints on where to look?

Steve Borho

More information about the PyQt mailing list