[IPython-User] custom tooltips (docstring) for cell magics in notebook

Ben Mabey ben@benmabey....
Thu Jan 24 22:40:37 CST 2013

Hi all,
Based on the current behavior of the R cell magic it looks like the 
docstring tooltips in the notebook always return docstrings for python 
functions.  Being able to customize the tooltips for various magics 
would be a useful feature IMO.

A cursory browsing of tooltip.js seems to indicate that docstrings are 
fetched from the kernel via the 'object_info_request' message/command.  
The only thing being passed to this handler is the name of the function 
you want the docstring for and not any context of the cell it is being 
ran in.  Ideally a cell magic could provide a custom `object_inspect` 
that would be used instead of the default one in the shell object (i.e. 
python's).  The tooltip js code would then need to also pass info to the 
kernel about the cell magic of the current cell so the kernel can 
attempt to delegate `object_inspect` appropriately.

Has any thought or effort already been put into allowing for cell magic 
aware tooltips?


More information about the IPython-User mailing list