Use Py_Limited_API Flag for Builds
I think we are only using functions that are guaranteed to have a stable ABI in the Python 3.X series, so we could likely build with this setting to reduce the amount of wheels we need to generate
This is set in setup.py roughly using macros = [("Py_LIMITED_API", "1”)]
Note that PyTupleObject which we use in pantab.c is not part of the limited API...
Yea that is fortunately easy enough to swap out with PyObject, but when trying this a while back I found out that PyUnicode_* methods are not part of the stable ABI, which would make this difficult to achieve in its current form
There is a PEP to enhance and better document the stable ABI which could help here. This would require some further investigation and might not be possible for a bit, but open to whatever anyone can find. It would be nice to not have to distribute individual wheels for each Py3.X version
Looks like PyUnicode_AsUTF8AndSize was added to the limited API in Python 3.10, so can provide limited wheels at least from that version forward.
Older versions may have the ability to just use PyUnicode_AsUTF8 though would take a refactor of code and some research
Actually with nanobind we would need to wait until Python 3.12 becomes the minimum. Here is an example project:
https://github.com/wjakob/nanobind_example
So still a few years out