Open switham opened 11 years ago
The way the code currently works is
So, here is what seems to me a minimum modification. The idea that the web server should always return fast, and the idea of putting the user output in actual files, come from David Baumgold @singingwolfboy .
When a user-python process in the notebook takes a while,
This requires processes or threads on the server. (At least one user-python thread, plus the server itself.) Also requires Ajax (xml-http-request) stuff. I don't even know whether wsgiref.simple_server supports requests in parallel. Not that that's absolutely necessary: the server can return from running a Python block quickly after having launched a separate thread or process to do the actual work.
Anything I do requires some non-trivial (to me) javascript to periodically poll the server for more output. I am imagining polling once a second, not very low latency.
I don't know whether I want to import a complete pseudo-sockets library. It's good not to reinvent the (two-sided Python/Javascript) wheel, but it would have to be pure python on the server, and I want it not too bulky. Assuming multiple open notebooks, what I need here does require streams open in parallel, but only coming from server to client.
When one python block's code is still running, the notebook shouldn't let you start another running.
The idea that you might have multiple notebooks open at once is [https://github.com/switham/pyinthephone/issues/09].