Hi all,
I would like to create a repository called numerify which is provide numerical methods implemented in fortran and wrap these fortran files in python functions and user will work with python API.
The question is which one is better for this project?
Using python package manager for building and releasing project
I think both. To build and release the Python package you need 1. Then you also need to build the Fortran library. For that you can use the usual ways, or your can use fpm. I recommend fpm.
I’d strongly suggest avoiding f2py, since it essentially only supports F77 features. If you must use an automated wrapper f90wrap is better. Its best to do neither, and proceed via the library mechanism @milancurcic suggested.
f2py actually supports some f90 features, but not all (notably derived types). I’m not very familiar with fpm, but I wonder if some of this couldn’t be done using only conda.
Python users have somehow managed to use Fortran code for years, so there are working solution for making such Python libraries that are well supported. SciPy’s use of f2py is a good example.
Another solution is to use Fortran C interop and wrap that code with Cython, which again is well supported.
Of course, calling the methods from Python will incur an overhead as the user-defined routines will be Python callbacks (for f2py this is the case).