Skip to content

Commit 0157345

Browse files
Merge branch 'release/0.5.0'
2 parents e885496 + ca7f6a7 commit 0157345

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+644
-84
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#----------------------------
44
^.svn
55
^.git
6+
^.github
67
^.make
78
^INSTALL[.]md$
89
^OVERVIEW[.]md$

.github/workflows/R-CMD-check.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
on: [push, pull_request]
2+
3+
name: R-CMD-check
4+
5+
jobs:
6+
R-CMD-check:
7+
runs-on: ${{ matrix.config.os }}
8+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
9+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
config:
15+
- { os: windows-latest, r: '3.5'}
16+
- { os: windows-latest, r: '3.6'}
17+
- { os: windows-latest, r: 'devel'}
18+
- { os: macOS-latest, r: '3.5'}
19+
- { os: macOS-latest, r: '3.6'}
20+
- { os: macOS-latest, r: 'devel'}
21+
- { os: ubuntu-16.04, r: '3.4', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
22+
- { os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
23+
- { os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
24+
25+
env:
26+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
27+
CRAN: ${{ matrix.config.cran }}
28+
29+
30+
steps:
31+
- uses: actions/checkout@v1
32+
33+
- uses: r-lib/actions/setup-r@master
34+
with:
35+
r-version: ${{ matrix.config.r }}
36+
37+
- uses: r-lib/actions/setup-pandoc@master
38+
39+
- name: Query dependencies
40+
run: Rscript -e "install.packages('remotes')" -e "saveRDS(remotes::dev_package_deps(dependencies = TRUE), 'depends.Rds', version = 2)"
41+
42+
- name: Cache R packages
43+
if: runner.os != 'Windows'
44+
uses: actions/cache@v1
45+
with:
46+
path: ${{ env.R_LIBS_USER }}
47+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
48+
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
49+
50+
- name: Install system dependencies
51+
if: runner.os == 'Linux'
52+
env:
53+
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
54+
run: |
55+
Rscript -e "remotes::install_github('r-hub/sysreqs')"
56+
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
57+
sudo -s eval "$sysreqs"
58+
59+
- name: Install dependencies
60+
run: |
61+
Rscript -e "library(remotes)" -e "update(readRDS('depends.Rds'))" -e "remotes::install_cran('rcmdcheck')"
62+
Rscript -e "install.packages('progressr')" ## 'self' vignette engine
63+
64+
- name: Check
65+
run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')"
66+
67+
- name: Upload check results
68+
if: failure()
69+
uses: actions/upload-artifact@master
70+
with:
71+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
72+
path: check
73+
74+
- name: Test coverage
75+
if: matrix.config.os == 'ubuntu-16.04' && matrix.config.r == '3.6-9000'
76+
run: |
77+
Rscript -e "install.packages('covr')" -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
.local
55
inst/doc
66
.make/README.md.rsp
7-
7+
revdep/

DESCRIPTION

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: progressr
2-
Version: 0.4.0
3-
Title: A Unifying API for Progress Updates
4-
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::map()', and 'foreach' with 'doFuture'. The package is compatible with Shiny applications.
2+
Version: 0.5.0
3+
Title: A Inclusive, Unifying API for Progress Updates
4+
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(
66
person("Henrik", "Bengtsson", role=c("aut", "cre", "cph"),
77
email = "[email protected]"))
@@ -24,9 +24,10 @@ Suggests:
2424
furrr,
2525
shiny,
2626
commonmark,
27+
base64enc,
2728
tools
2829
VignetteBuilder: progressr
2930
URL: https://github.com/HenrikBengtsson/progressr
3031
BugReports: https://github.com/HenrikBengtsson/progressr/issues
31-
RoxygenNote: 7.0.2
32+
RoxygenNote: 7.1.0
3233
Roxygen: list(markdown = TRUE)

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ vignettes/progressr-intro.md: OVERVIEW.md vignettes/incl/clean.css
44
sed -i '/%\\Vignette/!d' $@
55
echo "<!-- DO NOT EDIT THIS FILE! Edit 'OVERVIEW.md' instead and then rebuild this file with 'make vigs' -->" >> $@
66
cat $< >> $@
7+
sed -i 's/vignettes\///g' $@
78

89
vigs: vignettes/progressr-intro.md

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export(handler_progress)
1414
export(handler_shiny)
1515
export(handler_tkprogressbar)
1616
export(handler_txtprogressbar)
17+
export(handler_void)
1718
export(handler_winprogressbar)
1819
export(handlers)
1920
export(make_progression_handler)

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Package: progressr
22
==================
33

4+
Version: 0.5.0 [2020-04-16]
5+
6+
NEW FEATURES:
7+
8+
* Add 'void' progression handler.
9+
10+
BUG FIXES:
11+
12+
* Only the last of multiple progression handlers registered was used.
13+
14+
415
Version: 0.4.0 [2020-01-22]
516

617
SIGNIFICANT CHANGES:

OVERVIEW.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
![Life cycle: experimental](imgs/lifecycle-experimental-orange.svg)
1+
![Life cycle: experimental](vignettes/imgs/lifecycle-experimental-orange.svg)
22

33
The **[progressr]** package provides a minimal API for reporting progress updates in [R](https://www.r-project.org/). The design is to separate the representation of progress updates from how they are presented. What type of progress to signal is controlled by the developer. How these progress updates are rendered is controlled by the end user. For instance, some users may prefer visual feedback such as a horizontal progress bar in the terminal, whereas others may prefer auditory feedback.
44

55

6-
<img src="imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
6+
<img src="vignettes/imgs/three_in_chinese.gif" alt="Three strokes writing three in Chinese" style="float: right; margin-right: 1ex; margin-left: 1ex;"/>
77

88
Design motto:
99

@@ -103,6 +103,16 @@ handlers("txtprogressbar", "beepr")
103103
```
104104

105105

106+
### Silence all progress
107+
108+
To silence all progress updates, use:
109+
110+
```r
111+
handlers("void")
112+
```
113+
114+
115+
106116
## Support for progressr elsewhere
107117

108118
Note that progression updates by **progressr** is designed to work out of the box for any _sequential_ iterator framework in R. Below is an set of examples for the most common ones.
@@ -291,7 +301,7 @@ When using the **progressr** package, progression updates are communicated via R
291301

292302

293303

294-
![](imgs/slow_sum.svg)
304+
![](vignettes/imgs/slow_sum.svg)
295305

296306
_Figure: Sequence diagram illustrating how signaled progression conditions are captured by `with_progress()` and relayed to the two progression handlers 'progress' (a progress bar in the terminal) and 'beepr' (auditory) that the end user has chosen._
297307

@@ -319,7 +329,7 @@ To debug progress updates, use:
319329

320330

321331

322-
[progressr]: https://github.com/HenrikBengtsson/progressr/
332+
[progressr]: https://cran.r-project.org/package=progressr
323333
[beepr]: https://cran.r-project.org/package=beepr
324334
[progress]: https://cran.r-project.org/package=progress
325335
[purrr]: https://cran.r-project.org/package=purrr

R/handler_void.R

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#' Progression Handler: No Progress Report
2+
#'
3+
#' @inheritParams make_progression_handler
4+
#'
5+
#' @param \ldots Additional arguments passed to [make_progression_handler()].
6+
#'
7+
#' @examples
8+
#' \donttest{\dontrun{
9+
#' handlers(handler_void())
10+
#' with_progress(y <- slow_sum(1:100))
11+
#' print(y)
12+
#' }}
13+
#'
14+
#' @details
15+
#' This progression handler gives not output - it is invisible and silent.
16+
#'
17+
#' @export
18+
handler_void <- function(intrusiveness = 0, ...) {
19+
reporter <- local({
20+
list(
21+
initiate = function(config, state, progression, ...) NULL,
22+
update = function(config, state, progression, ...) NULL,
23+
finish = function(config, state, progression, ...) NULL
24+
)
25+
})
26+
27+
make_progression_handler("void", reporter, intrusiveness = intrusiveness, ...)
28+
}

R/handlers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' This function provides a convenient alternative for getting and setting
2525
#' option \option{progressr.handlers}.
2626
#'
27-
#' _IMPORTANT: Setting progression handlers is a privileges that should be
27+
#' _IMPORTANT: Setting progression handlers is a privilege that should be
2828
#' left to the end user. It should not be used by R packages, which only task
2929
#' is to _signal_ progress updates, not to decide if, when, and how progress
3030
#' should be reported._
@@ -96,4 +96,4 @@ handlers <- function(..., append = FALSE, on_missing = c("error", "warning", "ig
9696
}
9797

9898
options(progressr.handlers = handlers)[[1]]
99-
}
99+
}

0 commit comments

Comments
 (0)