[IPython-dev] Fortran Magic for IPython

William Stein wstein at gmail.com
Thu Sep 12 14:38:48 EDT 2013


On Thu, Sep 12, 2013 at 11:35 AM, Damián Avila <damianavila at gmail.com> wrote:
> El 12/09/13 15:25, Ondřej Čertík escribió:
>> Hi,
>>
>> I developed Fortran magic for IPython:
>>
>> https://github.com/certik/ipython_fortran
>>
>> 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:
>>
>> http://fortran90.org/src/rosetta.html
>> http://fortran90.org/src/best-practices.html
>>
>>
>> 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:
>> https://github.com/certik/ipython_fortran/blob/master/fortranmagic.py,
>> 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
>> somehow.
>>
>> * 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
>> repository.
>>
>> I would appreciate any feedback.
>>
>> Ondrej
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> Ondrej, some days ago Martin publish a fortran magic, he also makes a PR
> to give codemirror support for Fortran, maybe both can join forces... ;-)
>
> https://github.com/mgaitan/fortran_magic

And here's a direct link to his fortran mode for CodeMirror:

  https://github.com/mgaitan/CodeMirror/tree/be73b866e7381da6336b258f4aa75fb455623338/mode/fortran

>
> Regards.
>
> Damián.
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org



More information about the IPython-dev mailing list