Search code examples
pythonpysidepython-wheelshiboken2scikit-build

How to generate an abi3 weel with shiboken6?


I was able to generate cpX-cpX-manylinux_2_24 wheels using PySide2/6, shiboken2/6, scikit-build and repairwheel (https://github.com/aymara/lima-python/) but I'm not able to find where to ask to build abi3 compatible binaries.

I read in "The Python/C API, Release 3.10.5" by Guido van Rossum:

Py_LIMITED_API
Define this macro before including Python.h to opt in to only use the Limited API, and to select the Limited API version.

but in shiboken2/6 binding, I don't include Python.h myself. So I don't know where to put this define.

I read somewhere that one should define the cmake variable FORCE_LIMITED_API before building myself shiboken. But it was not a proper documentation and thus I'm not sure it is the right solution.


Solution

  • I think I finally found the answer. At github.com/qtproject/pyside-pyside-setup, there is

    For development purposes the following options might be of use, 
    when using setup.py build: --limited-api=yes|no, default yes if applicable. 
    Set or clear the limited API flag. Ignored for Python 2. 
    

    So, I can just pass --limited-api=yes when I build pyside or suppose it was set if using a prebuilt one and just force the wheel name to contain the -abi3 string.