On Tuesday, January 19, 2016 at 1:55:38 PM UTC-8, takowl wrote:
On 19 January 2016 at 21:46, Matthias Bussonnier
<bussonnie...@gmail.com> wrote:
I think you might be interested in looking at
and
I used runiy in the past, but the argument passing is through environment variables which is very cumbersome IMHO. With "my" (or Thomas) approach I can pass strings, numbers, and list/dict of strings and numbers easily.
The key feature of nbparameterise is that you have a notebook that still makes sense when you open it and run it normally, rather than it referring to external things like environment variables. Passing parameters in works by replacing values in the first cell and re-running it.
Thomas, I wasn't aware of nbparametrize (or maybe I saw it in the past then forgot about it?). This is the same concept I implemented in nbrun, only I just insert a second cell, instead of rewriting the first one. In this way I don't need to manipulate an existing cell and the first cell indicates default values.
Looking at nbparameterize code, here some other differences:
- I'm saving executed notebooks as as ipynb, not HTML. I like to be able to jump directly to a failing notebook by clicking on the link printed on the "master notebook".
- I serialize an input dict of arguments to a string containing a series of assignment using repr(). Quick and dirty way to pass a wide range of basic python types (must have a complete literal representation).
- nbrun is an much less sophisticated than nbparametrize, it contains only a single .py with two small functions (only one "public").
I also conventionally document the input arguments of a template notebook (a notebook to be parametrized) in a markdown cell, see:
Overall I'm pretty happy with the result which required a ridiculously low effort on my part (thanks to nbconvert doing all the work). I'd like to see something like this becoming a more standard functionality, for example in nbconvert.
Antonio