voila-dashboards / voila

Voilà turns Jupyter notebooks into standalone web applications
https://voila.readthedocs.io
Other
5.37k stars 500 forks source link

passing arguments to Voila app #517

Open jgunstone opened 4 years ago

jgunstone commented 4 years ago

I'm using Voila to build python apps internally for an engineering company. It's awesome.

I'd like to know whether it is possible to pass arguments to a Voila App when it is initiated. e.g.

voila app.ipynb inputdata.json

this would be a very useful feature as it would make it easy to interface a Voila App with other workflows.

jtpio commented 4 years ago

Thanks @gunstonej.

Would these arguments be consumed in a notebook? That sounds similar to the prelaunch hook: https://github.com/voila-dashboards/voila/pull/218

johann-petrak commented 1 year ago

I would very much need the same: pass on any number of program specific arguments to the notebook.

Maybe anything passed after the notebook filename could get ignored? Example: voila --debug --no-browser Voila01.ipynb --infile this.tsv --outfile that.tsv

Or, even better IMO, use a special argument separate like "--" to indicate that everything after that should get ignored: voila --debug --no-browser Voila01.ipynb -- --infile this.tsv --outfile that.tsv

The second solution would make it easier to then parse the arguments within the notebook: one could ignore all elements in sys.argv up to and including "--" and then pass the rest to something like argparse.