Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify (some) voila options through URL parameters #105

Open
SylvainCorlay opened this issue Apr 10, 2019 · 13 comments
Open

Specify (some) voila options through URL parameters #105

SylvainCorlay opened this issue Apr 10, 2019 · 13 comments

Comments

@SylvainCorlay
Copy link
Member

We could specify the template name through a URL parameter.

@choldgraf
Copy link
Contributor

(copypasted from a duplicated issue #299)

I've been getting a lot of questions from people asking how they can share Voila dashboards that can both remove the code and show the code depending on the notebook.

To follow up on this issue, it would be useful if one could pass options when Voila is being used as part of the Jupyter server (e.g. within Binder). Something like:

myhub.org/voila/pathtonotebook?parameter=value

and then this could control some of the behavior from within a running jupyter session. This could then be used to control whether code is hidden or not, e.g.:

myhub.org/voila/pathtonotebook?stripOutputs=true

or

myhub.org/voila/pathtonotebook?stripOutputs=false

@jtpio
Copy link
Member

jtpio commented Jul 18, 2019

That would definitely be useful indeed.

Perhaps there should also be a way to provide a spec of the options that can be controlled via the URL parameters (strip_sources, theme, template...) so that custom extensions can present the available values to the users.

These options could be requested from an endpoint (/options for instance) that could return something like this (inspired by the JupyterLab settings schema):

{
  "options": {
    "strip_sources": {
      "title": "Strip Sources",
      "description": "Show or hide input cells",
      "default": false,
      "type": "boolean"
    },
    "theme": {
      "title": "Theme",
      "description": "Theme",
      "default": "light",
      "enum": ["light", "dark"],
      "type": "string"
    },
    "template": {
      "title": "Template",
      "description": "Template name to be used by voila",
      "default": "default",
      "enum": ["default", "gridstack", "vuetify"],
      "type": "string"
    }
  }
}

@timkpaine
Copy link
Member

#218 (comment)

@maartenbreddels
Copy link
Member

Partially implemented by #414 and the other idea (parametrized templates) will be covered by #637

@mkcor
Copy link
Member

mkcor commented May 19, 2021

@jtpio @maartenbreddels as of today, is there a way to pass the equivalent of CLI option --strip_sources=False either in the URL as a query parameter or in the notebook metadata? Thanks!

@maartenbreddels
Copy link
Member

No, but we could implement it similar to 3354ceb but except with the default being 'NOTEBOOK' or 'NO' (for security)

@mkcor
Copy link
Member

mkcor commented May 19, 2021

No, but we could implement it similar to 3354ceb but except with the default being 'NOTEBOOK' or 'NO' (for security)

@maartenbreddels oh, yes, please!! I have a real-world use case for it, namely for sharing the slideshow (on Binder) that @cgusb and I presented at BIDS ImageXD 2021: https://github.com/cgusb/solidification-tracking

@maartenbreddels
Copy link
Member

Why not on the command line btw? Why as a query parameter?

@mkcor
Copy link
Member

mkcor commented May 19, 2021

The command line is enough with a local setup, but I'm referring to the Jupyter server case (as @choldgraf pointed out in a previous comment). People clicking on our Binder badge can view, navigate, interact with the presentation (as you expect with a Voilà app) but, because the code isn't displayed, they miss out on the tutorial aspect of the presentation.

@maartenbreddels
Copy link
Member

This can always be configured, like I do in https://github.com/maartenbreddels/voila-demo/blob/master/jupyter_config.json

@mkcor
Copy link
Member

mkcor commented May 20, 2021

Is Binder actually picking up jupyter_config.json? Could it be that it's seeing:
https://github.com/maartenbreddels/voila-demo/blob/24afc749a3cffc91a555b200a9e39ef9d7bb9c7a/app.yaml#L5
?
I just forked your demo and I'm trying to run voila voila-vuetify.ipynb (without any CLI option) but it doesn't seem to pick up configuration from https://github.com/maartenbreddels/voila-demo/blob/master/jupyter_config.json 🤔

@maartenbreddels
Copy link
Member

https://github.com/maartenbreddels/voila-demo/blob/24afc749a3cffc91a555b200a9e39ef9d7bb9c7a/app.yaml#L5

that is for app engine I think.

voila voila-vuetify.ipynb

If you run voila standalone, rename the file to voila.json I think, but on mybinder it runs as a server extension. Hope that helps!

@mkcor
Copy link
Member

mkcor commented May 20, 2021

that is for app engine I think.

Right (since Binder infers or tries different things, e.g. requirements.txt vs environment.yml, I thought it could possibly parse and use whatever options are specified here and there).

but on mybinder it runs as a server extension.

Right, this is documented here: https://voila.readthedocs.io/en/stable/deploy.html?highlight=voila%20json#customizing-voila-on-binder

If you run voila standalone, rename the file to voila.json I think

It works indeed! Basically I was hitting this exact issue: #826

Hope that helps!

For now, it definitely does, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants