Skip to content

Commit 8b9a95c

Browse files
hadleyjennybc
andauthored
Deprecate install_*() functions (#2649)
* Deprecate `install_*()` functions Fixes #2571 * Improve message * Use a bullet list * Put this @importFrom with the rest * Link to pak's website --------- Co-authored-by: Jenny Bryan <jenny.f.bryan@gmail.com>
1 parent 710ea07 commit 8b9a95c

12 files changed

Lines changed: 270 additions & 360 deletions

File tree

NAMESPACE

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,6 @@ importFrom(pkgload,check_dep_version)
9595
importFrom(pkgload,is_loading)
9696
importFrom(pkgload,parse_deps)
9797
importFrom(pkgload,unload)
98-
importFrom(remotes,dev_package_deps)
99-
importFrom(remotes,github_pull)
100-
importFrom(remotes,github_release)
101-
importFrom(remotes,install_bioc)
102-
importFrom(remotes,install_bitbucket)
103-
importFrom(remotes,install_cran)
104-
importFrom(remotes,install_dev)
105-
importFrom(remotes,install_git)
106-
importFrom(remotes,install_github)
107-
importFrom(remotes,install_gitlab)
108-
importFrom(remotes,install_local)
109-
importFrom(remotes,install_svn)
110-
importFrom(remotes,install_url)
111-
importFrom(remotes,install_version)
112-
importFrom(remotes,update_packages)
11398
importFrom(sessioninfo,package_info)
11499
importFrom(sessioninfo,session_info)
115100
importFrom(stats,update)

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* New `check_mac_devel()` function to check a package using the macOS builder at https://mac.r-project.org/macbuilder/submit.html (@nfrerebeau, #2507)
77
* `dev_sitrep()` now works correctly in Positron (#2618).
88
* `is_loading()` is now re-exported from pkgload (#2556).
9+
* Package installation functions are now deprecated: `install_bioc()`, `install_bitbucket()`, `install_cran()`, `install_deps()`, `install_dev()`, `install_dev_deps()`, `install_git()`, `install_github()`, `install_gitlab()`, `install_local()`, `install_svn()`, `install_url()`, `install_version()`, `update_packages()`, `dev_package_deps()`, `github_pull()`, and `github_release()`. We now recommend pak (<https://pak.r-lib.org/>) for general package installation. See `?install-deprecated` for migration guidance.
910
* `load_all()` now errors if called recursively, i.e. if you accidentally include a `load_all()` call in one of your R source files (#2617).
1011
* `release()` is deprecated in favour of `usethis::use_release_issue()`.
1112
* `show_news()` now looks for NEWS files in the same locations as `utils::news()`: `inst/NEWS.Rd`, `NEWS.md`, `NEWS`, and `inst/NEWS` (@arcresu, #2499).

R/devtools-package.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"_PACKAGE"
1111

1212
## usethis namespace: start
13+
#' @importFrom ellipsis check_dots_used
1314
#' @importFrom lifecycle deprecated
1415
## usethis namespace: end
1516
NULL

R/install.R

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ install <-
150150

151151
#' Install package dependencies if needed
152152
#'
153-
#' `install_deps()` will install the
154-
#' user dependencies needed to run the package, `install_dev_deps()` will also
155-
#' install the development dependencies needed to test and build the package.
153+
#' @description
154+
#' `r lifecycle::badge("deprecated")`
155+
#'
156+
#' These functions are deprecated. Better alternatives:
157+
#' * `pak::local_install_deps()` instead of `install_deps()`
158+
#' * `pak::local_install_dev_deps()` instead of `install_dev_deps()`
159+
#'
156160
#' @inheritParams install
157161
#' @inherit remotes::install_deps
158162
#' @export
@@ -167,6 +171,11 @@ install_deps <- function(
167171
build_opts = c("--no-resave-data", "--no-manual", " --no-build-vignettes"),
168172
...
169173
) {
174+
lifecycle::deprecate_warn(
175+
"2.5.0",
176+
"install_deps()",
177+
"pak::local_install_deps()"
178+
)
170179
pkg <- as.package(pkg)
171180

172181
check_dots_used(action = getOption("devtools.ellipsis_action", rlang::warn))
@@ -197,6 +206,11 @@ install_dev_deps <- function(
197206
build_opts = c("--no-resave-data", "--no-manual", " --no-build-vignettes"),
198207
...
199208
) {
209+
lifecycle::deprecate_warn(
210+
"2.5.0",
211+
"install_dev_deps()",
212+
"pak::local_install_dev_deps()"
213+
)
200214
remotes::update_packages("roxygen2")
201215

202216
pkg <- as.package(pkg)

R/remotes.R

Lines changed: 137 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,170 @@
1-
#' @importFrom ellipsis check_dots_used
2-
with_ellipsis <- function(fun) {
3-
b <- body(fun)
4-
5-
f <- function(...) {
6-
ellipsis::check_dots_used(
7-
action = getOption("devtools.ellipsis_action", rlang::warn)
8-
)
9-
10-
!!b
11-
}
12-
f <- rlang::expr_interp(f)
13-
14-
body(fun) <- body(f)
15-
fun
16-
}
17-
18-
with_pkgbuild_build_tools <- function(fun) {
19-
b <- body(fun)
20-
pkgbuild_call <- as.call(c(
21-
call("::", as.symbol("pkgbuild"), as.symbol("with_build_tools")),
22-
b,
23-
list(required = FALSE)
24-
))
25-
26-
body(fun) <- pkgbuild_call
27-
fun
28-
}
29-
30-
#' Functions re-exported from the remotes package
1+
#' Deprecated package installation functions
312
#'
32-
33-
#' These functions are re-exported from the remotes package. They differ only
34-
#' that the ones in devtools use the [ellipsis] package to ensure all dotted
35-
#' arguments are used.
3+
#' @description
4+
#' `r lifecycle::badge("deprecated")`
5+
#'
6+
#' These functions have been deprecated in favor of [pak](https://pak.r-lib.org/),
7+
#' as that is what we now recommend for package installation. There are a few
8+
#' functions which have no pak equivalent, where you can instead call the
9+
#' old remotes functions directly.
10+
#'
11+
#' ## Migration guide
3612
#'
37-
#' Follow the links below to see the documentation.
38-
#' [remotes::install_bioc()], [remotes::install_bitbucket()], [remotes::install_cran()], [remotes::install_dev()],
39-
#' [remotes::install_git()], [remotes::install_github()], [remotes::install_gitlab()], [remotes::install_local()],
40-
#' [remotes::install_svn()], [remotes::install_url()], [remotes::install_version()], [remotes::update_packages()],
41-
#' [remotes::dev_package_deps()].
13+
#' | devtools function | Replacement |
14+
#' |-------------------|-------------|
15+
#' | `install_bioc("pkg")` | `pak::pak("bioc::pkg")` |
16+
#' | `install_bitbucket("user/repo")` | `remotes::install_bitbucket("user/repo")` |
17+
#' | `install_cran("pkg")` | `pak::pak("pkg")` |
18+
#' | `install_dev("pkg")` | `remotes::install_dev("pkg")` |
19+
#' | `install_git("url")` | `pak::pak("git::url")` |
20+
#' | `install_github("user/repo")` | `pak::pak("user/repo")` |
21+
#' | `install_gitlab("user/repo")` | `pak::pak("gitlab::user/repo")` |
22+
#' | `install_local("path")` | `pak::pak("local::path")` |
23+
#' | `install_svn("url")` | `remotes::install_svn("url")` |
24+
#' | `install_url("url")` | `pak::pak("url::url")` |
25+
#' | `install_version("pkg", "1.0.0")` | `pak::pak("pkg@1.0.0")` |
26+
#' | `update_packages("pkg")` | `pak::pak("pkg")` |
27+
#' | `dev_package_deps()` | `pak::local_dev_deps()` |
28+
#' | `github_pull("123")` | `remotes::github_pull("123")` |
29+
#' | `github_release()` | `remotes::github_release()` |
4230
#'
43-
#' @importFrom remotes install_bioc
44-
#' @name remote-reexports
31+
#' @name install-deprecated
4532
#' @keywords internal
33+
NULL
34+
35+
#' @rdname install-deprecated
4636
#' @export
47-
install_bioc <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_bioc))
37+
install_bioc <- function(...) {
38+
lifecycle::deprecate_warn(
39+
"2.5.0",
40+
"install_bioc()",
41+
I('pak::pak("bioc::pkg")')
42+
)
43+
pkgbuild::with_build_tools(remotes::install_bioc(...), required = FALSE)
44+
}
4845

49-
#' @importFrom remotes install_bitbucket
50-
#' @rdname remote-reexports
46+
#' @rdname install-deprecated
5147
#' @export
52-
install_bitbucket <- with_pkgbuild_build_tools(with_ellipsis(
53-
remotes::install_bitbucket
54-
))
48+
install_bitbucket <- function(...) {
49+
lifecycle::deprecate_warn(
50+
"2.5.0",
51+
"install_bitbucket()",
52+
"remotes::install_bitbucket()"
53+
)
54+
pkgbuild::with_build_tools(remotes::install_bitbucket(...), required = FALSE)
55+
}
5556

56-
#' @importFrom remotes install_cran
57-
#' @rdname remote-reexports
57+
#' @rdname install-deprecated
5858
#' @export
59-
install_cran <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_cran))
59+
install_cran <- function(...) {
60+
lifecycle::deprecate_warn("2.5.0", "install_cran()", "pak::pak()")
61+
pkgbuild::with_build_tools(remotes::install_cran(...), required = FALSE)
62+
}
6063

61-
#' @importFrom remotes install_dev
62-
#' @rdname remote-reexports
64+
#' @rdname install-deprecated
6365
#' @export
64-
install_dev <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_dev))
66+
install_dev <- function(...) {
67+
lifecycle::deprecate_warn("2.5.0", "install_dev()", "remotes::install_dev()")
68+
pkgbuild::with_build_tools(remotes::install_dev(...), required = FALSE)
69+
}
6570

66-
#' @importFrom remotes install_git
67-
#' @rdname remote-reexports
71+
#' @rdname install-deprecated
6872
#' @export
69-
install_git <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_git))
73+
install_git <- function(...) {
74+
lifecycle::deprecate_warn("2.5.0", "install_git()", I('pak::pak("git::url")'))
75+
pkgbuild::with_build_tools(remotes::install_git(...), required = FALSE)
76+
}
7077

