-
DescriptionWhile creating slides I would like to have code blocks executed until I am
It seems however that there is no fine-grained control on which ones to freeze and which ones to run. While this is fine at the beginning once there are many executable code blocks it quickly takes a lot of time when rerendering / previewing. Here is a minimal working example: Use the jupyter: python3
execute:
echo: true
output: true
freeze: false
# cache: true
keep-ipynb: false
format:
revealjs:
# ## use aspectratio 1610
width: 1280 # default: 970
height: 800 # default: 700
auto-stretch: false
navigation-mode: vertical
controls: true
progress: true
slide-number: h.v
toc: true
toc-depth: 1 and the ---
title: TEST
---
# ABC
```{python}
# | tags: [parameters]
bound = 1000000
```
starting at `0`
There are of course severals ways to do this.
Using a simple `for` loop
```{python}
# | freeze: true
%%timeit
s = []
for i in range(bound):
s.append(i*i)
sum(s)
``` The date: last-modified
date-format: long Running this via quarto preview revealjs-slides/slides.qmd --no-browser --port 8000 while modifying Note, also using How do I prevent individual codeblocks from rendering and / or vice versa when setting My setup: # quarto --version
1.5.5 on debian bookworm in a devcontainer on MacOS. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Did you look at the documentation about caching? (https://quarto.org/docs/computations/caching.html#jupyter-cache) |
Beta Was this translation helpful? Give feedback.
-
Quarto does not provide mechanism to cache / freeze a single cell only.
As documented, Other options quarto offers is Caching, and this is by leveraging anything that the engine offers, JupyterCache or Knitr cache. What you can do with those are specific to the engine. With knitr engine, you can cache a single cell if needed. With Jupyter engine, I don't think you can cache a single cell execution, so this is why Quarto does not offer this. It means you need to come up with you own caching mechanism if you need to save state of long computation code cells, by maybe using Python packages that allows to store result on disk or elsewhere easily, and invalidate when something change in the evaluation code. Hope this helps understand |
Beta Was this translation helpful? Give feedback.
Quarto does not provide mechanism to cache / freeze a single cell only.
freeze
is not an option you can set on a cell. AFAIK we don't document it, and it is not offer by autocompletion in cell option either. So not expected to be valid, or have the effect you expect.As documented,
freeze
is a applying at a document level so that computation are not re-ran when the whole project is rendered withquarto render
Other options quarto offers is Caching, and this is by leveraging anything that the engine offers, JupyterCache or Knitr cache. What you can do with those are specific to the engine. With knitr engine, you can cache a singl…