1F2PY(1) General Commands Manual F2PY(1)
2
3
4
6 f2py - Fortran to Python interface generator
7
9 (1) To construct extension module sources:
10
11 f2py [<options>] <fortran files> [[[only:]||[skip:]] <fortran func‐
12 tions> ] [: <fortran files> ...]
13
14 (2) To compile fortran files and build extension modules:
15
16 f2py -c [<options>, <config_fc options>, <extra options>] <fortran
17 files>
18
19 (3) To generate signature files:
20
21 f2py -h <filename.pyf> ...< same options as in (1) >
22
24 This program generates a Python C/API file (<modulename>module.c) that
25 contains wrappers for given Fortran or C functions so that they can be
26 called from Python. With the -c option the corresponding extension
27 modules are built.
28
30 -h <filename>
31 Write signatures of the fortran routines to file <filename> and
32 exit. You can then edit <filename> and use it instead of <for‐
33 tran files>. If <filename>==stdout then the signatures are
34 printed to stdout.
35
36 <fortran functions>
37 Names of fortran routines for which Python C/API functions will
38 be generated. Default is all that are found in <fortran files>.
39
40 skip: Ignore fortran functions that follow until `:'.
41
42 only: Use only fortran functions that follow until `:'.
43
44 : Get back to <fortran files> mode.
45
46 -m <modulename>
47 Name of the module; f2py generates a Python/C API file <module‐
48 name>module.c or extension module <modulename>. Default is
49 ´untitled´.
50
51 --[no-]lower
52 Do [not] lower the cases in <fortran files>. By default, --lower
53 is assumed with -h key, and --no-lower without -h key.
54
55 --build-dir <dirname>
56 All f2py generated files are created in <dirname>. Default is
57 tempfile.mktemp().
58
59 --overwrite-signature
60 Overwrite existing signature file.
61
62 --[no-]latex-doc
63 Create (or not) <modulename>module.tex. Default is
64 --no-latex-doc.
65
66 --short-latex
67 Create 'incomplete' LaTeX document (without commands \document‐
68 class, \tableofcontents, and \begin{document}, \end{document}).
69
70 --[no-]rest-doc
71 Create (or not) <modulename>module.rst. Default is
72 --no-rest-doc.
73
74 --debug-capi
75 Create C/API code that reports the state of the wrappers during
76 runtime. Useful for debugging.
77
78 -include´<includefile>´
79 Add CPP #include statement to the C/API code. <includefile>
80 should be in the format of either `"filename.ext"' or `<file‐
81 name.ext>'. As a result <includefile> will be included just
82 before wrapper functions part in the C/API code. The option is
83 depreciated, use `usercode` statement in signature files
84 instead.
85
86 --[no-]wrap-functions
87 Create Fortran subroutine wrappers to Fortran 77 functions.
88 --wrap-functions is default because it ensures maximum portabil‐
89 ity/compiler independence.
90
91 --help-link [..]
92 List system resources found by system_info.py. [..] may contain
93 a list of resources names. See also --link-<resource> switch
94 below.
95
96 --quiet
97 Run quietly.
98
99 --verbose
100 Run with extra verbosity.
101
102 -v Print f2py version ID and exit.
103
104 --include_paths path1:path2:...
105 Search include files (that f2py will scan) from the given direc‐
106 tories.
107
109 The following options are effective only when -c switch is used.
110
111 --help-compiler
112 List available Fortran compilers [DEPRECIATED].
113
114 --fcompiler=<name>
115 Specify Fortran compiler type by vendor.
116
117 --compiler=<name>
118 Specify C compiler type (as defined by distutils)
119
120 --fcompiler-exec=<path>
121 Specify the path to F77 compiler [DEPRECIATED].
122
123 --f90compiler-exec=<path>
124 Specify the path to F90 compiler [DEPRECIATED].
125
126 --help-fcompiler
127 List available Fortran compilers and exit.
128
129 --f77exec=<path>
130 Specify the path to F77 compiler.
131
132 --f90exec=<path>
133 Specify the path to F90 compiler.
134
135 --f77flags="..."
136 Specify F77 compiler flags.
137
138 --f90flags="..."
139 Specify F90 compiler flags.
140
141 --opt="..."
142 Specify optimization flags.
143
144 --arch="..."
145 Specify architecture specific optimization flags.
146
147 --noopt
148 Compile without optimization.
149
150 --noarch
151 Compile without arch-dependent optimization.
152
153 --debug
154 Compile with debugging information.
155
157 The following options are effective only when -c switch is used.
158
159 --link-<resource>
160 Link extension module with <resource> as defined by numpy_distu‐
161 tils/system_info.py. E.g. to link with optimized LAPACK
162 libraries (vecLib on MacOSX, ATLAS elsewhere), use
163 --link-lapack_opt. See also --help-link switch.
164
165
166 -L/path/to/lib/ -l<libname>
167
168 -D<define> -U<name> -I/path/to/include/
169
170 <filename>.o <filename>.so <filename>.a
171
172
173 -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN -DUNDER‐
174 SCORE_G77
175 Macros that might be required with non-gcc Fortran compilers.
176
177
178 -DF2PY_REPORT_ATEXIT
179 To print out a performance report of F2PY interface when python
180 exits. Available for Linux.
181
182
183 -DF2PY_REPORT_ON_ARRAY_COPY=<int>
184 To send a message to stderr whenever F2PY interface makes a copy
185 of an array. Integer <int> sets the threshold for array sizes
186 when a message should be shown.
187
188
190 Python 1.5.2 or higher (2.x is supported).
191
192 Numerical Python 13 or higher (20.x,21.x,22.x,23.x are supported).
193
194 Optional Numarray 0.9 or higher partially supported.
195
196 numpy_distutils from Scipy (can be downloaded from F2PY homepage)
197
199 python(1)
200
202 For instructions on reporting bugs, see
203
204 http://cens.ioc.ee/projects/f2py2e/FAQ.html
205
207 Pearu Peterson <pearu@cens.ioc.ee>
208
210 Main website: http://cens.ioc.ee/projects/f2py2e/
211
212 User's Guide: http://cens.ioc.ee/projects/f2py2e/usersguide/
213
214 Mailing list: http://cens.ioc.ee/mailman/listinfo/f2py-users/
215
216 Scipy website: http://www.numpy.org
217
219 Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Pearu Peterson
220
222 NumPy License
223
225 2.45.241
226
227
228
229 F2PY(1)