71-
#' @importFrom remotes install_github
72-
#' @rdname remote-reexports
78+
#' @rdname install-deprecated
7379
#' @export
74-
install_github <- with_pkgbuild_build_tools(with_ellipsis(
75-
remotes::install_github
76-
))
80+
install_github <- function(...) {
81+
lifecycle::deprecate_warn(
82+
"2.5.0",
83+
"install_github()",
84+
I('pak::pak("user/repo")')
85+
)
86+
pkgbuild::with_build_tools(remotes::install_github(...), required = FALSE)
87+
}
7788

78-
#' @importFrom remotes github_pull
79-
#' @rdname reexports
89+
#' @rdname install-deprecated
8090
#' @export
81-
remotes::github_pull
91+
install_gitlab <- function(...) {
92+
lifecycle::deprecate_warn(
93+
"2.5.0",
94+
"install_gitlab()",
95+
I('pak::pak("gitlab::user/repo")')
96+
)
97+
pkgbuild::with_build_tools(remotes::install_gitlab(...), required = FALSE)
98+
}
8299

83-
#' @importFrom remotes github_release
84-
#' @rdname reexports
100+
#' @rdname install-deprecated
85101
#' @export
86-
remotes::github_release
102+
install_local <- function(...) {
103+
lifecycle::deprecate_warn(
104+
"2.5.0",
105+
"install_local()",
106+
I('pak::pak("local::path")')
107+
)
108+
pkgbuild::with_build_tools(remotes::install_local(...), required = FALSE)
109+
}
87110

