Skip to main content

Just-in-time Fortran extension builder for Python

Project description


pypi version license Binder pipeline status coverage report

Just-in-time compilation of Fortran code in Python via f2py.

Check out the documentation for full details.

Quick start

Start from a piece of Fortran code.f90

subroutine hello()
  print*, "Hello world!"
end subroutine

Compile the code, import it and execute it

from f2py_jit import jit
f90 = jit('code.f90')

Do the same but from a python string containing the source block

source = """
subroutine hello()
  print*, "Hello world!"
end subroutine
f90 = jit(source)

If the Fortran source contains multiple subroutines calling each other, f2py will not perform interprocedural optimizations (at least not by default). f2py_jit can inline the source code before compiling it, and you will get a performace boost [This feature is experimental]

f90 = jit('code.f90', inline=True)


  • Compilation of Fortran source blocks as Python strings
  • Caching of module builds across executions
  • Support for Fortran derived types via f90wrap
  • Inlining to improve performance (experimental)


  • numpy
  • f90wrap
  • Fortran compiler


From pip

pip install f2py-jit

From source

git clone
cd f2py_jit
make install


Part of this code is adapted from numpy.f2py module by Pearu Peterson, in accordance with the NumPy license.


Daniele Coslovich:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

f2py_jit-0.11.0-py2.py3-none-any.whl (24.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page