Opening a notebook with parameters to be set in the first code snippet

Hello,
I would like to open an existing notebook and that some parameters will be set in that notebook (possibly in the first code snippet)
is this possible?

Gal

Maybe the screenshot will make it clearer

Does it need to be in the URL that you are passing the settings for the parameters? If not, Papermill, would work well for you.

I see you’re using the standard jupyter notebook UI. It’s possible to write a small JS extension that modifies the content of cells whenever the notebook is loaded, as described in the following thread:

https://github.com/jupyter/notebook/issues/1451

It’s also possible to do this in Jupyterlab, but it uses a differnet syntax for plugin definitions

As a simpler alternative, you can use the pre/post_save hooks in your jupyter_notebook_config.py to insert/modify cells before they’re written to disk. A downside of this is that the changes will only be visible after the notebook has been saved (and reloaded by the user) at least once

I had the same requirement a while back:

And wrote a small notebook extension:

2 Likes