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

Quarto website, is it necessary to delete full folder? #261

Closed
kylebutts opened this issue Mar 18, 2024 · 4 comments
Closed

Quarto website, is it necessary to delete full folder? #261

kylebutts opened this issue Mar 18, 2024 · 4 comments

Comments

@kylebutts
Copy link
Contributor

Hi @etiennebacher and @vincentarelbundock. Finally got around to trying out altdoc and I love it.

I'm making a switch for a project I'm working on. There's a few vignettes that take forever to run; the freeze argument is not working for me. This got me debug stepping through the code and I realized that _quarto() is destroyed every time render_docs is run. @vincentarelbundock, could you tell me the rationale of this? Would it be possible to just replace the .qmd files without destroying the whole folder? This would let quarto's internal freeze caching work?

@vincentarelbundock
Copy link
Collaborator

I would love for freeze to work in Quarto websites. But the one time I tried I couldn't get it to work, even when leaving the _quarto folder alone. I might have missed something obvious, and I didn't work on this for very long, so it might be an easy fix.

@kylebutts
Copy link
Contributor Author

@vincentarelbundock I have freeze working perfectly well. I think the problem was that docs/ was created inside of _quarto/ for some reason. Not doing that and not deleting _quarto/_freeze fixes the problem.

I have all the changes implemented in my fork and it works flawlessly with tinyplot and marginaleffects. This change also simplifies the rendering logic by using the output-dir project option to quarto_website.yml:

project:
  type: website
  output-dir: ../docs

This along with not creating the docs/ folder within _quarto allows _freeze be used. So running render_docs() copies all the files it needs to _quarto and renders using quarto render _quarto/. This automatically moves resulting files to docs/.

For current projects, adding output-dir: .../docs makes the new render_docs() changes work. I have tested with tinyplot and marginaleffects. I have an example package you can try: https://github.com/kylebutts/example-altdoc-freeze.


I can submit a PR; but before I do that, I wanted to try and figure out what the defaults should be.

_freeze/ is a bit of an odd feature. Here are details:

  • When rendering a single file, it will always rerun
  • When rerendering a project, it will only rerun the code if a file has changed (e.g. update .Rd file or vignette)

This is potentially problematic since any changes to the package that affect output will NOT trigger a rerender.

I think the natural solution is to rerun everything if render_docs(freeze = FALSE). I do not have this implemented yet. I think it can be done with quarto_args argument of quarto::quarto_render() but I'll have to experiment.

@vincentarelbundock
Copy link
Collaborator

That sounds awesome! Yesss!

What you propose at the end sounds very reasonable. freeze=FALSE should be default and trigger everything. I think it would feel very unnatural otherwise. That would be more consistent with the "feel" of other output formats within altdoc, even if it isn't exactly what Quarto does.

Ping me when you've put a PR together. I'll try it on a couple more websites and review.

This is going to be a life saver for some of my bigger packages!

@etiennebacher
Copy link
Owner

Was this resolved by #262 or are there other things to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants