Replace F2PY with another system to generate the Hermes and API Python wrappers
Starting with Numpy 1.22.0, F2PY has been causing a lot of troubles to build the API and Hermes Python wrappers. Although some of these issues have been resolved on TELEMAC side (see !160 (merged)), the introduction of Python 3.12, which removed support for distutils
, once again prevents Python wrappers from being compiled, since their build requires the use of the --fcompiler
option, which itself depends on numpy.distutils
(see #946).
Given this highly unpredictable behaviour of F2PY, which depends very heavily on the versions of Numpy and Python that are used, it becomes necessary to switch to another system, more robust and reliable over time, in order to generate TELEMAC Python wrappers. The best solution would be to create a C binding of the Fortran APIs, possibly using the standard ISO_C_BINDING
intrinsic module available since Fortran 2003. Then, these C functions could be called from Python using a C/C++ to Python binding system. There are many such systems, the most widely used being ctypes, CFFI, Cython and pybind11: https://realpython.com/python-bindings-overview.