You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/computations/julia.qmd
+149Lines changed: 149 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,13 @@ Quarto supports executable Julia code blocks within markdown. This allows you to
12
12
13
13
Quarto has two available engines for executing Julia code. The older one is using the [IJulia](https://github.com/JuliaLang/IJulia.jl) Jupyter kernel and depends on Python to run. The newer engine is using the [QuartoNotebookRunner.jl](https://github.com/PumasAI/QuartoNotebookRunner.jl/) package to render notebooks and does not have any additional dependencies beyond a Julia installation.
14
14
15
+
Using either of these engines will require manually installing Julia if
16
+
you have not done so already. You can download it from
17
+
https://julialang.org/downloads/. There are two options for installation: the
18
+
Juliaup installation manager, or the "manual" installation approach. Unless
19
+
you know that you need to use the "manual" approach, use
20
+
Juliaup since it allows you to manage multiple Julia versions on your system.
21
+
15
22
## Using the `jupyter` engine
16
23
17
24
Below we'll describe how to [install](#installation) IJulia and related requirements but first we'll cover the basics of creating and rendering documents with Julia code blocks.
@@ -318,6 +325,148 @@ The currently available options are:
318
325
- `exeflags`: An array of strings which are appended to the `julia` command that starts the worker process. For example, a notebook is run with `--project=@.` by default (the environment in the directory where the notebook is stored) but this could be overridden by setting `exeflags: ["--project=/some/directory/"]`.
319
326
- `env`: An array of strings where each string specifies one environment variable that is passed to the worker process. For example, `env: ["SOMEVAR=SOMEVALUE"]`.
320
327
328
+
### `juliaup` integration
329
+
330
+
[`juliaup`](https://github.com/JuliaLang/juliaup) is the recommended way to
331
+
install and manage Julia versions. The `julia` engine supports using
332
+
`juliaup`'s `+` channel specifier to select the Julia version that a notebook
333
+
uses. This allow users to run several notebooks concurrently with different
334
+
Julia versions on the same machine without the need for customizing their
335
+
`PATH` in any way.
336
+
337
+
To use this feature, ensure that you have used `juliaup` to install the channels
338
+
that you wish to use in your notebooks. Then add the channel specifier to the notebook
339
+
frontmatter in the `julia.exeflags` option:
340
+
341
+
````markdown
342
+
---
343
+
title: "A Julia 1.11 notebook"
344
+
engine: julia
345
+
julia:
346
+
exeflags: ["+1.11"]
347
+
---
348
+
349
+
```{{julia}}
350
+
VERSION
351
+
```
352
+
````
353
+
354
+
`QuartoNotebookRunner` currently supports running Julia versions from 1.6
355
+
onwards. Support for earlier versions is not planned.
356
+
357
+
### Revise.jl integration
358
+
359
+
[Revise](https://github.com/timholy/Revise.jl) allows for automatically
360
+
updating function definitions in Julia sessions. It is an essential tool in the
361
+
Julia ecosystem for any user that wishes to develop their own packages or large
362
+
projects. The `julia` engine supports using `Revise` within notebook processes
363
+
by simply importing the package into a cell at the start of a notebook. Once
364
+
imported `Revise` will automatically update functions imported from locally
365
+
developed packages in the same way as it behaves in a Julia REPL.
366
+
367
+
Ensure that `Revise` is installed in the project environment that the notebook
368
+
is using, since the global environment is not included in the load path
369
+
provided to Julia, unlike the behaviour of a Julia REPL session.
370
+
371
+
### Caching {#caching-julia}
372
+
373
+
The engine has built-in support for caching notebook results. This feature is disabled by
374
+
default but can be enabled by setting the `execute.cache` option to `true` in a notebook's
375
+
frontmatter:
376
+
377
+
````markdown
378
+
---
379
+
title: "A caching example"
380
+
engine: julia
381
+
execute:
382
+
cache: true
383
+
---
384
+
385
+
```{{julia}}
386
+
rand()
387
+
```
388
+
````
389
+
390
+
Notebook caches are invalidated based on the following criteria:
391
+
392
+
- Using a different Julia version to run the notebook.
393
+
- Changes to the `Manifest.toml` of the environment the notebook is run in. Adding, removing, or changing package versions will invalidate the cache.
394
+
- Changing any contents in the notebook's frontmatter.
395
+
- Changing any contents of any executable Julia cells, including cell options.
396
+
397
+
Changes that do not invalidate a cache:
398
+
399
+
- Editing markdown content outside of executable Julia cells.
400
+
401
+
Caches are saved to file in a `.cache` directory alongside the notebook file.
402
+
This directory is safe to remove if you want to invalidate all caches. The
403
+
contents of the individual cache files is an internal implementation detail and
404
+
should not be relied upon.
405
+
406
+
These caches are safe to save in CI via such tools as GitHub Actions
407
+
`action/cache`to help improve the render time of long-running notebooks that
408
+
do not often change.
409
+
410
+
### R and Python support
411
+
412
+
`{{r}}`and `{{python}}` executable code blocks are supported in the `julia`
413
+
engine via integrations with the
414
+
[RCall](https://github.com/JuliaInterop/RCall.jl) and
Currently, the `engine: julia` option must be specified in each `.qmd` file. Setting the engine project-wide via `_quarto.yml` [is not yet supported](https://github.com/quarto-dev/quarto-cli/issues/3157).
You can view (in-progress) documentation for the next version of Quarto, v1.7, on our pre-release documentation site, [prerelease.quarto.org](https://prerelease.quarto.org), including a list of [highlights](https://prerelease.quarto.org/docs/prerelease/1.7/).
1
+
Quarto 1.7 includes the following new features:
2
+
3
+
- Improvements to the `julia` engine:
4
+
-[`juliaup` integration](/docs/computations/julia.qmd#juliaup-integration): Use specific versions of Julia in your notebooks.
5
+
-[R and Python support](/docs/computations/julia.qmd#r-and-python-support): Include `{r}` and `{python}` executable code cells via the RCall and PythonCall packages.
6
+
-[Caching](/docs/computations/julia.qmd#caching-julia): Save time rendering long-running notebooks by caching results.
7
+
-[Revise.jl integration](/docs/computations/julia.qmd#revise.jl-integration): Automatically update function definitions in Julia sessions.
Copy file name to clipboardExpand all lines: docs/projects/code-execution.qmd
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ This sub-directory render won't use the cached `freeze` results but instead will
68
68
69
69
## Cache
70
70
71
-
You can use the `cache` option to cache the results of computations (using the [knitr cache](https://yihui.org/knitr/demo/cache/) for R documents, and [Jupyter Cache](https://jupyter-cache.readthedocs.io/en/latest/) for Jupyter documents):
71
+
You can use the `cache` option to cache the results of computations (using the [knitr cache](https://yihui.org/knitr/demo/cache/) for R documents, [Jupyter Cache](https://jupyter-cache.readthedocs.io/en/latest/) for Jupyter documents, or [`engine: julia`'s](../computations/julia.qmd#caching-1) built-in support):
0 commit comments