I’m trying to get a feature request in the jupyterlab-scenes plugin working. The idea is to use the ipylab-based
app.commands.execute(...) to run a defined set of cells. The thing is, those cells are executed only after the cell with
app.commands.execute(...) is finished, which prevents some fun stuff like looping.
Now. I’m wondering if there is a way to tell the jupyter server to stop the code in a cell at a certain line, ask the front end if it has some other cell to execute in between, and then continue with the original cell’s code.
Thanks a lot!
No, the kernel messaging model has no means to do this.
You could build a bunch of complex asyncio/anyio context managers to wrap things in pausible tasks, but the model wouldn’t match much what people have in their mind.
Hm. I thought so, too bad. Thanks for the quick reply.
As a general note: I believe Mathematica allows to run some code in the middle of other cells’ executions. I used this many years ago and I still miss this functionality today in ipython. You could use this mid-task to modify run settings. Not very well controlled, I’ll admit, but very useful nonetheless. But I guess this wouldn’t even be a jupyter issue but more a general python issue.