Skip to content

Commit 0b629d4

Browse files
Merge branch 'release/0.18.0'
2 parents c9342e4 + 8abe408 commit 0b629d4

File tree

10 files changed

+252
-328
lines changed

10 files changed

+252
-328
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
2+
Version: 0.18.0
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",

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

33
S3method(conditionMessage,progression)
4+
S3method(length,progressor)
45
S3method(print,progression)
56
S3method(print,progression_handler)
67
S3method(print,progressor)

NEWS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# Version 0.18.0 [2025-11-05]
2+
3+
## New Features
4+
5+
* Add `length()` for `progressor` objects, which enables using
6+
`seq_along()` and `seq()` on progressors.
7+
8+
## Beta Features
9+
10+
* Add experimental support for `progressor(..., finalize = TRUE)`,
11+
which will cause the progressor to signal a progression 'shutdown'
12+
condition when the progressor is garbage collected. This can serve
13+
as a backstop in yet-to-be-observed cases where a progressor did
14+
not shut down properly leaving for instance active sinks behind.
15+
For now, `finalize = FALSE` is the default.
16+
17+
## Bug Fixes
18+
19+
* It was not possible to create more than one progressor in a
20+
`with_progress()` call, resulting in additional progressors being
21+
ignored. Also, warnings on "with_progress() received a progression
22+
'initiate' request" were produced with **progressr** 0.17.0
23+
(2025-10-15).
24+
25+
126
# Version 0.17.0 [2025-10-15]
227

328
## New Features

