[IPython-dev] headless IPython

Gael Varoquaux gael.varoquaux at normalesup.org
Fri Apr 20 03:16:07 EDT 2007

On Fri, Apr 20, 2007 at 12:25:54AM +0200, Andrew Dalke wrote:
> >http://gael-varoquaux.info/computers/pyreport/

> Thank you for point it out.  I looked at it, but I don't think
> it's what I was looking for.

> I really do want an interactive web page there.  For example,
> the display for the molecule should use one of the various
> chemistry plugins to display the molecule and allow it to
> be rotated.

> I would also like to open a CSV or similar file and have
> the default view be a mini-spreadsheet table.

> One of the tricky points is getting partial feedback during
> long compute jobs, along with killing a running function.
> Consider:

> for i in range(10):
>   print i
>   time.sleep(1)

> I would like to see the "1" then the "2" then the ...
> as they appear, or to within 1/10th of a second, rather
> than waiting the full 10 seconds before I see a response.
> This is highly interactive, and it doesn't appear that
> your code is designed for this.

I have been reworking it lately for this purpose. In the latest version
of the code that you can retrieve with 
"bzr branch http://gael-varoquaux.info/pyreport" you can see that part of
the chain has been rewriten using iterators. It goes like this (very

blocks = (block for blick in iterblocks(file))
output_list = sandbox(blocks)

Both sandbox and iterblocks take iterators, wich means they are suited
for on the fly processing of lines (create an file object that has a
.next method, and inject your code though the .next method). One problem
is that the iterblocks iterator does not return for each ".next()"
consumed. This can probably be changed by adding a few "yield None" in
clever places. Another solution is to use two threads, a producer and a

The rest of the compile chain has not been rewriten using iterators so
far, but I am planning to do this.

I am not saying the code is currently suited for what you want, but I
think have done a good amount of the work and will keep on working
towards that, though quite slowly due to my day work. A lot of the
existing code has been writen a while ago, when I was quite new to
Python, and does need reworking, but I know how I want to refactor it and
I am making slow progress on it.

I would really like pyreport to be useable as a back-end for editors and
co, and I think this would provide the kind of API you are looking for.



PS: I am re-route the discussion toward the ipython-dev list. I got it
off by mistake.

More information about the IPython-dev mailing list