Skip to content

Commit 713809d

Browse files
authored
Move remotes to suggests (#2668)
Fixes #2663
1 parent 8e54d6c commit 713809d

File tree

10 files changed

+74
-11
lines changed

10 files changed

+74
-11
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Imports:
3131
pkgload (>= 1.5.0),
3232
profvis (>= 0.4.0),
3333
rcmdcheck (>= 1.4.0),
34-
remotes (>= 2.5.0),
3534
rlang (>= 1.1.7),
3635
roxygen2 (>= 7.3.3),
3736
rversions (>= 3.0.0),
@@ -51,6 +50,7 @@ Suggests:
5150
httr (>= 1.4.3),
5251
knitr (>= 1.39),
5352
lintr (>= 3.0.0),
53+
remotes (>= 2.5.0),
5454
rmarkdown (>= 2.14),
5555
rstudioapi (>= 0.13),
5656
spelling (>= 2.2)

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# devtools (development version)
22

3+
* remotes has moved from Imports to Suggests (#2663).
34
* `bash()`, `create()`, `missing_s3()`, `reload()`, `show_news()`, and `wd()` are now deprecated. These functions are all historical parts of our workflow that we no longer use or recommend. `create()` is superseded by `usethis::create_package()`.
45
* `build_manual()` reports more details on failure (#2586).
56
* `check_doc_fields()` is a new function that checks for missing `\value` and `\examples` fields in Rd files, which are commonly flagged by CRAN (#2525).
67
* `build_vignettes()` and `clean_vignettes()` are now deprecated. We no longer recommend building vignettes in this way; instead use `pkgdown::build_article()` to render articles locally (#2488).
78
* `build_site()` now just calls `pkgdown::build_site()`, meaning that you will get more (informative) output by default (#2578).
89
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
10+
* `dev_sitrep()` now uses pak instead of remotes to check for outdated dependencies (#2663).
911
* `dev_sitrep()` now uses cli for user-facing messages instead of deprecated usethis UI functions.
1012
* `dev_sitrep()` now works correctly in Positron (#2618).
1113
* `is_loading()` is now re-exported from pkgload (#2556).

R/check-devtools.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ release_checks <- function(pkg = ".", built_path = NULL) {
2222
check_dev_versions <- function(pkg = ".") {
2323
pkg <- as.package(pkg)
2424

25-
dep_list <- pkg[tolower(remotes::standardise_dep(TRUE))]
25+
dep_list <- pkg[tolower(c("Depends", "Imports", "LinkingTo", "Suggests"))]
2626
deps <- do.call("rbind", unname(compact(lapply(dep_list, parse_deps))))
2727
deps <- deps[!is.na(deps$version), , drop = FALSE]
2828

R/install.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ install_deps <- function(
181181

182182
check_dots_used(action = getOption("devtools.ellipsis_action", warn))
183183

184+
check_installed("remotes")
184185
remotes::install_deps(
185186
pkg$path,
186187
dependencies = dependencies,
@@ -212,6 +213,7 @@ install_dev_deps <- function(
212213
"install_dev_deps()",
213214
"pak::local_install_dev_deps()"
214215
)
216+
check_installed("remotes")
215217
remotes::update_packages("roxygen2")
216218

217219
pkg <- as.package(pkg)

R/remotes.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ install_bioc <- function(...) {
4040
"install_bioc()",
4141
I('pak::pak("bioc::pkg")')
4242
)
43+
check_installed("remotes")
4344
pkgbuild::with_build_tools(remotes::install_bioc(...), required = FALSE)
4445
}
4546

@@ -51,27 +52,31 @@ install_bitbucket <- function(...) {
5152
"install_bitbucket()",
5253
"remotes::install_bitbucket()"
5354
)
55+
check_installed("remotes")
5456
pkgbuild::with_build_tools(remotes::install_bitbucket(...), required = FALSE)
5557
}
5658

5759
#' @rdname install-deprecated
5860
#' @export
5961
install_cran <- function(...) {
6062
lifecycle::deprecate_warn("2.5.0", "install_cran()", "pak::pak()")
63+
check_installed("remotes")
6164
pkgbuild::with_build_tools(remotes::install_cran(...), required = FALSE)
6265
}
6366

6467
#' @rdname install-deprecated
6568
#' @export
6669
install_dev <- function(...) {
6770
lifecycle::deprecate_warn("2.5.0", "install_dev()", "remotes::install_dev()")
71+
check_installed("remotes")
6872
pkgbuild::with_build_tools(remotes::install_dev(...), required = FALSE)
6973
}
7074

7175
#' @rdname install-deprecated
7276
#' @export
7377
install_git <- function(...) {
7478
lifecycle::deprecate_warn("2.5.0", "install_git()", I('pak::pak("git::url")'))
79+
check_installed("remotes")
7580
pkgbuild::with_build_tools(remotes::install_git(...), required = FALSE)
7681
}
7782

@@ -83,6 +88,7 @@ install_github <- function(...) {
8388
"install_github()",
8489
I('pak::pak("user/repo")')
8590
)
91+
check_installed("remotes")
8692
pkgbuild::with_build_tools(remotes::install_github(...), required = FALSE)
8793
}
8894

@@ -94,6 +100,7 @@ install_gitlab <- function(...) {
94100
"install_gitlab()",
95101
I('pak::pak("gitlab::user/repo")')
96102
)
103+
check_installed("remotes")
97104
pkgbuild::with_build_tools(remotes::install_gitlab(...), required = FALSE)
98105
}
99106

@@ -105,20 +112,23 @@ install_local <- function(...) {
105112
"install_local()",
106113
I('pak::pak("local::path")')
107114
)
115+
check_installed("remotes")
108116
pkgbuild::with_build_tools(remotes::install_local(...), required = FALSE)
109117
}
110118

111119
#' @rdname install-deprecated
112120
#' @export
113121
install_svn <- function(...) {
114122
lifecycle::deprecate_warn("2.5.0", "install_svn()", "remotes::install_svn()")
123+
check_installed("remotes")
115124
pkgbuild::with_build_tools(remotes::install_svn(...), required = FALSE)
116125
}
117126

118127
#' @rdname install-deprecated
119128
#' @export
120129
install_url <- function(...) {
121130
lifecycle::deprecate_warn("2.5.0", "install_url()", I('pak::pak("url::url")'))
131+
check_installed("remotes")
122132
pkgbuild::with_build_tools(remotes::install_url(...), required = FALSE)
123133
}
124134

@@ -130,13 +140,15 @@ install_version <- function(...) {
130140
"install_version()",
131141
I('pak::pak("pkg@version")')
132142
)
143+
check_installed("remotes")
133144
pkgbuild::with_build_tools(remotes::install_version(...), required = FALSE)
134145
}
135146

136147
#' @rdname install-deprecated
137148
#' @export
138149
update_packages <- function(...) {
139150
lifecycle::deprecate_warn("2.5.0", "update_packages()", "pak::pak()")
151+
check_installed("remotes")
140152
pkgbuild::with_build_tools(remotes::update_packages(...), required = FALSE)
141153
}
142154

@@ -148,13 +160,15 @@ dev_package_deps <- function(...) {
148160
"dev_package_deps()",
149161
"pak::local_dev_deps()"
150162
)
163+
check_installed("remotes")
151164
pkgbuild::with_build_tools(remotes::dev_package_deps(...), required = FALSE)
152165
}
153166

154167
#' @rdname install-deprecated
155168
#' @export
156169
github_pull <- function(...) {
157170
lifecycle::deprecate_warn("2.5.0", "github_pull()", "remotes::github_pull()")
171+
check_installed("remotes")
158172
remotes::github_pull(...)
159173
}
160174

@@ -166,5 +180,6 @@ github_release <- function(...) {
166180
"github_release()",
167181
"remotes::github_release()"
168182
)
183+
check_installed("remotes")
169184
remotes::github_release(...)
170185
}

R/sitrep.R

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ dev_sitrep <- function(pkg = ".", debug = FALSE) {
112112
has_build_tools = has_build_tools,
113113
rtools_path = if (has_build_tools) pkgbuild::rtools_path(),
114114
devtools_version = utils::packageVersion("devtools"),
115-
devtools_deps = remotes::package_deps("devtools", dependencies = NA),
115+
devtools_deps = outdated_deps(pak::pkg_deps("devtools", dependencies = NA)),
116116
pkg_deps = if (!is.null(pkg)) {
117-
remotes::dev_package_deps(pkg$path, dependencies = TRUE)
117+
outdated_deps(pak::local_dev_deps(pkg$path, dependencies = TRUE))
118118
},
119119
rstudio_version = if (is_rstudio_running()) rstudioapi::getVersion(),
120120
rstudio_msg = if (!is_positron()) check_for_rstudio_updates()
@@ -199,7 +199,7 @@ print.dev_sitrep <- function(x, ...) {
199199
cli::cli_bullets(c(
200200
"!" = "{.pkg devtools} or its dependencies out of date:",
201201
" " = "{.val {x$devtools_deps$package[devtools_deps_old]}}",
202-
" " = "Update them with {.code devtools::update_packages(\"devtools\")}"
202+
" " = "Update them with {.code pak::pak(\"devtools\")}"
203203
))
204204
all_ok <- FALSE
205205
}
@@ -213,7 +213,7 @@ print.dev_sitrep <- function(x, ...) {
213213
cli::cli_bullets(c(
214214
"!" = "{.field {x$pkg$package}} dependencies out of date:",
215215
" " = "{.val {x$pkg_deps$package[pkg_deps_old]}}",
216-
" " = "Update them with {.code devtools::install_dev_deps()}"
216+
" " = "Update them with {.code pak::local_install_dev_deps()}"
217217
))
218218
all_ok <- FALSE
219219
}
@@ -228,6 +228,31 @@ print.dev_sitrep <- function(x, ...) {
228228

229229
# Helpers -----------------------------------------------------------------
230230

231+
outdated_deps <- function(deps) {
232+
installed <- vapply(
233+
deps$package,
234+
function(p) {
235+
tryCatch(
236+
as.character(utils::packageVersion(p)),
237+
error = function(e) NA_character_
238+
)
239+
},
240+
character(1)
241+
)
242+
diff <- mapply(
243+
function(inst, avail) {
244+
if (is.na(inst)) {
245+
return(-1L)
246+
}
247+
as.integer(utils::compareVersion(inst, avail))
248+
},
249+
installed,
250+
deps$version,
251+
USE.NAMES = FALSE
252+
)
253+
data.frame(package = deps$package, diff = diff)
254+
}
255+
231256
kv_line <- function(key, value, path = FALSE) {
232257
if (is.null(value)) {
233258
cli::cli_inform(c("*" = "{key}: {.silver <unset>}"))

R/vignettes.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ build_vignettes <- function(
4040
return(invisible())
4141
}
4242

43+
check_installed("remotes")
4344
deps <- remotes::dev_package_deps(pkg$path, dependencies)
4445
update(deps, upgrade = upgrade)
4546

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ includes:
130130
* [roxygen2](https://github.com/r-lib/roxygen2): Function and package documentation
131131
(i.e. `document()`).
132132

133-
* [remotes](https://github.com/r-lib/remotes): Installing packages (i.e.
134-
`install_github()`).
133+
* [pak](https://pak.r-lib.org): Installing packages (i.e. `pak::pak()`).
135134

136135
* [pkgbuild](https://github.com/r-lib/pkgbuild): Building binary packages
137136
(including checking if build tools are available) (i.e. `build()`).
@@ -161,7 +160,7 @@ You may also need to care if you are trying to use some devtools functionality
161160
in your own package or deployed application. Generally in these cases it
162161
is better to depend on the particular package directly rather than depend on devtools,
163162
e.g. use `sessioninfo::session_info()` rather than `devtools::session_info()`,
164-
or `remotes::install_github()` vs `devtools::install_github()`.
163+
or `pak::pak("user/repo")` vs `devtools::install_github("user/repo")`.
165164

166165
However for day to day development we recommend you continue to use
167166
`library(devtools)` to quickly load all needed development tools, just like

tests/testthat/_snaps/sitrep.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* version: 2.4.6
4141
! devtools or its dependencies out of date:
4242
"cli"
43-
Update them with `devtools::update_packages("devtools")`
43+
Update them with `pak::pak("devtools")`
4444
-- dev package ---------------------------------------------
4545
* package: <unset>
4646
* path: <unset>
@@ -60,7 +60,7 @@
6060
* path: '/tmp/mypkg'
6161
! mypkg dependencies out of date:
6262
"dplyr" and "tidyr"
63-
Update them with `devtools::install_dev_deps()`
63+
Update them with `pak::local_install_dev_deps()`
6464

6565
# print shows RStudio update message
6666

tests/testthat/test-sitrep.R

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ test_that("print shows RStudio update message", {
5555
expect_snapshot(print(x))
5656
})
5757

58+
test_that("outdated_deps detects outdated packages", {
59+
deps <- data.frame(
60+
package = c("rlang", "cli"),
61+
version = c("0.0.1", "0.0.1")
62+
)
63+
result <- outdated_deps(deps)
64+
expect_equal(result$package, c("rlang", "cli"))
65+
expect_equal(result$diff, c(1, 1))
66+
})
67+
68+
test_that("outdated_deps reports missing packages as outdated", {
69+
deps <- data.frame(
70+
package = c("rlang", "thereIsNoSuchPackage"),
71+
version = c("0.0.1", "1.0.0")
72+
)
73+
result <- outdated_deps(deps)
74+
expect_equal(result$diff[[2]], -1L)
75+
})
76+
5877
test_that("check_for_rstudio_updates", {
5978
skip_if_offline()
6079
skip_on_cran()

0 commit comments

Comments
 (0)