I find it useful to convert from qmd to ipynb using quarto convert
where I can run code lines one cell at a time. Quarto can preview/render ipynb without re-running the cells, only displaying their outputs if they have been run. This is useful for interactive development and execution of a “Quarto document”. Once I am happy with the ipynb’s code output, I can convert back to qmd, going back and forth as needed.
I’m aware of what Quarto is, but also there’s no reason it can’t be made more interactive, and indeed the backends for other languages are more suited to interactivity.
I was just curious if there was interest in implementing these features in the julia one or not, but I guess I’ll take that as a “no”.
and indeed the backends for other languages are more suited to interactivity
Could you elaborate on that? As far as I know the R quarto experience in RStudio is not that different from the Julia experience in VSCode, just that you can optionally show output of code chunks inline in the qmd. But if I understand correctly, you don’t get “final” looking output inline (i.e. with all the correct formatting, because that needs pandoc). So the other option is preview mode of the whole document, which we also have.
So as far as I can see, you either go the jupyter notebook route and match python’s interactive experience, or you go the qmd route and are pretty close to R, minus the inline outputs which I guess could be added to the VSCode quarto extension.
I know the jupyter backend has an option for caching of outputs which I’d say is an okay start, and basically just a dumber version of reactivity.
We just released QuartoNotebookRunner 0.10. (This is not yet automatically used in the latest quarto prerelease, but you can test it out using the instructions at the end of this post This is now available starting with in prerelease Release v1.5.31 · quarto-dev/quarto-cli · GitHub)
This version adds the ability to use {r}
code blocks which are rendered using RCall.jl if it’s available. This is similar to using the R""
string macro but more convenient, plus you get correct R syntax highlighting:
You can also use parameterized notebooks now. You specify defaults in the frontmatter like this:
params:
a: 1
b: "2"
And then use these in your script as normal variables like
```{julia}
println("a is ", a, " and b is ", b)
```
You can then render the notebook with different parameters like quarto render somenotebook.qmd -P a:4
as otherwise described here Quarto – Parameters
How to test the latest QuartoNotebookRunner with quarto prereleases
Each quarto version specifies a specific QuartoNotebookRunner version it wants to use. That’s the one that automatically gets set up for you in the background. If you want to use a different version, for example to test this new functionality in 0.10, you can, from prerelease 1.5.30 on Release v1.5.30 · quarto-dev/quarto-cli · GitHub use the env variable QUARTO_JULIA_PROJECT
to set a different environment where quarto will try to load QuartoNotebookRunner from.
So you could do ]activate some/dir
then ]add QuartoNotebookRunner
and then QUARTO_JULIA_PROJECT=some/dir quarto render somefile.qmd
Really, really cool.
Is there some example of the use of {r}
blocks to create plots that we could look at? Perhaps in the test/examples directory of the QuartoNotebookRunner
package? I have been grepping around without success.
I found the test/examples/integrations subdirectory.
The latest prerelease has version 0.10 included Release v1.5.31 · quarto-dev/quarto-cli · GitHub
I have been using Weave.jl for writing documents that requires Julia code for a while. (Mostly for writing quizzes and exams for my teaching.) It has been adequate. But I noticed that Weave.jl seems to have been dormant for quite some time now. If you have tried both quarto and Weave, have you found something in Weave but is not supported by quarto?
I broke it too🤝!!
did you find any solution?
evaluate_raw_cells! / pwd() throws IOError: pwd(): no such file or directory · Issue #93 · PumasAI/QuartoNotebookRunner.jl · GitHub was fixed by try-catch pwd in case it's deleted after starting the server by jkrumbiegel · Pull Request #96 · PumasAI/QuartoNotebookRunner.jl · GitHub
Edit: … so quarto 1.5.31+ should not have the issue…