Skip to content

Commit d7f1be5

Browse files
DEPRECATION: Phasing out progress() [#113]
1 parent 094e035 commit d7f1be5

File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
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.7.0-9000
2+
Version: 0.7.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() or progress::progress_bar(), in a graphical user interface using utils::winProgressBar(), tcltk::tkProgressBar() or shiny::withProgress(), via the speakers using beep::beepr(), 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 APIs 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(

NEWS

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: progressr
22
==================
33

4-
Version: 0.7.0-9000 [2021-04-25]
4+
Version: 0.7.0-9001 [2021-05-15]
55

66
SIGNIFICANT CHANGES:
77

@@ -24,6 +24,14 @@ BUG FIXES:
2424
value = fcn, envir = envir) : cannot change value of locked binding for
2525
'...progressor'.
2626

27+
DEPRECATED AND DEFUNCT:
28+
29+
* Function progress() is deprecated in order to re-use it for other purpose.
30+
It is unlikely that anyone really used this function, but if you did, then
31+
use cond <- progression() to create 'progression' condition and then use
32+
withRestart(signalCondition(cond), muffleProgression = function(p) NULL)
33+
to signal it.
34+
2735

2836
Version: 0.7.0 [2020-12-11]
2937

R/progress.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
#' @return A [base::condition] of class `progression`.
88
#'
99
#' @seealso
10+
#' To create a progression condition, use [progression()].
1011
#' To signal a progression condition, use [base::signalCondition()].
11-
#' To create and signal a progression condition at once, use [progress()].
1212
#'
1313
#' @keywords internal
1414
#' @export
1515
progress <- function(..., call = sys.call()) {
16+
.Deprecated(msg = "progress() is deprecated", package = .packageName)
17+
1618
args <- list(...)
1719
if (length(args) == 1L && inherits(args[[1L]], "condition")) {
1820
cond <- args[[1L]]

R/progression.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#'
4141
#' @seealso
4242
#' To signal a progression condition, use [base::signalCondition()].
43-
#' To create and signal a progression condition at once, use [progress()].
4443
#'
4544
#' @keywords internal
4645
#' @export

R/progressor.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ progressor <- local({
7979

8080
fcn <- function(message = character(0L), ..., type = "update") {
8181
progression_index <<- progression_index + 1L
82-
progress(type = type,
83-
message = message,
84-
...,
85-
progressor_uuid = progressor_uuid,
86-
progression_index = progression_index,
87-
owner_session_uuid = owner_session_uuid)
82+
cond <- progression(
83+
type = type,
84+
message = message,
85+
...,
86+
progressor_uuid = progressor_uuid,
87+
progression_index = progression_index,
88+
owner_session_uuid = owner_session_uuid,
89+
call = sys.call()
90+
)
91+
withRestarts(
92+
signalCondition(cond),
93+
muffleProgression = function(p) NULL
94+
)
95+
invisible(cond)
8896
}
8997
formals(fcn)$message <- message
9098
class(fcn) <- c("progressor", class(fcn))

inst/WORDLIST

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,8 @@ RStudio
6767
BiocParallel
6868
bplapply
6969
txtprogressbar
70+
cond
71+
envir
72+
fcn
73+
signalCondition
74+
md

0 commit comments

Comments
 (0)