f2py
.
f2py
.
F2PY (in NumPy) is released under the terms of the NumPy License.
f2py
, Second Editionf2py
started in summer of 1999.
For now (January, 2000) it has reached to stage of being a
complete tool: it scans real Fortran code, creates signature file
that the user can modify, constructs C/API module that can be
complied and imported to Python, and it creates LaTeX documentation
for wrapper functions. Below is a bit longer list of
f2py
features:
f2py
scans real Fortran codes and produces the signature files.
The syntax of the signature files is borrowed from the Fortran 90/95
language specification with some extensions.
f2py
generates a GNU Makefile that can be used
for building shared modules (see below for a list of supported
platforms/compilers). Starting from the third release,
f2py
generates setup_modulename.py
for
building extension modules using distutils
tools.
f2py
uses the signature files to produce the wrappers for
Fortran 77 routines and their COMMON
blocks.
external
arguments f2py
constructs a very flexible
call-back mechanism so that Python functions can be called from
Fortran.
f2py
takes care of type-casting and
non-contiguous arrays.
f2py
will generate
wrapper functions with desired signatures. depend()
attribute is introduced to control the initialization order of the
variables. f2py
introduces intent(hide)
attribute to remove
the particular argument from the argument list of the wrapper
function and intent(c)
that is useful for wrapping C
libraries. In addition, optional
and
required
attributes are introduced and employed.
f2py
supports almost all standard Fortran 77/90/95 constructs
and understands all basic Fortran types, including
(multi-dimensional, complex) arrays and character strings with
adjustable and assumed sizes/lengths.
f2py
generates a LaTeX document containing the
documentations of the wrapped functions (argument types, dimensions,
etc). The user can easily add some human readable text to the
documentation by inserting note(<LaTeX text>)
attribute to
the definition of routine signatures.
f2py
one can access also Fortran 90/95
module subroutines from Python.
f2py
(because it uses exchanged module re
).
To build generated extension modules with distutils setup script,
you'll need Python 2.x.
PyArray_FromDimsAndDataAndDescr
)
f2py-?-???
and run python setup.py install
. That's it!
f2py
has been successfully tested on
f2py
will probably run on other UN*X systems as
well. Additions to the list of platforms/compilers where
f2py
has been successfully used are most welcome.
Note:
Using Compaq Fortran
compiler on Alpha Linux is succesful unless when
wrapping Fortran callback functions returning
COMPLEX
. This applies also for IRIX64.
Note: Fortran 90/95 module support is currently tested with Absoft F90, VAST/f90, Intel F90 compilers on Linux (MD7.0,Debian woody).
f2py
program and it is open for discussion, questions, and answers. You can subscribe
the list here.
f2py
is being developed under CVS and those who are
interested in the really latest version of f2py
(possibly
unstable) can get it from the repository as follows:
guest
):
> cvs -d :pserver:anonymous@cens.ioc.ee:/home/cvs login
> cvs -z6 -d :pserver:anonymous@cens.ioc.ee:/home/cvs checkout f2py2e
f2py2e
you can get the updates by hitting
> cvs -z6 update -P -d
f2py
CVS repository here.