For the last several days I have been studying the IPython 2.3.1 sources. 
Naturally, I used Leo to import the sources.  You may find them at: 
https://github.com/leo-editor/leo-editor-contrib

The file is leo-editor-contrib/StudyOutlines/IPython.leo

I have been studying these sources with the idea of creating an 
execute-script-in-ipython command. This command would do the following:

A.  Handle @others and section references, just like Leo's execute-script 
does.

B.  Pass the resulting script to an IPython kernel.

If necessary, the execute-script-in-ipython command would start an IPython 
kernel in a separate process, much like Leo's existing --ipython 
command-line option does.  This kernel *might* be connected to a visible qt 
terminal, but this is optional, and possibly not desirable.

C. Get IPython results (output cells) from the kernel and pass them to the 
viewrendered pane.

This can probably be done by hooking IPython's display methods.  Iirc, 
these methods can produce html output, so the viewrendered pane should have 
no trouble dealing with them.

In essence, this scheme would make each Leo body text an IPython cell 
(equivalently, an IPython notebook cell).  The viewrendered pane would show 
the results of the last cell.  It would be easy to cache the corresponding 
output html in a uA, so that switching nodes would show the corresponding 
output in the vr pane.

Imo, this would result in an IPython notebook with of all Leo's features.  
It would be a serious competitor to the IPython's own web-based notebook.

My general impression is that somebody truly "fluent" in the IPython 
sources could implement this scheme in Leo in 20-50 lines of code.  All 
that might be required would be to create a short IPython wrapper kernel: 
http://ipython.org/ipython-doc/dev/development/wrapperkernels.html

However, the wrapper code does not appear to work with IPython 2.x: it 
might, however, work with IPython 3.x.  Furthermore, the code is difficult 
for me to understand.  Otoh it might be relatively straightforward for 
somebody with stronger client/server background than I have.

In short, I think making Leo a true IPython notebook might make a great 
sprint.  The payoff will be huge, and it might take the right team of 
people just a few hours to get a prototype working.

This would not have to be a "physical" sprint: conceivably we could do the 
work here, on leo-editor.  And it doesn't have to much of a "sprint": it 
could take months and still be worthwhile.

Your comments, please, Amigos.

Edward

P.S.  Although important parts of the sources are mysterious to me, I do 
understand them in enough detail to be able to act as a guide to what they 
do and how they do it.  I'm willing to answer any questions you may have.  
Conversely, if there is interest here, I start asking questions here about 
the mysterious bits of code.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to