Skip to content

Commit aa96a66

Browse files
Known issues: document more Positron and RStudio bugs with workarounds
1 parent 8dab477 commit aa96a66

File tree

2 files changed

+66
-12
lines changed

2 files changed

+66
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: progressr
2-
Version: 0.17.0-9000
2+
Version: 0.17.0-9001
33
Title: An Inclusive, Unifying API for Progress Updates
44
Description: A minimal, unifying API for scripts and packages to report progress updates from anywhere including when using parallel processing. The package is designed such that the developer can to focus on what progress should be reported on without having to worry about how to present it. The end user has full control of how, where, and when to render these progress updates, e.g. in the terminal using utils::txtProgressBar(), cli::cli_progress_bar(), in a graphical user interface using utils::winProgressBar(), tcltk::tkProgressBar() or shiny::withProgress(), via the speakers using beepr::beep(), or on a file system via the size of a file. Anyone can add additional, customized, progression handlers. The 'progressr' package uses R's condition framework for signaling progress updated. Because of this, progress can be reported from almost anywhere in R, e.g. from classical for and while loops, from map-reduce API:s like the lapply() family of functions, 'purrr', 'plyr', and 'foreach'. It will also work with parallel processing via the 'future' framework, e.g. future.apply::future_lapply(), furrr::future_map(), and 'foreach' with 'doFuture'. The package is compatible with Shiny applications.
55
Authors@R: c(person("Henrik", "Bengtsson",

vignettes/progressr-91-appendix.md

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,44 @@ risk it would never finish and block all of the following progressors.
157157

158158
## Known Issues
159159

160-
### Positron
160+
### RStudio bug #16331: Setting global progressr handlers during startup does not work
161161

162-
#### Setting global progressr handlers during startup does not work
162+
Setting the global progressr handler in `~/.Rprofile` does _not_ work
163+
in RStudio 2025.09:
164+
165+
```r
166+
if (requireNamespace("progressr", quietly = TRUE)) {
167+
progressr::handlers(global = TRUE)
168+
}
169+
```
170+
171+
This is due to a [bug introduced in RStudio
172+
2025.09](https://github.com/rstudio/rstudio/issues/16331), which has
173+
been fixed for the next release RStudio 2025.11. If you are using
174+
RStudio 2025.09, the workaround is to instead use:
175+
176+
```r
177+
if (requireNamespace("progressr", quietly = TRUE)) {
178+
progressr::handlers(global = TRUE)
179+
180+
## Workaround for RStudio 2025.09 console bug #16331
181+
if (nzchar(Sys.getenv("RSTUDIO")) && !nzchar(Sys.getenv("RSTUDIO_TERM"))) {
182+
invisible(addTaskCallback(function(...) {
183+
ver <- RStudio.Version()$version
184+
if (ver >= "2025.09" && ver < "2025.11") {
185+
message("Workaround for RStudio 2025.09 bug #16331: Added progressr global handler")
186+
progressr::handlers(global = TRUE)
187+
} else {
188+
warning("Workaround for RStudio 2025.09 bug #16331: Not needed in RStudio v", ver, ". Please remove task callback 'rstudio::progressr::once' in your Rprofile startup file", call. = FALSE, immediate. = TRUE)
189+
}
190+
removeTaskCallback("rstudio::progressr::once")
191+
}, name = "rstudio::progressr::once"))
192+
}
193+
}
194+
```
195+
196+
197+
### Positron bug #6892: Setting global progressr handlers during startup does not work
163198

164199
Positron does not support setting global calling handlers during R's
165200
startup process, e.g. in `~/.Rprofile`. Even if such handlers are
@@ -176,23 +211,44 @@ if (requireNamespace("progressr", quietly = TRUE)) {
176211
```
177212

178213
will have no effect. If used, the workaround is to manually
179-
re-registering all calling handlers _at the R prompt_, which can be
180-
done as:
214+
re-registering all calling handlers, which can be done as:
181215

182216
```r
183-
globalCallingHandlers(globalCallingHandlers(NULL))
217+
if (requireNamespace("progressr", quietly = TRUE)) {
218+
progressr::handlers(global = TRUE)
219+
220+
## Workaround for Positron (>= 2025.09) bug #16331
221+
if (nzchar(Sys.getenv("POSITRON"))) local({
222+
ver <- numeric_version(Sys.getenv("POSITRON_VERSION"))
223+
if (ver >= "2025.09") {
224+
message("Workaround for Positron (>= 2025.09) bug #6892: progressr global handler will be installed *after* the next call has been completed")
225+
invisible(addTaskCallback(function(...) {
226+
message("Workaround for Positron (>= 2025.09) bug #6892: re-installed progressr global handler")
227+
globalCallingHandlers(globalCallingHandlers(NULL))
228+
removeTaskCallback("positron::progressr::once")
229+
}, name = "positron::progressr::once"))
230+
}
231+
})
232+
}
184233
```
185234

186235
Alternatively, call:
187236

237+
```r
238+
globalCallingHandlers(globalCallingHandlers(NULL))
239+
```
240+
241+
or
242+
188243
```r
189244
progressr::handlers(global = FALSE) ## important
190245
progressr::handlers(global = TRUE)
191246
```
192247

248+
at the prompt.
193249

194250

195-
#### Messages add a extra newline before the final progress step
251+
### Positron: Messages add extra newline before the final progress step
196252

197253
One of the features of **progressr** is that messages are buffered
198254
during progress reporting and relayed as soon as possible, which
@@ -223,9 +279,7 @@ Positron, e.g. [Bug #9486](https://github.com/posit-dev/positron/issues/9486)
223279
(2025-09-18).
224280

225281

226-
### Jupyter Notebook and Jupyter Lab
227-
228-
#### Reporting progress to stderr does not work
282+
### Jupyter: Reporting progress to stderr (default) does not work
229283

230284
The default for most terminal progress renders, including the ones for
231285
**progressr**, display the progress on standard error (stderr). Due to
@@ -277,7 +331,7 @@ y <- slow_sum(1:20)
277331
```
278332

279333

280-
#### handlers("progress") output is messy
334+
### Jupyter bug #732 - handlers("progress") output is messy
281335

282336
Jupyter has other outputting issues. Specifically, Jupyter [injects an
283337
_extra_ newline at the end of every
@@ -341,7 +395,7 @@ depends on it. The roadmap for developing the API is roughly:
341395
i.e. `handlers(global = TRUE)` and `handlers(global = FALSE)`
342396

343397
* [ ] Make it possible to create a progressor also in the global
344-
environment (see 'Known issues' above)
398+
environment (see 'Known Issues' above)
345399

346400
* [ ] Add support for nested progress updates
347401

0 commit comments

Comments
 (0)