Using F2x from setup.py

F2x comes with a very good support for distutils based on the great work by numpy <http://numpy.org>. Thanks to own implementations of Extension, build_src, and build_ext.

To take advantage of the adopted build processes, you simply need to use the correct imports:

from F2x.distutils import setup, Extension

There is one additional required parameter to be added to your Extension. You need to provide a wrapping strategy for your extension. The following strategies are already available:

lib

@bindc/_glue.f90.t, @cerr/_cerr.c.t, @ctypes/_glue.py.t

not documented yet

lib_noerr

_glue.f90.t, _glue.py.t

not documented yet

The chapter Build Strategies explains build strategies in more detail.

Including own templates

You can use your own templates by adding them to the template registry. Your template needs to be contained in a F2x template package. Then you can simply add that package to the registry:

from F2x.template import register_template
import my_template_package

register_template(my_template_package)

The allows to reference the template by its name from a custom strategies or the Extensions definitions using the templates attribute.