88-
#' @importFrom remotes install_gitlab
89-
#' @rdname remote-reexports
111+
#' @rdname install-deprecated
90112
#' @export
91-
install_gitlab <- with_pkgbuild_build_tools(with_ellipsis(
92-
remotes::install_gitlab
93-
))
113+
install_svn <- function(...) {
114+
lifecycle::deprecate_warn("2.5.0", "install_svn()", "remotes::install_svn()")
115+
pkgbuild::with_build_tools(remotes::install_svn(...), required = FALSE)
116+
}
94117

95-
#' @importFrom remotes install_local
96-
#' @rdname remote-reexports
118+
#' @rdname install-deprecated
97119
#' @export
98-
install_local <- with_pkgbuild_build_tools(with_ellipsis(
99-
remotes::install_local
100-
))
120+
install_url <- function(...) {
121+
lifecycle::deprecate_warn("2.5.0", "install_url()", I('pak::pak("url::url")'))
122+
pkgbuild::with_build_tools(remotes::install_url(...), required = FALSE)
123+
}
101124

102-
#' @importFrom remotes install_svn
103-
#' @rdname remote-reexports
125+
#' @rdname install-deprecated
104126
#' @export
105-
install_svn <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_svn))
127+
install_version <- function(...) {
128+
lifecycle::deprecate_warn(
129+
"2.5.0",
130+
"install_version()",
131+
I('pak::pak("pkg@version")')
132+
)
133+
pkgbuild::with_build_tools(remotes::install_version(...), required = FALSE)
134+
}
106135

