News for hackers. Stuff that matters.
Re:How to Grow Software Architecture out of Jupyter Notebooks by breatheoften on Wednesday December 12, 2018 @05:34AM (#18662740)
I made a module to offer some more options for some of these problems recently - particularly useful when you have code that you _want_ to keep organized in a notebook for continued interactive experimentation and/or for explaining a prototype process — but you also want to reuse that code in an external script or program. Let’s you call any notebook as a function. Keyword arguments can be passed and there’s a simple way to receive these values within the notebook to allow the notebook to be parametrizable when invoked externally.

https://github.com/breathe/NotebookScripter

Re:How to Grow Software Architecture out of Jupyter Notebooks by davecap1 on Wednesday December 12, 2018 @06:18AM (#18662941)
Is this similar to papermill?

https://github.com/nteract/papermill

Re:How to Grow Software Architecture out of Jupyter Notebooks by breatheoften on Wednesday December 12, 2018 @09:29AM (#18664147)
I hadn’t come across papermill before - looks quite full featured. Seems to be oriented a bit towards “scripting Notebooks” with the ability to generate output notebook files with populated output cells. I think it must have to emulate some of the logic of the Notebook ui to do that.

NotebookScripter is much more minimal and doesn’t support generating/updating .ipynb files. It has just one api allowing one to treat a notebook file as a function that can be called from another python program.

I’m not entirely sure whether papermill can run the target notebook in the calling process — it looks like it spins up a Jupyter kernel and communicates with it via message passing. NotebookScripter creates an ipython interpreter context in process and execs the notebook code in process.