Some have asked how fwrap relates to f2py.
Broadly, fwrap can be seen as an update of f2py for all of Fortran 90/95, addressing the features that f2py does not support at the present time. My understanding is that the 3rd version of f2py intends to address many of these features, but that version of f2py is far from complete. This is not intedended as a critique of f2py, merely a brief comparison of the two projects.
Fwrap focuses on generating Cython wrappers for Fortran code, and the Python-level wrappers come for free, in a sense. Fwrap uses the Fortran parser–named ‘fparser’–that Pearu Peterson (the author of f2py) created for the latest incarnation of f2py. In contrast to Fwrap using Cython, f2py generates the C extension module directly–quite an undertaking. Fwrap focuses on all 3 levels of wrapping: C, Cython and Python; and the C wrappers can be used without any Cython or Python dependency.
Fwrap generates one more wrapping layer than f2py; this allows fwrap to eventually support every desirable feature in Fortran 90/95 (and, in principle, 2003).
F2PY has a very nice interface file functionality, and supports comment directives in the fortran source to specify how it is to handle different arguments. These features are planned for fwrap, but currently it is easier to make ‘pythonic’ wrappers with f2py, while fwrap just wraps every argument directly, taking into account the argument’s intent.
Fwrap has planned some features that are not in f2py: for instance, a fortan inline module that is similar to scipy’s weave, user derived types, automatic type discovery, and (way in the future) wrapping a Fortran module in a Cython class.
Pearu and I are on good terms and we both collaborate to make fparser better along with the other fparser & f2py developers. F2PY is an impressive project and provides the skeleton for many Python & Fortran projects, most prominently among them being SciPy.
Fwrap would not exist if f2py had not blazed the trail, and paved over half of it🙂