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

Add run all code cells / autorun #5

Open
coatless opened this issue Feb 21, 2024 · 4 comments
Open

Add run all code cells / autorun #5

coatless opened this issue Feb 21, 2024 · 4 comments
Labels
p: medium Address issue before the next release if possible t: feature-request

Comments

@coatless
Copy link
Collaborator

coatless commented Feb 21, 2024

From u/jfcg on r/Python:

Just a feature request :$ Would it be possible to add a mechanism to run all cells? It could be useful for slides, where one can pre-run everything to avoid delays.

We support this over in quarto-webr, but not here yet.

I think this was due to the DOM hiccup when loading both Monaco and Pyodide.

@coatless coatless added p: medium Address issue before the next release if possible t: feature-request labels Mar 1, 2024
@psychemedia
Copy link

If there are multiple code cells in a page, if a user runs each cell in turn, is state propagated from one cell to the next?

eg if cell 1: a=1
does cell 2: print(a) display 1 or an error?

@psychemedia
Copy link

To answer my own question, the state persists within a page.

Next question to try: if a single .qmd doc generates several HTML pages, is it possible to (optionally) propagate state across those pages?

@coatless
Copy link
Collaborator Author

coatless commented Mar 14, 2024

The extension treats all code cells as belonging to the same global environment. So, on a given page, defining a variable like a in cell 1 will cause the variable to be defined and accessible in the later cells (cell 2, cell 3, ...). You can see a demo here:

https://quarto.thecoatlessprofessor.com/pyodide/qpyodide-code-cell-demo.html#strings

Regarding sharing state between pages, that's not possible. Each page gets instantiated through a similar template. So, we can't share the state from Page A with Page B. The closest to "sharing state" would be to allow the other page to source a script in use on the prior page.

@psychemedia
Copy link

Does browser storage work at domain or page level? If domain level, browser storage could be used to hold state that could be dunped from one page into storage then access by another page on load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: medium Address issue before the next release if possible t: feature-request
Projects
None yet
Development

No branches or pull requests

2 participants