[IPython-User] custom tooltips (docstring) for cell magics in notebook
Fri Jan 25 11:48:55 CST 2013
In addition to tooltips, it would be *nice* to have tab completion
work in cell magics. However, this would require a massive change in
the cell magic API - basically cell magics would have to become mini
kernels that support the kernel API. We would also have to change the
messaging protocol to be able to talk to these mini kernels. While
these features would be nice, I think they would add far more
development/maintenance complexity than the value they add. We could
try to hack it all together, but that would be even less helpful for
the code base. I am -1 on this.
On Fri, Jan 25, 2013 at 1:50 AM, Matthias BUSSONNIER
> Le 25 janv. 2013 à 05:40, Ben Mabey a écrit :
>> 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?
> This is a idea to pursue, unfortunately I don't think it will be that easy.
> You have to detect that you are actually in a cell magic, ad as the kernel is concerned,
> cell magic are just function that take a string an execute something base on this string.
> It does not always imply another language.
> We probably want to have a way to get tooltip for other languages but we need to keep in mind that
> this should also be the case fro other fronted than notebook. In notebook it should not be too hard to
> 'detect' some cell magic as different languages (it already does it for highlighting), but this is not alway the case.
> There is one PR right now which decouple the tooltip from the rest of the notebook, and it might be easier to customize.
> What might be to consider is the ability to also have native kernels so that you could directly ask to the corresponding kernel
> instead of trying to go through the IPython one.
>> IPython-User mailing list
> IPython-User mailing list
Brian E. Granger
Cal Poly State University, San Luis Obispo
firstname.lastname@example.org and email@example.com
More information about the IPython-User