Fortran to Python Interface Generator.
Module | __version__ |
Undocumented |
Module | auxfuncs |
Auxiliary functions for f2py2e. |
Module | capi |
Copyright 1999,2000 Pearu Peterson all rights reserved, Pearu Peterson <pearu@ioc.ee> Permission to use, modify, and distribute this software is given under the terms of the NumPy License. |
Module | cb |
Build call-back mechanism for f2py2e. |
Module | cfuncs |
C declarations, CPP macros, and C functions for f2py2e. Only required declarations/macros/functions will be used. |
Module | common |
Build common block mechanism for f2py2e. |
Module | crackfortran |
crackfortran --- read fortran (77,90) code and extract declaration information. |
Module | diagnose |
Undocumented |
Module | f2py2e |
See __usage__ below. |
Module | f90mod |
Build F90 module support for f2py2e. |
Module | func2subr |
Rules for building C/API module with f2py2e. |
Module | rules |
Rules for building C/API module with f2py2e. |
Module | setup |
setup.py for installing F2PY |
Module | symbolic |
Fortran/C symbolic expressions |
Package | tests |
No package docstring; 3/29 modules documented |
Module | use |
Build 'use others module data' mechanism for f2py2e. |
Module | __main__ |
Undocumented |
From __init__.py
:
Function | __dir__ |
Undocumented |
Function | __getattr__ |
Undocumented |
Function | compile |
Build extension module from a Fortran 77 source string with f2py. |
Function | get |
Return the directory that contains the fortranobject.c and .h files. |
Build extension module from a Fortran 77 source string with f2py.
Examples
Parameters | |
source:str or bytes | Fortran source of module / subroutine to compile
Changed in version 1.16.0: Accept str as well as bytes
|
modulename:str , optional | The name of the compiled python module |
extrastr or list , optional | Additional parameters passed to f2py
Changed in version 1.16.0: A list of args may also be provided.
|
verbose:bool , optional | Print f2py output to screen |
sourcestr , optional | Name of the file where the fortran source is written. The default is to use a temporary file with the extension provided by the extension parameter |
extension:{'.f', '.f90'}, optional | Filename extension if
New in version 1.11.0.
|
fullbool , optional | If True, return a
New in version 1.20.0.
|
Returns | |
int or subprocess.CompletedProcess | result - 0 on success, or a subprocess.CompletedProcess if
full_output=True |
Return the directory that contains the fortranobject.c and .h files.
Note
This function is not needed when building an extension with
numpy.distutils
directly from .f and/or .pyf files
in one go.
Python extension modules built with f2py-generated code need to use fortranobject.c as a source file, and include the fortranobject.h header. This function can be used to obtain the directory containing both of these files.
Notes
Unless the build system you are using has specific support for f2py, building a Python extension using a .pyf signature file is a two-step process. For a module mymod:
- Step 1: run python -m numpy.f2py mymod.pyf --quiet. This generates _mymodmodule.c and (if needed) _fblas-f2pywrappers.f files next to mymod.pyf.
- Step 2: build your Python extension module. This requires the
following source files:
- _mymodmodule.c
- _mymod-f2pywrappers.f (if it was generated in Step 1)
- fortranobject.c
See Also
numpy.get_include
- function that returns the numpy include directory
Returns | |
str | include_path - Absolute path to the directory containing fortranobject.c and fortranobject.h. |