### Table Of Contents

- F2PY Users Guide and Reference Manual
  - Introduction

#### Previous topic

Testing the numpy.i Typemaps

#### Next topic

Three ways to wrap - getting started

# F2PY Users Guide and Reference Manual

Author: | Pearu Peterson
Contact: | pearu@cens.ioc.ee
Web site: | http://cens.ioc.ee/projects/f2py2e/
Date: | 2005/04/02 10:03:26

## Introduction

The purpose of the F2PY –Fortran to Python interface generator– project is to provide a connection between Python and Fortran languages. F2PY is a Python package (with a command line tool `f2py` and a module `f2py2e`) that facilitates creating/building Python C/API extension modules that make it possible

- to call Fortran 77/90/95 external subroutines and Fortran 90/95 module subroutines as well as C functions;
- to access Fortran 77 `COMMON` blocks and Fortran 90/95 module data, including allocatable arrays

from Python. See F2PY web site for more information and installation instructions.

- Three ways to wrap - getting started
  - The quick way
  - The smart way
  - The quick and smart way
- Signature file
  - Python module block
  - Fortran/C routine signatures
  - Extensions
- Using F2PY bindings in Python
  - Scalar arguments
  - String arguments
  - Array arguments
  - Call-back arguments
  - Common blocks
  - Fortran 90 module data
- Using F2PY
  - Command `f2py`
  - Python module `f2py2e`
- Using via `numpy.distutils`
- Advanced F2PY usages
  - Adding self-written functions to F2PY generated modules
  - Modifying the dictionary of a F2PY generated module