[IPython-dev] headless IPython

Andrew Dalke dalke at dalkescientific.com
Wed Apr 18 19:54:39 EDT 2007

I've got an idea I would like to work on but I'm having
a hard time getting started.

What I want is an interactive Python session through a web interface.
I'm doing this for chemistry so my example is:

   >>> mol = load_molecule("input_filename")
   >>> repr(mol)
   <Molecule object at 0x827f0>)
   >>> mol

      /        \
     /          \
     \\         //
      \\       //


That is, molecule objects are displayed using one of several
ways to depict the structure (image, java applet, or plugin,
depending on user configuration).

This will build up into a larger system, with more data types.
For example, ideally I would also like if 'p' were a matplotlib
plot then typing 'p'

    >>> p

should inline the plot in the browser display.  Very much like
Mathematica and similar projects.

SAGE has something like this, but the server part of the
web-based notebook implementation is not what I want.  For
example, it doesn't use IPython.  It's built around standard
exec (at least in 2.0) and the web server code talks to the
Python shell instance through 'expect' using a protocol
which doesn't seem to handle what I want to do.

My thought was to take the value in "_" and use object adaptation
to get an adapted/proxy instance that returns a chunk of HTML
for display.  It would also need to register resources, like
images, needed for the display component.

I'm getting stuck with how to embed IPython in this sort of
case.  Everything I see suggests that it really wants to be
connected to a terminal, and not to some system which does
its own I/O.

My system may be a bit esoteric.  For something a bit more
normal, consider running IPython inside of IDLE or some
other system which does its own I/O.  How would I do that?
I can't find any good examples of this.

I'm still working to figure out how all the parts fit together
so please correct any misunderstandings/errors you see in what
I wrote.

				dalke at dalkescientific.com

More information about the IPython-dev mailing list