107-
#' @importFrom remotes install_url
108-
#' @rdname remote-reexports
136+
#' @rdname install-deprecated
109137
#' @export
110-
install_url <- with_pkgbuild_build_tools(with_ellipsis(remotes::install_url))
138+
update_packages <- function(...) {
139+
lifecycle::deprecate_warn("2.5.0", "update_packages()", "pak::pak()")
140+
pkgbuild::with_build_tools(remotes::update_packages(...), required = FALSE)
141+
}
111142

112-
#' @importFrom remotes install_version
113-
#' @rdname remote-reexports
143+
#' @rdname install-deprecated
114144
#' @export
115-
install_version <- with_pkgbuild_build_tools(with_ellipsis(
116-
remotes::install_version
117-
))
145+
dev_package_deps <- function(...) {
146+
lifecycle::deprecate_warn(
147+
"2.5.0",
148+
"dev_package_deps()",
149+
"pak::local_dev_deps()"
150+
)
151+
pkgbuild::with_build_tools(remotes::dev_package_deps(...), required = FALSE)
152+
}
118153

119-
#' @importFrom remotes update_packages
120-
#' @rdname remote-reexports
154+
#' @rdname install-deprecated
121155
#' @export
122-
update_packages <- with_pkgbuild_build_tools(with_ellipsis(
123-
remotes::update_packages
124-
))
156+
github_pull <- function(...) {
157+
lifecycle::deprecate_warn("2.5.0", "github_pull()", "remotes::github_pull()")
158+
remotes::github_pull(...)
159+
}
125160

126-
#' @importFrom remotes dev_package_deps
127-
#' @rdname remote-reexports
161+
#' @rdname install-deprecated
128162
#' @export
129-
dev_package_deps <- with_pkgbuild_build_tools(remotes::dev_package_deps)
163+
github_release <- function(...) {
164+
lifecycle::deprecate_warn(
165+
"2.5.0",
166+
"github_release()",
167+
"remotes::github_release()"
168+
)
169+
remotes::github_release(...)
170+
}

_pkgdown.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,30 @@ reference:
3333

3434
- title: Package installation
3535
contents:
36-
- starts_with("install")
36+
- install
3737
- uninstall
3838

3939
- title: Utilities
4040
contents:
4141
- bash
4242
- dev_sitrep
43-
- github_pull
4443
- lint
4544
- missing_s3
4645
- run_examples
4746
- session_info
4847
- show_news
4948
- starts_with("source_")
50-
- update_packages
5149
- wd
5250
- save_all
5351

54-
- title: Deprecated functions
52+
- title: Deprecated
5553
contents:
5654
- build_vignettes
5755
- clean_vignettes
5856
- release
57+
- install-deprecated
58+
- install_deps
59+
- devtools-deprecated
5960

6061
news:
6162
releases:

0 commit comments

Comments
 (0)