[IPython-User] Fortran cell magic

Matthias BUSSONNIER bussonniermatthias@gmail....
Mon Sep 9 10:16:55 CDT 2013


Hi !
Le 9 sept. 2013 à 16:16, Martín Gaitán a écrit :

> Hi everybody, 
> 
> This is my first message to the list and I want to begin by thanking every collaborator for the amazing tool that IPython is. 
> 
> I've just finish a (sci)python training course I gave to my company's interns and some researchers from the university based on IPython Notebook (following the emphatic advice of Damián Ávila) and the experience was very successful. Btw, the lecture material (in spanish) is available under a CC license here: 
> 
> https://github.com/mgaitan/python-ingenieria
> 
> My first contribution to IPython is an alpha/hackish cell magic, inspired a bit in the cython one, to embed fortran code directly in the notebook, compile it via f2py and automatically import every symbol to the interactive namespace.  

Great, thanks, this is a good start. I think there was an embryo of f2py magic at some point. 
Maybe you can also scape some code from there ( I don't know maybe there was more functionality)

> 
> https://github.com/mgaitan/fortran_magic
> 
> feedback and PRs more than welcome

Did you know wether or not CodeMirror support Fortran highlighting. 
If so it should be pretty easy to have the notebook switch to fortran mode if it sees the %%fortran
at the start of cell.

You can also add your magic into the ipython cookbook. And don't forget that if yo unmake it a python package it can be installed via PIP.

I would also suggest to get closer to f2py and see if they would like to integrate this into their own repo, so that importing f2py into ipython
would almost automagically load fortran magic. 

See (Break out language magics into their own repos) https://github.com/ipython/ipython/issues/3803 for more info.

Cheers, 
-- 
Matthias

> 
> Cheers. 
> Martín
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130909/ea198e97/attachment.html 


More information about the IPython-User mailing list