R/progressor.R

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#' @param initiate (logical) If TRUE, the progressor will signal a
2323
#' [progression] 'initiate' condition when created.
2424
#'
25+
#' @param finalize (logical) If TRUE, the progressor signals a [progression]
26+
#' 'shutdown' condition when finalized by the garbage collector.
27+
#'
2528
#' @param auto_finish (logical) If TRUE, then the progressor will signal a
2629
#' [progression] 'finish' condition as soon as the last step has been reached.
2730
#'
@@ -60,7 +63,7 @@ progressor <- local({
6063
environment(void_progressor)$enable <- FALSE
6164
class(void_progressor) <- c("progressor", class(void_progressor))
6265

63-
function(steps = length(along), along = NULL, offset = 0L, scale = 1L, transform = function(steps) scale * steps + offset, message = character(0L), label = NA_character_, trace = FALSE, initiate = TRUE, auto_finish = TRUE, on_exit = !identical(envir, globalenv()), enable = getOption("progressr.enable", TRUE), envir = parent.frame()) {
66+
function(steps = length(along), along = NULL, offset = 0L, scale = 1L, transform = function(steps) scale * steps + offset, message = character(0L), label = NA_character_, trace = FALSE, initiate = TRUE, finalize = FALSE, auto_finish = TRUE, on_exit = !identical(envir, globalenv()), enable = getOption("progressr.enable", TRUE), envir = parent.frame()) {
6467
stop_if_not(is.logical(enable), length(enable) == 1L, !is.na(enable))
6568

6669
## Quickly return a moot progressor function?
@@ -113,7 +116,7 @@ progressor <- local({
113116
muffleProgression = function(p) NULL
114117
)
115118
invisible(cond)
116-
}
119+
} ## fcn()
117120
formals(fcn)$message <- message
118121
class(fcn) <- c("progressor", class(fcn))
119122

@@ -163,6 +166,18 @@ progressor <- local({
163166
do.call(base::on.exit, args = list(call, add = TRUE), envir = envir)
164167
}
165168

169+
if (finalize) {
170+
## Self-reference progressor function needed by the finalizer function
171+
progressor_envir$self <- fcn
172+
reg.finalizer(progressor_envir, function(e) {
173+
print(utils::ls.str(e))
174+
if (is.function(e$self)) {
175+
e$self(type = "shutdown")
176+
e$self <- NULL
177+
}
178+
})
179+
}
180+
166181
fcn
167182
}
168183
})
@@ -211,6 +226,12 @@ print.progressor <- function(x, ...) {
211226
}
212227

213228

229+
#' @export
230+
length.progressor <- function(x) {
231+
environment(x)[["steps"]]
232+
}
233+
234+
214235
progressr_in_globalenv <- local({
215236
state <- FALSE
216237

R/with_progress.R

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,18 @@ with_progress <- function(expr, handlers = progressr::handlers(), cleanup = TRUE
229229
},
230230

231231
progression = function(p) {
232-
progression_counter <<- progression_counter + 1
233-
if (debug) message(sprintf("- received a %s (n=%g)", sQuote(class(p)[1]), progression_counter))
234-
235-
if (finished) {
236-
warn_about_too_many_progressions(p)
237-
return()
232+
## Reset, because a new progression was created?
233+
if (p$type == "initiate") {
234+
if (!finished) calling_handler(control_progression("shutdown"))
235+
progression_counter <<- 0
236+
finished <<- FALSE
237+
} else {
238+
progression_counter <<- progression_counter + 1
239+
if (debug) message(sprintf("- received a %s (n=%g)", sQuote(class(p)[1]), progression_counter))
240+
if (finished) {
241+
warn_about_too_many_progressions(p)
242+
return()
243+
}
238244
}
239245

240246
## Don't capture conditions that are produced by progression handlers

man/progressor.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

revdep/README.md

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
# Platform
22

3-
|field |value |
4-
|:--------|:-----------------------------------------------------------|
5-
|version |R version 4.5.0 (2025-04-11) |
6-
|os |Rocky Linux 8.10 (Green Obsidian) |
7-
|system |x86_64, linux-gnu |
8-
|ui |X11 |
9-
|language |en |
10-
|collate |en_US.UTF-8 |
11-
|ctype |en_US.UTF-8 |
12-
|tz |America/Los_Angeles |
13-
|date |2025-10-14 |
14-
|pandoc |3.6.3 @ /software/c4/cbi/software/pandoc-3.6.3/bin/pandoc |
15-
|quarto |1.6.42 @ /software/c4/cbi/software/quarto-1.6.42/bin/quarto |
3+
|field |value |
4+
|:--------|:-------------------------------------------------------------|
5+
|version |R version 4.5.2 (2025-10-31) |
6+
|os |Rocky Linux 8.10 (Green Obsidian) |
7+
|system |x86_64, linux-gnu |
8+
|ui |X11 |
9+
|language |en |
10+
|collate |en_US.UTF-8 |
11+
|ctype |en_US.UTF-8 |
12+
|tz |America/Los_Angeles |
13+
|date |2025-11-05 |
14+
|pandoc |3.8.2.1 @ /software/c4/cbi/software/pandoc-3.8.2.1/bin/pandoc |
15+
|quarto |1.8.25 @ /software/c4/cbi/software/quarto-1.8.25/bin/quarto |
1616

1717
# Dependencies
1818

1919
|package |old |new |Δ |
2020
|:---------|:------|:-----------|:--|
21-
|progressr |0.16.0 |0.16.0-9015 |* |
21+
|progressr |0.17.0 |0.17.0-9005 |* |
2222
|digest |0.6.37 |0.6.37 | |
2323

2424
# Revdeps
2525

26-
## All (139)
26+
## All (142)
2727

2828
|package |version |error |warning |note |
2929
|:----------------------|:----------|:-----|:-------|:----|
3030
|[adestr](problems.md#adestr)|1.0.0 | | |1 |
3131
|AIPW |0.6.9.2 | | | |
3232
|ale |0.5.3 | | | |
33-
|[AlpsNMR](problems.md#alpsnmr)|4.10.1 |1 | | |
33+
|[AlpsNMR](problems.md#alpsnmr)|4.12.0 |1 | | |
3434
|antaresEditObject |0.9.2 | | | |
3535
|ao |1.2.1 | | | |
3636
|[baseballr](problems.md#baseballr)|1.6.0 | | |1 |
3737
|[baskexact](problems.md#baskexact)|1.0.1 | | |1 |
3838
|basksim |1.0.0 | | | |
39-
|[bayesmove](problems.md#bayesmove)|0.2.1 | | |1 |
40-
|BayesRegDTR |1.0.1 | | | |
41-
|bbotk |1.7.0 | | | |
42-
|beer |1.12.0 | | | |
43-
|binaryRL |0.9.7 | | | |
39+
|bayesmove |0.2.3 | | | |
40+
|BayesRegDTR |1.1.1 | | | |
41+
|bbotk |1.7.1 | | | |
42+
|beer |1.14.0 | | | |
43+
|binaryRL |0.9.8 | | | |
4444
|bolasso |0.4.0 | | | |
4545
|calmr |0.8.1 | | | |
4646
|campsis |1.7.0 | | | |
4747
|canaper |1.0.1 | | | |
48-
|[caretSDM](problems.md#caretsdm)|1.1.4 |2 | | |
48+
|caretSDM |1.1.4 | | | |
4949
|cccrm |3.0.5 | | | |
5050
|cfbfastR |2.0.0 | | | |
5151
|[collinear](problems.md#collinear)|2.0.0 | | |1 |
@@ -74,36 +74,38 @@
7474
|[fastRhockey](problems.md#fastrhockey)|0.4.0 | | |1 |
7575
|[fdacluster](problems.md#fdacluster)|0.4.1 | |1 |1 |
7676
|FDOTT |0.1.0 | | | |
77-
|flexFitR |1.2.0 | | | |
77+
|flexFitR |1.2.1 | | | |
7878
|funGp |1.0.0 | | | |
7979
|futureverse |0.1.0 | | | |
8080
|fxTWAPLS |0.1.3 | | | |
8181
|geocausal |0.3.4 | | | |
82-
|[geocmeans](problems.md#geocmeans)|0.3.4 |1 | | |
82+
|geocmeans |0.3.4 | | | |
83+
|geomeTriD |1.4.0 | | | |
8384
|GeoModels |2.2.0 | | | |
8485
|gtfs2emis |0.1.1 | | | |
85-
|[gtfs2gps](problems.md#gtfs2gps)|2.1-3 |1 | | |
86+
|gtfs2gps |2.1-3 | | | |
8687
|hbamr |2.4.4 | | | |
8788
|hgwrr |0.6-2 | | | |
8889
|hmer |1.6.0 | | | |
8990
|hoopR |2.1.0 | | | |
9091
|iccTraj |1.1.0 | | | |
91-
|ino |1.1.0 | | | |
92-
|[ISAnalytics](problems.md#isanalytics)|1.18.0 | | |1 |
93-
|JANE |2.0.0 | | | |
92+
|ino |1.2.0 | | | |
93+
|[ISAnalytics](problems.md#isanalytics)|1.20.0 | | |1 |
94+
|JANE |2.1.0 | | | |
9495
|kmeRtone |1.0 | | | |
95-
|[lava](problems.md#lava)|1.8.1 | | |1 |
96+
|lava |1.8.2 | | | |
9697
|lightr |1.9.0 | | | |
9798
|LLMR |0.6.3 | | | |
9899
|lmtp |1.5.3 | | | |
99100
|LWFBrook90R |0.6.2 | | | |
100-
|[mapme.biodiversity](problems.md#mapmebiodiversity)|0.9.5 |1 |1 |1 |
101+
|[mapme.biodiversity](problems.md#mapmebiodiversity)|0.9.5 |1 | | |
101102
|mcmcensemble |3.2.0 | | | |
102103
|metasnf |2.1.2 | | | |
103104
|MIC |1.2.0 | | | |
104-
|mikropml |1.6.2 | | | |
105+
|[mikropml](problems.md#mikropml)|1.7.0 | | |1 |
105106
|mlr3 |1.2.0 | | | |
106107
|modeltime.resample |0.3.0 | | | |
108+
|modeltuning |0.1.2 | | | |
107109
|MOODE |1.1.0 | | | |
108110
|[mpathsenser](problems.md#mpathsenser)|1.2.3 | | |1 |
109111
|nflfastR |5.1.0 | | | |
@@ -117,32 +119,33 @@
117119
|[pavo](problems.md#pavo)|2.9.0 | |1 | |
118120
|pcpr |1.0.0 | | | |
119121
|plnr |2022.11.23 | | | |
120-
|polle |1.5 | | | |
122+
|polle |1.6.0 | | | |
121123
|polykde |1.1.7 | | | |
122124
|poppr |2.9.8 | | | |
123125
|[powRICLPM](problems.md#powriclpm)|0.2.1 | | |1 |
124-
|projpred |2.9.0 | | | |
126+
|projpred |2.9.1 | | | |
125127
|[PWIR](problems.md#pwir)|0.0.3.1 | | |1 |
126128
|R4GoodPersonalFinances |1.1.0 | | | |
127129
|RAINBOWR |0.1.38 | | | |
128130
|rainette |0.3.1.1 | | | |
129131
|rangeMapper |2.0.3 | | | |
130132
|readsdr |0.3.0 | | | |
131-
|readyomics |0.1.2 | | | |
133+
|readyomics |0.2.0 | | | |
132134
|[receptiviti](problems.md#receptiviti)|0.2.0 |1 | | |
133135
|rechaRge |1.0.0 | | | |
134136
|remiod |1.0.2 | | | |
135137
|restriktor |0.6-10 | | | |
138+
|Rfuzzycoco |0.1.0 | | | |
136139
|[rsi](problems.md#rsi) |0.3.2 | | |1 |
137140
|saeczi |0.2.0 | | | |
138141
|SCGLR |3.1.0 | | | |
139142
|semPower |2.1.3 | | | |
140-
|sentopics |0.7.5 | | | |
143+
|sentopics |0.7.6 | | | |
141144
|seqHMM |2.1.0 | | | |
142-
|Seurat |5.3.0 | | | |
145+
|Seurat |5.3.1 | | | |
143146
|SeuratObject |5.2.0 | | | |
144147
|shapr |1.0.5 | | | |
145-
|simaerep |0.7.0 | | | |
148+
|simaerep |1.0.0 | | | |
146149
|SimDesign |2.21 | | | |
147150
|sims |0.0.4 | | | |
148151
|skpr |1.9.2 | | | |
@@ -152,7 +155,7 @@
152155
|squat |0.4.0 | | | |
153156
|[stppSim](problems.md#stppsim)|1.3.4 | |1 | |
154157
|survex |1.2.0 | | | |
155-
|[targeted](problems.md#targeted)|0.5 | | |1 |
158+
|targeted |0.6 | | | |
156159
|terrainr |0.7.6 | | | |
157160
|tidyfit |0.7.4 | | | |
158161
|tidySEM |0.2.9 | | | |

revdep/cran.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## revdepcheck results
22

3-
We checked 139 reverse dependencies (136 from CRAN + 3 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
3+
We checked 142 reverse dependencies (138 from CRAN + 4 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.
44

55
* We saw 0 new problems
66
* We failed to check 0 packages

0 commit comments

Comments
 (0)