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

Do not run all cells when opening notebook #92

Closed
karlwessel opened this issue Apr 27, 2020 · 15 comments
Closed

Do not run all cells when opening notebook #92

karlwessel opened this issue Apr 27, 2020 · 15 comments

Comments

@karlwessel
Copy link
Contributor

The title of the issue does not quite capture what I want, but is a prerequisite for it. Here is what I really want and the use-case for it:

It sometimes happens that I have a really convoluted exploratory notebook where not all cells depend on each other. It further happens that after loading that notebook, that I don't wan't to run all of it but only a certain cell, because I need only that cells output.

If I execute that cell after opening the notebook, would it be possible for Pluto to detect which other cells that cell depends on and only run those? Without having to run all cells once beforehand?

@fonsp
Copy link
Owner

fonsp commented Apr 27, 2020

Thanks for posting these issues!

You can disable auto-run by setting a flag before starting the server:

julia> using Pluto
julia> Pluto.CONFIG["PLUTO_RUN_NOTEBOOK_ON_LOAD"] = "false"
julia> Pluto.run(1234)

This should use ENV instead, (but I had some trouble getting the latest ENV variables from the worker processes) so this syntax might change at some point. You should then be able to set the ENV variable in your startup julia file to make it permanent.

@fonsp
Copy link
Owner

fonsp commented Apr 27, 2020

What you are suggesting is a creative solution, but it means implementing downstream evaluation (and disabling upstream evaluation?) during the first run - this would make the effect of clicking "run cell" ambiguous.

Implementing auto-run (and adding an option to disable it) was very intentional. It means that the notebook is reactive right away, instead of all cells starting out in a limbo state of having synchronised code but not yet being part of the reactivity graph.

I think the current solution is much more in line with the philosophy of the project - your notebook is a descriptive program, not an imperative one.

@karlwessel
Copy link
Contributor Author

I think I understand what you mean: I should consider a notebook as one whole reactive object which happens to be extendable incrementally cell-wise. It is not a collection of more or less separate cells. The latter is probably what Jupyter is there for.

With that in mind I can totally accept the coffee-time forced upon me when a notebook starts :-).
And I think your proposal from issue #71 - to be able to enable and disable notebooks from Pluto's home screen - makes even more sense now and would underline the fact that a notebook is a whole thing. Being able to enable and load it off-screen would somewhat hide the current "Although you can see me, I'm not quite ready yet"-unresponsive-feeling when the notebook is loaded.

@Moelf
Copy link
Contributor

Moelf commented Aug 8, 2020

update:
Pluto.ENV_DEFAULTS["PLUTO_RUN_NOTEBOOK_ON_LOAD"] = "false"

@fonsp
Copy link
Owner

fonsp commented Aug 12, 2020

The environment variable you mentioned is a 'hidden' feature, and it will be removed soon.

I am working on a solution that is much more friendly:
#259 (comment)

@tachsin
Copy link

tachsin commented Nov 29, 2021

Pluto.CONFIG["PLUTO_RUN_NOTEBOOK_ON_LOAD"] = "false"
Pluto.ENV_DEFAULTS["PLUTO_RUN_NOTEBOOK_ON_LOAD"] = "false"

Neither of these works for me. what is the updated code? And please disable autorun by default, why is it enabled by the way what use does it have? It is just annoying!!

@teamclouday
Copy link

teamclouday commented Apr 18, 2022

For the recent version, looks like the following works:

Pluto.run(Pluto.Configuration.from_flat_kwargs(;run_notebook_on_load=false))

More options can be found here:

run_notebook_on_load::Bool = RUN_NOTEBOOK_ON_LOAD_DEFAULT,

Hope a keyboard shortcut for "execute all cells above" can be added in the future.

@filchristou
Copy link

For the recent version, looks like the following works:

Pluto.run(Pluto.Configuration.from_flat_kwargs(;run_notebook_on_load=false))

Doesn't work for me now in Julia 1.8.1 and Pluto v0.19.11
I agree that it's disturbing and that it should be easier to process a notebook before running it.

@kpa28-git
Copy link

Doesn't work for me now in Julia 1.8.1 and Pluto v0.19.11 I agree that it's disturbing and that it should be easier to process a notebook before running it.

Doesn't work for me either. Oddly enough it seems to be adding a delay of a few seconds before the notebook is run anyway.

@teamclouday
Copy link

Doesn't work for me now in Julia 1.8.1 and Pluto v0.19.11

Interesting, I just checked it again with Julia v1.7.0 and Pluto v0.19.9, and it still works for me.
Did you run the line from terminal, replacing Pluto.run()?

@kpa28-git
Copy link

kpa28-git commented Sep 21, 2022

I normally launch pluto from a shell alias: plo='julia -e "using Pluto; Pluto.run()"'
I tried running julia -e "using Pluto; Pluto.run(Pluto.Configuration.from_flat_kwargs(;run_notebook_on_load=false))"
I'll try running it from the REPL manually to see if it makes a difference.

Update: Running from the REPL gives the same behavior as julia -e ...

@teamclouday
Copy link

Update: Running from the REPL gives the same behavior as julia -e ...

How about using Pluto; Pluto.run(;run_notebook_on_load=false)
I looked at the code at:

options = Configuration.from_flat_kwargs(; kwargs...)

So run_notebook_on_load option can be passed in like that

@kpa28-git
Copy link

How about using Pluto; Pluto.run(;run_notebook_on_load=false) I looked at the code at:

options = Configuration.from_flat_kwargs(; kwargs...)

So run_notebook_on_load option can be passed in like that

It didn't work, wonder why. I'm using Julia v1.8 and Pluto v0.19.9

@AlfredSAM
Copy link

How about using Pluto; Pluto.run(;run_notebook_on_load=false) I looked at the code at:

options = Configuration.from_flat_kwargs(; kwargs...)

So run_notebook_on_load option can be passed in like that

It didn't work, wonder why. I'm using Julia v1.8 and Pluto v0.19.9

Is there any update? It also didn't work for me. I am using Julia v1.8 and Pluto v0.19.12

@teamclouday
Copy link

Please follow #259 for discussions of this feature.

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

No branches or pull requests

8 participants