-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable freeze
functionality for quarto_website
#262
Conversation
- Add `output-dir` to avoid needing to copy files after running `quarto_render` - Avoid making `_quarto/docs/` folder when rendering. This is needed to use `_freeze/` folder correctly since that lives within `_quarto/`. - Add `execute:\n\tfreeze: auto` to `setup_docs` default `yml` file The transition to this would be any users to add ` output-dir: ../docs/` under `project` in their `quarto_website.yml`.
@vincentarelbundock Here's the PR. I figured out a much easier way when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kylebutts, thanks for your contribution! I don't use quarto websites so @vincentarelbundock will have a better overview of whether this is good, but I just have one comment on the code.
FWIW, I looked at the code and tried it on a couple repos. Looks like it works great! When etienne's comment on Great contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can you add a bullet point in the NEWS file?
@vincentarelbundock I'm not seeing your questions @etiennebacher I went to write a news item and wrote all of this; is this too long? I just wanted to document the feature; but maybe this goes somewhere else ## dev
### Breaking changes
* Simplified rendering for Quarto websites. Previously, the website was rendered into `_quarto/_site` and manually copied over to `docs/`. The new version removes this logic and instead uses the `output-dir` project option. To transition, change `quarto_website.yml` to:
``` yml
project:
output-dir: ../docs/
```
### New features
* [Quarto freeze](https://quarto.org/docs/projects/code-execution.html#freeze) is now fully supported using `render_docs(freeze = TRUE)`. This allows Quarto to store results from `.qmd` files to prevent needing to rerender any document that hasn't had changes to code chunks.
Note that changes to package functions that do not affect documentation will not trigger rerendering of files, so it is recommended to rebuild the docs completely with `freeze = FALSE` after working on the project. Doing so will delete the `_quarto/_freeze` cache, so be careful. With the new rendering changes above, you can render individual files using `quarto::quarto_render(file)` and it will be auto updated in the `docs/` folder.
Freezing a document needs to be set either at a project or per-file level. To do so, at the root level, add `freeze: auto/true` to either `quarto_website.yml` or the frontmatter of a file.
``` yml
execute:
freeze: auto
``` Alternatively, can add the following to the help menu of #' @section Freeze
#'
#' When working on a package, running `render_docs()` to preview changes can be a time-consuming road block. The argument `freeze = TRUE` tries to improve the experience by preventing rerendering of files that have not changed since the last time `render_docs()` was ran. Note that changes to package internals will not cause a rerender, so rerendering the entire docs can still be necessary.
#'
#' For non-Quarto formats, this is done by creating a `freeze.rds` file in `altdoc/` that is able to determine which documentation files have changed.
#'
#' For the Quarto format, we rely on the [Quarto freeze](https://quarto.org/docs/projects/code-execution.html#freeze) feature. Freezing a document needs to be set either at a project or per-file level. Freezing a document needs to be set either at a project or per-file level. To do so, add to either `quarto_website.yml` or the frontmatter of a file:
#' ``` yml
#' execute:
#' freeze: auto
#' ```
#' |
Yes I think it is too long, more details should be added in the man page of
Maybe I missed that earlier but I'm not sure this is desirable. I think ideally the I can take a second look at the NEWS file just before merging, when Vincent will be happy about it. Here's what I have in mind so far: ## development version
### Bug fixes
* `render_docs(freeze = TRUE)` now works correctly when output is `"quarto_website"`. Freezing a document needs to be set either at a project or per-file level. To do so, at the root level, add `freeze: auto/true` to either `quarto_website.yml` or the frontmatter of a file.
``` yml
execute:
freeze: auto
```
(thanks Kyle Butts, #262) (Edit: didn't see your suggestion for adding the section in the man page, I'm ok with that) |
I think that's fine. IIUC, we're just enabling more options for users to work outside |
You removed a check for |
Yes! Basically, the PR's render flow is (1)
|
Very cool contribution, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanations, one last thing about the NEWS file
Ah too late 😅 |
Never too late with Git. But that seems like minor gray area stuff. |
This PR enables the use of
freeze
functionality for_quarto
websites. To enable freezing results of a file, add the following yml either toquarto_website.yml
to enable site-wide or to the frontmatter of individual.qmd
files:The rendering logic is changed just a bit to render directly into
docs/
. For packages usingaltdoc
, after this change, you need to addoutput-dir
to yourquarto_website.yml
:Also fixed the annoying converting
: yes
to: true
; there's a feature inyaml
package