[IPython-dev] Widget idea: Global Parameters

Matthias BUSSONNIER bussonniermatthias at gmail.com
Sat Apr 5 15:26:27 EDT 2014


I might misremember and/or misunderstand , but it seem to me that theses propositions have already been 
disscussed on the ML, and that the response was that such a thing is  out of scope for the time being. 

It is relatively easy to build as a standalone project and IIRC some project like runipy already
implement theses functions. (cf copy from read me below) 

-- 
Matthias



Passing Arguments

You can pass arguments to the notebook through environment variables. The use of environment variables is OS- and shell- dependent, but in a typical UNIX-like environment they can be passed on the command line before the program name:

$ myvar=value runipy MyNotebook.ipynb

Then in the notebook, to access myvar:

from os import environ
myvar = environ['myvar']

environ is just a dict, so you can use .get() to fall back on a default value:

from os import environ
myvar = environ.get('myvar', 'default!')

Le 5 avr. 2014 à 20:16, Antonino Ingargiola a écrit :

> I second the idea. I think it is a common pattern (at lest for me) to create a notebook to perform an analysis and then to process a series of datasets for comparison.
> 
> Right now I create several notebook copies manually, but as Jake says, it quickly becomes tricky once you want to tweak the analysis (either you modify N notebooks or re-create the N copies).
> 
> Some sort of parametrization of the notebooks would be useful, and using the widget infrastructure seems a sensible idea.
> 
> Antonio
> 
> 
> On Fri, Apr 4, 2014 at 9:01 AM, Jacob Biesinger <jake.biesinger at gmail.com> wrote:
> Hi!
> 
> I don't follow this list very closely but had an idea I thought worth sharing.  I'm not sure if this is the right list to share to but here goes:
> 
> I find myself creating notebooks as reports on different datasets and parameters.  There are a few global variables listed at the top and after the code munging phase is complete, I make duplicates of the notebook, only changing the global variables and rerunning all the cells.  This quickly becomes unmanageable.  Additional notebooks are hard to maintain and tweak whereas maintaining a single notebook means I have to rerun the report for every tweak. I also can't compare reports without copying notebooks.
> 
> What if we had a way to specify "report parameters", global variables you can modify using a widget interface (dropdown, slider, input box, etc but tied to multiple cells or possibly the whole notebook) and a caching mechanism to store notebook contents for each combination of report parameters? I'm imagining quickly switching the dataset for a series of graphs I'm looking at and having the graphs already cached for the ones I've looked at, or having the report run for any new combinations.
> 
> I suppose I could open multiple tabs on the same report to simulate some of this though it seems the autosaves would conflict.
> 
> Thanks for listening!
> --
> Jake Biesinger
> Graduate Student
> Xie Lab, UC Irvine
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
> 
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list