[IPython-dev] Fortran Magic for IPython

Ondřej Čertík ondrej.certik@gmail....
Thu Sep 12 13:25:21 CDT 2013


I developed Fortran magic for IPython:


Follow the link in the README for an example notebook. Travis
suggested this idea to me yesterday in a pub. ;)

You should be able to run everything from:


Some notes:

* the syntax highlighting is wrong for Fortran, both in code cells an
markdown cells

* it'd be nice to automatically wrap via Cython some subroutines to
Python with %%fwrap magic, currently I just execute the code with the
%%fortran magic

* it'd be nice to allow to link my Fortran library in, so that I can
interactively test subroutines in it. So I use my current build system
for my library, and just tell the %%fortran magic to link it + paths
to *.mod files, so that I can import modules. That should be quite
robust/simple to do. The only requirement is to use the same compiler.

* what is the best way to setup different compilers and compiler
options in the %%fortran magic? The code is here:
it's really simple so far.

* all cells are currently independent. I don't think it makes sense to
try to somehow append and execute code together from multiple cells.
But it might make sense to reuse modules defined in different cells

* Eventually I'd love to contribute a PR against IPython notebook with
this extension, but for now I am just polishing it in the above

I would appreciate any feedback.


More information about the IPython-dev mailing list