yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

Building quarto book shows non-interactive progress bar #2271

Closed hadley closed 10 months ago

hadley commented 11 months ago

i.e.

processing file: names.Rmd
1/31                   
2/31 [unnamed-chunk-1] 
3/31                   
4/31 [unnamed-chunk-2] 
5/31                   
6/31 [unnamed-chunk-3] 
7/31                   
8/31 [unnamed-chunk-4] 
9/31                   

Previously it was (correctly) using the dynamic progress bar. I'm using knitr 1.43.


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

hadley commented 11 months ago

Same problem when knitting a single quarto doc when the output appears in the background jobs tab, rather than the build pane.

cderv commented 11 months ago

Previously it was (correctly) using the dynamic progress bar.

The new behavior cames from discussion in https://github.com/yihui/knitr/issues/2221 and commit https://github.com/yihui/knitr/commit/47bce017a506ee43e4b325547804ee7438910a59. It was introduced in 1.43

Current detection for simple mode is https://github.com/yihui/knitr/blob/ec4c9b632e1b35994340848884a31da2ca24640a/R/utils.R#L1136-L1149

When quarto is running R it will do it executing R in background session started with Deno as Rscript <file>. None of the specific checks return FALSE to no activate simple mode , and knitr will then detect that it is not running in RStudio IDE so activate the simple version (is.null(tryCatch(rstudioapi::versionInfo(), error = function(e) NULL)) returns TRUE

So probably the current detection does not work for the case of knitr run within Quarto. We need to find what works for this case....

I think even cli::is_dynamic_tty() is returning FALSE in the context of the R code executed by Quarto directly.

yihui commented 10 months ago

We need to find what works for this case....

I'm using an env var to detect the background jobs pane. This should work now.

cderv commented 10 months ago

This should work now.

This is now working in Background Job pane inside RStudio.

rather than the build pane.

@hadley I understand there could be a scenario where the Build pane is used ?

Also, I don't know if you were referring only to RStudio IDE panes, but just for referement, in terminal, it will still use the non-interactive progress bar. In same terminal session, we'll have

Just mentioning this for reference. The simple progress bar seems ok to have in Terminal for Quarto.

hadley commented 10 months ago

Yeah, I see quarto book usually in the build pane.

cderv commented 10 months ago

Thanks I tried Quarto Website and the Build Pane button triggers a render in the Job Pane.

So it seems only the Build button for a Quarto Book triggers rendering in the Build pane directly.

cderv commented 10 months ago

It should be ok in build pane now too. thanks

hadley commented 10 months ago

Thanks @cderv!

github-actions[bot] commented 4 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.