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

Allowing notebook parameterisation #13

Open
janfreyberg opened this issue Nov 1, 2018 · 11 comments
Open

Allowing notebook parameterisation #13

janfreyberg opened this issue Nov 1, 2018 · 11 comments

Comments

@janfreyberg
Copy link

Would it be possible / desirable to enable notebook parameterisation with URL parameters? I'm currently thinking about using notebooks as external services integrating with amazon MTurk, and it would be great to be able to allow reading of URL parameters.

It could be done with something like https://github.com/takluyver/nbparameterise #maybe?

It should probably be turned off by default to prevent unexpected or malicious behaviour.

@maartenbreddels
Copy link
Member

I really like the idea, and I also thought of papermill's method to implement this.

@jtpio
Copy link
Member

jtpio commented Oct 2, 2019

There is also the idea of having parameterized kernelspecs.

@janfreyberg
Copy link
Author

this would be cool but might make it confusing to pass parameters for different things (the kernel spec & variables in the notebook) in the same manner (e.g. as key-value URL parameters).

@timkpaine
Copy link
Member

timkpaine commented Nov 13, 2019

#218 (comment)

the above gives you arbitrary access to the request and the notebook

For papermill specifically, I just did #484

@angusfong
Copy link

@timkpaine Thanks for your work on this. In the latest code (I am using v0.2.15 there doesn't seem to be a prelaunch_hook object in Voila. Was this changed somewhere? How can I parameterize (add a single variable?)

@SylvainCorlay
Copy link
Member

cc @trungleduc

@trungleduc
Copy link
Member

trungleduc commented Oct 17, 2021

Hi @angusfong, can you give us more details about your use case?

@timkpaine
Copy link
Member

There are PRs for prelaunch hook and papermill, they are old but the logic is very simple:

#724

#484

If there is renewed interest in this I will update the PRs.

@angusfong
Copy link

Thanks. Will those PR's be merged, or should I install at those commits? (coming from an open source-world newbie :))

My use case:

  • A voila Dashboard renders predictions for a given model configuration, specified by an experiment_id. Final step of an ML pipeline. So, the experiment_id needs to be passed to the ipynb.

@angusfong
Copy link

@timkpaine would you mind updating PR #724 so that it works with the current code?

@trungleduc
Copy link
Member

trungleduc commented Oct 18, 2021

@angusfong currently in the pre-release version of voila (0.3.0a2), we have a new feature called "Preheated kernels" which allows Voila to warn up the kernel and pre-render the notebook. This feature also allows users to define their environment variables for each notebook ( the kernel_env_variables key of the configuration file) so that users can get the simple parameters through os.getenv inside the notebook.

We might consider allowing users to define notebook specified environment variables in normal kernel mode too.

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

7 participants