News for hackers. Stuff that matters.
Re:JupyterLab is ready for users by Tenoke on Tuesday February 20, 2018 @10:27AM (#16421004)
The simplest (and still educational) way would be to have the stuff in the different cells as functions, and to collect all the functions that should be re-run in a single cell.

To do it more properly, however, you can have a post_save_hook for the whole notebook, which runs the code from whichever cells however often you want outside of the notebooks. Of course, this way you wont see the output in the notebook.

Re:JupyterLab is ready for users by danielvf on Tuesday February 20, 2018 @10:32AM (#16421058)
Yeah, output right in the notebook is important. I'm wanting them to be able to do something like this in a cell:

    for ship in myShip.radarScan():
        if ship.is_enemy:
            display([ship.type, ship.range, ship.bearing])
And then have that cells results always showing the current data as they play the game.
Re:JupyterLab is ready for users by Tenoke on Tuesday February 20, 2018 @10:42AM (#16421144)
I haven't used it much, but I believe you can do this by using (or more likely slightly extending) the init_cell nbextension.

https://jupyter-contrib-nbextensions.readthedocs.io/en/lates...

Re:JupyterLab is ready for users by danielvf on Tuesday February 20, 2018 @10:52AM (#16421223)
Oh, that's cool - it's just some javascript that's essentially clicking execute on the selected cells. That makes sense, and hacked up version of this could work fine! Thanks!
Re:JupyterLab is ready for users by lowpro on Tuesday February 20, 2018 @11:28AM (#16421511)
If you get this working my cousin teaches elementary school and I'd love to show it to her! Please upload it if you're feeling generous :)
Re:JupyterLab is ready for users by danielvf on Tuesday February 20, 2018 @11:53AM (#16421753)
I'll definitely post it to GitHub, and I'll do a Show HN after I've used it in class.
Re:JupyterLab is ready for users by po84 on Wednesday February 21, 2018 @07:22AM (#16428902)
> And then have that cells results always showing the current data as they play the game.

display handles that you can update from elsewhere in the notebook might be of interest. Here's an example:

https://github.com/ipython/ipython/blob/master/examples/IPyt...