About f2py, IPC and Wrappers

I’m mainly using CFFI from the Python side and bind(C) from the Fortran side to export APIs from Fortran to Python. While I have to write and maintain a C-API for this purpose, I consider this “free” C-API a plus, since it allows interfacing to other languages as well by one uniform API.

Regarding f2py, the missing support for derived types (when I last checked) ruled it out from the very beginning, as my C-APIs are almost always based on objects rather than on procedures. Also build system integration is usually a huge point in using such tools, I wasn’t able to figure out whether I can use f2py from meson without having to introduce too many hacks.

Maybe interesting in this context is the following thread, which covers many different opinions on interfacing Fortran and Python:

2 Likes