[IPython-User] Pretty rendering of docstrings

Matthias BUSSONNIER bussonniermatthias@gmail....
Wed Feb 6 07:20:44 CST 2013


A Mail I was sure to have send long ago but still in my drafts... 

Le 24 janv. 2013 à 22:23, Brian Granger a écrit :

> On Thu, Jan 24, 2013 at 1:00 PM, Matthias BUSSONNIER
> <bussonniermatthias@gmail.com> wrote:

> 
> Not in how I imagine it.  The payload/pager protocol would simply send
> back the raw docstring.  The client web app would look at the
> docstring format and figure out what to do with it.

I don't think this is a good idea, I don't what to see all the clients (over 0MQ and web socket like EIN)
reinventing the wheel and trying to guess the format of the docstring and to parse it…

IMHO you should see docstring as object like (almost) any other python object that have _repr_*.
The only difference here is that you have also the reverse problem of the origin format.

Computing on the server has a lot of advantages, you can cache computed repr (based on doctoring hash ?)
embed picture if needed, (ouh docstring with matplotlib examples !). And you can transmit the docstring in different format to frontend  and they can choose.
This include the raw docstring if needed.

Also you could imagine that docstring can point to an external builded file (with sphinx ?) that contain much more information than 
what could be extracted from a simple docstring (cross references ?).
And if you are concerned about web socket  bandwidth, you can also just send an URL that is served
by a trusted static web server that contain the needed data (This would work really great with proxy/ browser caching)


-- 
Matthias



More information about the IPython-User mailing list