f90wrap: Fortran to Python interface generator with derived type support

f90wrap extends the capabilities of f2py by providing support for derived types and other features specific to the Fortran90 standard.

It consists of a layer on top of f2py, through which modified Fortran source files are created for input to f2py.

Installation

At this stage, you must get the source from https://github.com/jameskermode/f90wrap and then do python setup.py install.

At a later date we will provide support for pip install f90wrap.

Features

f90wrap allows a superset of the Fortran 90/95 language elements which can be wrapped by f2py to be accessed from Python, adding support for:

  • Subroutines and functions with derived type arguments

  • Access to elements within derived types

  • Access to module data - scalars, arrays and derived types

Case studies

f90wrap has been used to wrap the following real-world large-scale scientific applications

Basic Usage

To use f90wrap to wrap a set of Fortran 90 source files and produce wrappers suitable for input to f2py use:

f90wrap -m MODULE F90_FILES

where MODULE is the name of the Python module you want to produce (e.g. the name of the Fortran code you are wrapping) and F90_FILES is a list of Fortran 90 source files containing the modules, types and subroutines you would like to expose via Python.

To use f2py to compile these wrappers into an extension module, use:

f2py -c -m _MODULE OBJ_FILES f90wrap_*.f90

For more advanced usage, see the Usage section or the examples/ directory in the source distribution.

Authors

James Kermode: james.kermode@gmail.com

Contributors

Steven Murray: steven.murray@uwa.edu.au

API Documentation

Notes on Usage

Indices and tables