[IPython-dev] IPython magic that display version information for dependency modules

Matthias BUSSONNIER bussonniermatthias at gmail.com
Mon Jul 8 02:44:57 EDT 2013

Hi Rob, 

Le 8 juil. 2013 à 06:08, jrjohansson at gmail.com a écrit :

> Hi
> To promote reproducibility of shared IPython notebooks I often find it useful to include some version information for modules at the end of the notebook (with lots of dependencies a lot of things can go wrong...).
> I've create a simple IPython magic command extension that displays such information in an HTML table (suitable for use in the notebook). See
> http://nbviewer.ipython.org/urls/raw.github.com/jrjohansson/version_information/master/example.ipynb
> Is there a built-in functionality of this kind in IPython that I'm not aware of, or some other better way of doing this? If not I think it would be a nice to have something like this included directly in IPython.

No there is no tool like that in IPython, we believe that this in particular is not our job to do, but that we could provide structure
to do so. We  let the community free to decide and polish the idea first.

Your example look nice, but I will suggest some things. That are, by the way, some 
general remarks that are useful for custom objects/extension of anyone.

Don't return HTML, except in a _repr_html_.

This make the extension useless in terminal, not sure it it's works in qtconsole. 
It's a pain to parse programatically. It won't be converted to TeX and other format
by nbconvert....etc

I would propose to define many _repr_xxx_ by starting by the json one which is the easiest
to be machine-consumable and from this you can define _repr_html_ _repr_pretty_ , maybe a_repr_latex_
... By doing this, your extension will become compatible with all clients, and the notebook-document 
**will store all the repr** meaning that they will be available to nbconvert, or any script that consume a notebook.

Otherwise look nice, please add to the wiki on the list of extensions. 

More information about the IPython-dev mailing list