[IPython-dev] Nbparameterise: simple forms for notebook input

Matthias BUSSONNIER bussonniermatthias at gmail.com
Wed Oct 8 16:21:31 EDT 2014


Great !

I think runipy already have such a feature, but I might have misunderstood :


> 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!')

from https://github.com/paulgb/runipy


Maybe you can share part of the code.
-- 
M


Le 8 oct. 2014 à 21:10, Thomas Kluyver a écrit :

> Introducing another of my side projects: Nbparameterise
> 
> https://github.com/takluyver/nbparameterise
> 
> The idea is that you prepare a notebook with some 'input' variable definitions in the first cell. These are standard assignments, like `a=200`, of (for now), strings, numbers and booleans. When you run nbparameterise, it will display a simple form where the user can supply new values for these variables. When the user clicks 'run notebook', their values are substituted in, the notebook is run and rendered to HTML.
> 
> To see a demo of this, clone the repository, run:
> 
> python3 -m nbparameterise Stock\ display.ipynb
> 
> and visit http://localhost:8888/ in your browser.
> 
> Notes:
> - It builds an HTML form, but I've tried to abstract that from the core, so you could write a local GUI or a terminal interface for it quite easily.
> - It's written in Python 3, but it will run notebooks in Python 2 if that's what the metadata indicates.
> - We can integrate backends for other languages
> - It's fairly rough - come and polish it.
> 
> We've heard from a couple of companies doing similar things privately; I hope this can form a common base.
> 
> Thomas
> 
> P.S. Suggestions for a better name welcome.
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141008/472c552b/attachment.html>


More information about the IPython-dev mailing list