robertvidigal commited on
Commit
527bded
·
verified ·
1 Parent(s): 9998bf3

Upload 77 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. renv/.gitignore +7 -0
  3. renv/activate.R +1334 -0
  4. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/DESCRIPTION +40 -0
  5. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/INDEX +44 -0
  6. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/LICENSE +2 -0
  7. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/MD5 +74 -0
  8. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/Rd.rds +0 -0
  9. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/features.rds +0 -0
  10. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/hsearch.rds +0 -0
  11. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/links.rds +0 -0
  12. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/nsInfo.rds +0 -0
  13. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/package.rds +0 -0
  14. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/vignette.rds +0 -0
  15. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/NAMESPACE +86 -0
  16. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/NEWS.md +2067 -0
  17. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv +27 -0
  18. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv.rdb +3 -0
  19. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv.rdx +0 -0
  20. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/bin/renv +8 -0
  21. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/bin/renv.bat +2 -0
  22. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/config.yml +373 -0
  23. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.R +7 -0
  24. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.Rmd +118 -0
  25. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.html +459 -0
  26. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.R +7 -0
  27. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.Rmd +241 -0
  28. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.html +646 -0
  29. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.R +19 -0
  30. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.Rmd +122 -0
  31. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.html +491 -0
  32. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/index.html +79 -0
  33. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.R +93 -0
  34. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.Rmd +372 -0
  35. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.html +782 -0
  36. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.R +34 -0
  37. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.Rmd +260 -0
  38. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.html +597 -0
  39. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.R +13 -0
  40. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.Rmd +137 -0
  41. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.html +454 -0
  42. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.R +10 -0
  43. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.Rmd +43 -0
  44. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.html +396 -0
  45. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.R +19 -0
  46. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.Rmd +115 -0
  47. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.html +434 -0
  48. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.R +7 -0
  49. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.Rmd +70 -0
  50. renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.html +316 -0
.gitattributes CHANGED
@@ -57,3 +57,5 @@ www/Roboto-Bold.ttf filter=lfs diff=lfs merge=lfs -text
57
  www/Roboto-Light.ttf filter=lfs diff=lfs merge=lfs -text
58
  www/Roboto-Medium.ttf filter=lfs diff=lfs merge=lfs -text
59
  www/Roboto-Regular.ttf filter=lfs diff=lfs merge=lfs -text
 
 
 
57
  www/Roboto-Light.ttf filter=lfs diff=lfs merge=lfs -text
58
  www/Roboto-Medium.ttf filter=lfs diff=lfs merge=lfs -text
59
  www/Roboto-Regular.ttf filter=lfs diff=lfs merge=lfs -text
60
+ renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/help/renv.rdb filter=lfs diff=lfs merge=lfs -text
61
+ renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv.rdb filter=lfs diff=lfs merge=lfs -text
renv/.gitignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ library/
2
+ local/
3
+ cellar/
4
+ lock/
5
+ python/
6
+ sandbox/
7
+ staging/
renv/activate.R ADDED
@@ -0,0 +1,1334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ local({
3
+
4
+ # the requested version of renv
5
+ version <- "1.1.5"
6
+ attr(version, "sha") <- NULL
7
+
8
+ # the project directory
9
+ project <- Sys.getenv("RENV_PROJECT")
10
+ if (!nzchar(project))
11
+ project <- getwd()
12
+
13
+ # use start-up diagnostics if enabled
14
+ diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE")
15
+ if (diagnostics) {
16
+ start <- Sys.time()
17
+ profile <- tempfile("renv-startup-", fileext = ".Rprof")
18
+ utils::Rprof(profile)
19
+ on.exit({
20
+ utils::Rprof(NULL)
21
+ elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L)
22
+ writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed)))
23
+ writeLines(sprintf("- Profile: %s", profile))
24
+ print(utils::summaryRprof(profile))
25
+ }, add = TRUE)
26
+ }
27
+
28
+ # figure out whether the autoloader is enabled
29
+ enabled <- local({
30
+
31
+ # first, check config option
32
+ override <- getOption("renv.config.autoloader.enabled")
33
+ if (!is.null(override))
34
+ return(override)
35
+
36
+ # if we're being run in a context where R_LIBS is already set,
37
+ # don't load -- presumably we're being run as a sub-process and
38
+ # the parent process has already set up library paths for us
39
+ rcmd <- Sys.getenv("R_CMD", unset = NA)
40
+ rlibs <- Sys.getenv("R_LIBS", unset = NA)
41
+ if (!is.na(rlibs) && !is.na(rcmd))
42
+ return(FALSE)
43
+
44
+ # next, check environment variables
45
+ # prefer using the configuration one in the future
46
+ envvars <- c(
47
+ "RENV_CONFIG_AUTOLOADER_ENABLED",
48
+ "RENV_AUTOLOADER_ENABLED",
49
+ "RENV_ACTIVATE_PROJECT"
50
+ )
51
+
52
+ for (envvar in envvars) {
53
+ envval <- Sys.getenv(envvar, unset = NA)
54
+ if (!is.na(envval))
55
+ return(tolower(envval) %in% c("true", "t", "1"))
56
+ }
57
+
58
+ # enable by default
59
+ TRUE
60
+
61
+ })
62
+
63
+ # bail if we're not enabled
64
+ if (!enabled) {
65
+
66
+ # if we're not enabled, we might still need to manually load
67
+ # the user profile here
68
+ profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile")
69
+ if (file.exists(profile)) {
70
+ cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE")
71
+ if (tolower(cfg) %in% c("true", "t", "1"))
72
+ sys.source(profile, envir = globalenv())
73
+ }
74
+
75
+ return(FALSE)
76
+
77
+ }
78
+
79
+ # avoid recursion
80
+ if (identical(getOption("renv.autoloader.running"), TRUE)) {
81
+ warning("ignoring recursive attempt to run renv autoloader")
82
+ return(invisible(TRUE))
83
+ }
84
+
85
+ # signal that we're loading renv during R startup
86
+ options(renv.autoloader.running = TRUE)
87
+ on.exit(options(renv.autoloader.running = NULL), add = TRUE)
88
+
89
+ # signal that we've consented to use renv
90
+ options(renv.consent = TRUE)
91
+
92
+ # load the 'utils' package eagerly -- this ensures that renv shims, which
93
+ # mask 'utils' packages, will come first on the search path
94
+ library(utils, lib.loc = .Library)
95
+
96
+ # unload renv if it's already been loaded
97
+ if ("renv" %in% loadedNamespaces())
98
+ unloadNamespace("renv")
99
+
100
+ # load bootstrap tools
101
+ ansify <- function(text) {
102
+ if (renv_ansify_enabled())
103
+ renv_ansify_enhanced(text)
104
+ else
105
+ renv_ansify_default(text)
106
+ }
107
+
108
+ renv_ansify_enabled <- function() {
109
+
110
+ override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA)
111
+ if (!is.na(override))
112
+ return(as.logical(override))
113
+
114
+ pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA)
115
+ if (identical(pane, "build"))
116
+ return(FALSE)
117
+
118
+ testthat <- Sys.getenv("TESTTHAT", unset = "false")
119
+ if (tolower(testthat) %in% "true")
120
+ return(FALSE)
121
+
122
+ iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false")
123
+ if (tolower(iderun) %in% "false")
124
+ return(FALSE)
125
+
126
+ TRUE
127
+
128
+ }
129
+
130
+ renv_ansify_default <- function(text) {
131
+ text
132
+ }
133
+
134
+ renv_ansify_enhanced <- function(text) {
135
+
136
+ # R help links
137
+ pattern <- "`\\?(renv::(?:[^`])+)`"
138
+ replacement <- "`\033]8;;x-r-help:\\1\a?\\1\033]8;;\a`"
139
+ text <- gsub(pattern, replacement, text, perl = TRUE)
140
+
141
+ # runnable code
142
+ pattern <- "`(renv::(?:[^`])+)`"
143
+ replacement <- "`\033]8;;x-r-run:\\1\a\\1\033]8;;\a`"
144
+ text <- gsub(pattern, replacement, text, perl = TRUE)
145
+
146
+ # return ansified text
147
+ text
148
+
149
+ }
150
+
151
+ renv_ansify_init <- function() {
152
+
153
+ envir <- renv_envir_self()
154
+ if (renv_ansify_enabled())
155
+ assign("ansify", renv_ansify_enhanced, envir = envir)
156
+ else
157
+ assign("ansify", renv_ansify_default, envir = envir)
158
+
159
+ }
160
+
161
+ `%||%` <- function(x, y) {
162
+ if (is.null(x)) y else x
163
+ }
164
+
165
+ catf <- function(fmt, ..., appendLF = TRUE) {
166
+
167
+ quiet <- getOption("renv.bootstrap.quiet", default = FALSE)
168
+ if (quiet)
169
+ return(invisible())
170
+
171
+ msg <- sprintf(fmt, ...)
172
+ cat(msg, file = stdout(), sep = if (appendLF) "\n" else "")
173
+
174
+ invisible(msg)
175
+
176
+ }
177
+
178
+ header <- function(label,
179
+ ...,
180
+ prefix = "#",
181
+ suffix = "-",
182
+ n = min(getOption("width"), 78))
183
+ {
184
+ label <- sprintf(label, ...)
185
+ n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L)
186
+ if (n <= 0)
187
+ return(paste(prefix, label))
188
+
189
+ tail <- paste(rep.int(suffix, n), collapse = "")
190
+ paste0(prefix, " ", label, " ", tail)
191
+
192
+ }
193
+
194
+ heredoc <- function(text, leave = 0) {
195
+
196
+ # remove leading, trailing whitespace
197
+ trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text)
198
+
199
+ # split into lines
200
+ lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]]
201
+
202
+ # compute common indent
203
+ indent <- regexpr("[^[:space:]]", lines)
204
+ common <- min(setdiff(indent, -1L)) - leave
205
+ text <- paste(substring(lines, common), collapse = "\n")
206
+
207
+ # substitute in ANSI links for executable renv code
208
+ ansify(text)
209
+
210
+ }
211
+
212
+ bootstrap <- function(version, library) {
213
+
214
+ friendly <- renv_bootstrap_version_friendly(version)
215
+ section <- header(sprintf("Bootstrapping renv %s", friendly))
216
+ catf(section)
217
+
218
+ # attempt to download renv
219
+ catf("- Downloading renv ... ", appendLF = FALSE)
220
+ withCallingHandlers(
221
+ tarball <- renv_bootstrap_download(version),
222
+ error = function(err) {
223
+ catf("FAILED")
224
+ stop("failed to download:\n", conditionMessage(err))
225
+ }
226
+ )
227
+ catf("OK")
228
+ on.exit(unlink(tarball), add = TRUE)
229
+
230
+ # now attempt to install
231
+ catf("- Installing renv ... ", appendLF = FALSE)
232
+ withCallingHandlers(
233
+ status <- renv_bootstrap_install(version, tarball, library),
234
+ error = function(err) {
235
+ catf("FAILED")
236
+ stop("failed to install:\n", conditionMessage(err))
237
+ }
238
+ )
239
+ catf("OK")
240
+
241
+ # add empty line to break up bootstrapping from normal output
242
+ catf("")
243
+
244
+ return(invisible())
245
+ }
246
+
247
+ renv_bootstrap_tests_running <- function() {
248
+ getOption("renv.tests.running", default = FALSE)
249
+ }
250
+
251
+ renv_bootstrap_repos <- function() {
252
+
253
+ # get CRAN repository
254
+ cran <- getOption("renv.repos.cran", "https://cloud.r-project.org")
255
+
256
+ # check for repos override
257
+ repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA)
258
+ if (!is.na(repos)) {
259
+
260
+ # check for RSPM; if set, use a fallback repository for renv
261
+ rspm <- Sys.getenv("RSPM", unset = NA)
262
+ if (identical(rspm, repos))
263
+ repos <- c(RSPM = rspm, CRAN = cran)
264
+
265
+ return(repos)
266
+
267
+ }
268
+
269
+ # check for lockfile repositories
270
+ repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity)
271
+ if (!inherits(repos, "error") && length(repos))
272
+ return(repos)
273
+
274
+ # retrieve current repos
275
+ repos <- getOption("repos")
276
+
277
+ # ensure @CRAN@ entries are resolved
278
+ repos[repos == "@CRAN@"] <- cran
279
+
280
+ # add in renv.bootstrap.repos if set
281
+ default <- c(FALLBACK = "https://cloud.r-project.org")
282
+ extra <- getOption("renv.bootstrap.repos", default = default)
283
+ repos <- c(repos, extra)
284
+
285
+ # remove duplicates that might've snuck in
286
+ dupes <- duplicated(repos) | duplicated(names(repos))
287
+ repos[!dupes]
288
+
289
+ }
290
+
291
+ renv_bootstrap_repos_lockfile <- function() {
292
+
293
+ lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock")
294
+ if (!file.exists(lockpath))
295
+ return(NULL)
296
+
297
+ lockfile <- tryCatch(renv_json_read(lockpath), error = identity)
298
+ if (inherits(lockfile, "error")) {
299
+ warning(lockfile)
300
+ return(NULL)
301
+ }
302
+
303
+ repos <- lockfile$R$Repositories
304
+ if (length(repos) == 0)
305
+ return(NULL)
306
+
307
+ keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1))
308
+ vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1))
309
+ names(vals) <- keys
310
+
311
+ return(vals)
312
+
313
+ }
314
+
315
+ renv_bootstrap_download <- function(version) {
316
+
317
+ sha <- attr(version, "sha", exact = TRUE)
318
+
319
+ methods <- if (!is.null(sha)) {
320
+
321
+ # attempting to bootstrap a development version of renv
322
+ c(
323
+ function() renv_bootstrap_download_tarball(sha),
324
+ function() renv_bootstrap_download_github(sha)
325
+ )
326
+
327
+ } else {
328
+
329
+ # attempting to bootstrap a release version of renv
330
+ c(
331
+ function() renv_bootstrap_download_tarball(version),
332
+ function() renv_bootstrap_download_cran_latest(version),
333
+ function() renv_bootstrap_download_cran_archive(version)
334
+ )
335
+
336
+ }
337
+
338
+ for (method in methods) {
339
+ path <- tryCatch(method(), error = identity)
340
+ if (is.character(path) && file.exists(path))
341
+ return(path)
342
+ }
343
+
344
+ stop("All download methods failed")
345
+
346
+ }
347
+
348
+ renv_bootstrap_download_impl <- function(url, destfile) {
349
+
350
+ mode <- "wb"
351
+
352
+ # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715
353
+ fixup <-
354
+ Sys.info()[["sysname"]] == "Windows" &&
355
+ substring(url, 1L, 5L) == "file:"
356
+
357
+ if (fixup)
358
+ mode <- "w+b"
359
+
360
+ args <- list(
361
+ url = url,
362
+ destfile = destfile,
363
+ mode = mode,
364
+ quiet = TRUE
365
+ )
366
+
367
+ if ("headers" %in% names(formals(utils::download.file))) {
368
+ headers <- renv_bootstrap_download_custom_headers(url)
369
+ if (length(headers) && is.character(headers))
370
+ args$headers <- headers
371
+ }
372
+
373
+ do.call(utils::download.file, args)
374
+
375
+ }
376
+
377
+ renv_bootstrap_download_custom_headers <- function(url) {
378
+
379
+ headers <- getOption("renv.download.headers")
380
+ if (is.null(headers))
381
+ return(character())
382
+
383
+ if (!is.function(headers))
384
+ stopf("'renv.download.headers' is not a function")
385
+
386
+ headers <- headers(url)
387
+ if (length(headers) == 0L)
388
+ return(character())
389
+
390
+ if (is.list(headers))
391
+ headers <- unlist(headers, recursive = FALSE, use.names = TRUE)
392
+
393
+ ok <-
394
+ is.character(headers) &&
395
+ is.character(names(headers)) &&
396
+ all(nzchar(names(headers)))
397
+
398
+ if (!ok)
399
+ stop("invocation of 'renv.download.headers' did not return a named character vector")
400
+
401
+ headers
402
+
403
+ }
404
+
405
+ renv_bootstrap_download_cran_latest <- function(version) {
406
+
407
+ spec <- renv_bootstrap_download_cran_latest_find(version)
408
+ type <- spec$type
409
+ repos <- spec$repos
410
+
411
+ baseurl <- utils::contrib.url(repos = repos, type = type)
412
+ ext <- if (identical(type, "source"))
413
+ ".tar.gz"
414
+ else if (Sys.info()[["sysname"]] == "Windows")
415
+ ".zip"
416
+ else
417
+ ".tgz"
418
+ name <- sprintf("renv_%s%s", version, ext)
419
+ url <- paste(baseurl, name, sep = "/")
420
+
421
+ destfile <- file.path(tempdir(), name)
422
+ status <- tryCatch(
423
+ renv_bootstrap_download_impl(url, destfile),
424
+ condition = identity
425
+ )
426
+
427
+ if (inherits(status, "condition"))
428
+ return(FALSE)
429
+
430
+ # report success and return
431
+ destfile
432
+
433
+ }
434
+
435
+ renv_bootstrap_download_cran_latest_find <- function(version) {
436
+
437
+ # check whether binaries are supported on this system
438
+ binary <-
439
+ getOption("renv.bootstrap.binary", default = TRUE) &&
440
+ !identical(.Platform$pkgType, "source") &&
441
+ !identical(getOption("pkgType"), "source") &&
442
+ Sys.info()[["sysname"]] %in% c("Darwin", "Windows")
443
+
444
+ types <- c(if (binary) "binary", "source")
445
+
446
+ # iterate over types + repositories
447
+ for (type in types) {
448
+ for (repos in renv_bootstrap_repos()) {
449
+
450
+ # build arguments for utils::available.packages() call
451
+ args <- list(type = type, repos = repos)
452
+
453
+ # add custom headers if available -- note that
454
+ # utils::available.packages() will pass this to download.file()
455
+ if ("headers" %in% names(formals(utils::download.file))) {
456
+ headers <- renv_bootstrap_download_custom_headers(repos)
457
+ if (length(headers) && is.character(headers))
458
+ args$headers <- headers
459
+ }
460
+
461
+ # retrieve package database
462
+ db <- tryCatch(
463
+ as.data.frame(
464
+ do.call(utils::available.packages, args),
465
+ stringsAsFactors = FALSE
466
+ ),
467
+ error = identity
468
+ )
469
+
470
+ if (inherits(db, "error"))
471
+ next
472
+
473
+ # check for compatible entry
474
+ entry <- db[db$Package %in% "renv" & db$Version %in% version, ]
475
+ if (nrow(entry) == 0)
476
+ next
477
+
478
+ # found it; return spec to caller
479
+ spec <- list(entry = entry, type = type, repos = repos)
480
+ return(spec)
481
+
482
+ }
483
+ }
484
+
485
+ # if we got here, we failed to find renv
486
+ fmt <- "renv %s is not available from your declared package repositories"
487
+ stop(sprintf(fmt, version))
488
+
489
+ }
490
+
491
+ renv_bootstrap_download_cran_archive <- function(version) {
492
+
493
+ name <- sprintf("renv_%s.tar.gz", version)
494
+ repos <- renv_bootstrap_repos()
495
+ urls <- file.path(repos, "src/contrib/Archive/renv", name)
496
+ destfile <- file.path(tempdir(), name)
497
+
498
+ for (url in urls) {
499
+
500
+ status <- tryCatch(
501
+ renv_bootstrap_download_impl(url, destfile),
502
+ condition = identity
503
+ )
504
+
505
+ if (identical(status, 0L))
506
+ return(destfile)
507
+
508
+ }
509
+
510
+ return(FALSE)
511
+
512
+ }
513
+
514
+ renv_bootstrap_download_tarball <- function(version) {
515
+
516
+ # if the user has provided the path to a tarball via
517
+ # an environment variable, then use it
518
+ tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA)
519
+ if (is.na(tarball))
520
+ return()
521
+
522
+ # allow directories
523
+ if (dir.exists(tarball)) {
524
+ name <- sprintf("renv_%s.tar.gz", version)
525
+ tarball <- file.path(tarball, name)
526
+ }
527
+
528
+ # bail if it doesn't exist
529
+ if (!file.exists(tarball)) {
530
+
531
+ # let the user know we weren't able to honour their request
532
+ fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist."
533
+ msg <- sprintf(fmt, tarball)
534
+ warning(msg)
535
+
536
+ # bail
537
+ return()
538
+
539
+ }
540
+
541
+ catf("- Using local tarball '%s'.", tarball)
542
+ tarball
543
+
544
+ }
545
+
546
+ renv_bootstrap_github_token <- function() {
547
+ for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) {
548
+ envval <- Sys.getenv(envvar, unset = NA)
549
+ if (!is.na(envval))
550
+ return(envval)
551
+ }
552
+ }
553
+
554
+ renv_bootstrap_download_github <- function(version) {
555
+
556
+ enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE")
557
+ if (!identical(enabled, "TRUE"))
558
+ return(FALSE)
559
+
560
+ # prepare download options
561
+ token <- renv_bootstrap_github_token()
562
+ if (is.null(token))
563
+ token <- ""
564
+
565
+ if (nzchar(Sys.which("curl")) && nzchar(token)) {
566
+ fmt <- "--location --fail --header \"Authorization: token %s\""
567
+ extra <- sprintf(fmt, token)
568
+ saved <- options("download.file.method", "download.file.extra")
569
+ options(download.file.method = "curl", download.file.extra = extra)
570
+ on.exit(do.call(base::options, saved), add = TRUE)
571
+ } else if (nzchar(Sys.which("wget")) && nzchar(token)) {
572
+ fmt <- "--header=\"Authorization: token %s\""
573
+ extra <- sprintf(fmt, token)
574
+ saved <- options("download.file.method", "download.file.extra")
575
+ options(download.file.method = "wget", download.file.extra = extra)
576
+ on.exit(do.call(base::options, saved), add = TRUE)
577
+ }
578
+
579
+ url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version)
580
+ name <- sprintf("renv_%s.tar.gz", version)
581
+ destfile <- file.path(tempdir(), name)
582
+
583
+ status <- tryCatch(
584
+ renv_bootstrap_download_impl(url, destfile),
585
+ condition = identity
586
+ )
587
+
588
+ if (!identical(status, 0L))
589
+ return(FALSE)
590
+
591
+ renv_bootstrap_download_augment(destfile)
592
+
593
+ return(destfile)
594
+
595
+ }
596
+
597
+ # Add Sha to DESCRIPTION. This is stop gap until #890, after which we
598
+ # can use renv::install() to fully capture metadata.
599
+ renv_bootstrap_download_augment <- function(destfile) {
600
+ sha <- renv_bootstrap_git_extract_sha1_tar(destfile)
601
+ if (is.null(sha)) {
602
+ return()
603
+ }
604
+
605
+ # Untar
606
+ tempdir <- tempfile("renv-github-")
607
+ on.exit(unlink(tempdir, recursive = TRUE), add = TRUE)
608
+ untar(destfile, exdir = tempdir)
609
+ pkgdir <- dir(tempdir, full.names = TRUE)[[1]]
610
+
611
+ # Modify description
612
+ desc_path <- file.path(pkgdir, "DESCRIPTION")
613
+ desc_lines <- readLines(desc_path)
614
+ remotes_fields <- c(
615
+ "RemoteType: github",
616
+ "RemoteHost: api.github.com",
617
+ "RemoteRepo: renv",
618
+ "RemoteUsername: rstudio",
619
+ "RemotePkgRef: rstudio/renv",
620
+ paste("RemoteRef: ", sha),
621
+ paste("RemoteSha: ", sha)
622
+ )
623
+ writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path)
624
+
625
+ # Re-tar
626
+ local({
627
+ old <- setwd(tempdir)
628
+ on.exit(setwd(old), add = TRUE)
629
+
630
+ tar(destfile, compression = "gzip")
631
+ })
632
+ invisible()
633
+ }
634
+
635
+ # Extract the commit hash from a git archive. Git archives include the SHA1
636
+ # hash as the comment field of the tarball pax extended header
637
+ # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html)
638
+ # For GitHub archives this should be the first header after the default one
639
+ # (512 byte) header.
640
+ renv_bootstrap_git_extract_sha1_tar <- function(bundle) {
641
+
642
+ # open the bundle for reading
643
+ # We use gzcon for everything because (from ?gzcon)
644
+ # > Reading from a connection which does not supply a 'gzip' magic
645
+ # > header is equivalent to reading from the original connection
646
+ conn <- gzcon(file(bundle, open = "rb", raw = TRUE))
647
+ on.exit(close(conn))
648
+
649
+ # The default pax header is 512 bytes long and the first pax extended header
650
+ # with the comment should be 51 bytes long
651
+ # `52 comment=` (11 chars) + 40 byte SHA1 hash
652
+ len <- 0x200 + 0x33
653
+ res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len])
654
+
655
+ if (grepl("^52 comment=", res)) {
656
+ sub("52 comment=", "", res)
657
+ } else {
658
+ NULL
659
+ }
660
+ }
661
+
662
+ renv_bootstrap_install <- function(version, tarball, library) {
663
+
664
+ # attempt to install it into project library
665
+ dir.create(library, showWarnings = FALSE, recursive = TRUE)
666
+ output <- renv_bootstrap_install_impl(library, tarball)
667
+
668
+ # check for successful install
669
+ status <- attr(output, "status")
670
+ if (is.null(status) || identical(status, 0L))
671
+ return(status)
672
+
673
+ # an error occurred; report it
674
+ header <- "installation of renv failed"
675
+ lines <- paste(rep.int("=", nchar(header)), collapse = "")
676
+ text <- paste(c(header, lines, output), collapse = "\n")
677
+ stop(text)
678
+
679
+ }
680
+
681
+ renv_bootstrap_install_impl <- function(library, tarball) {
682
+
683
+ # invoke using system2 so we can capture and report output
684
+ bin <- R.home("bin")
685
+ exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R"
686
+ R <- file.path(bin, exe)
687
+
688
+ args <- c(
689
+ "--vanilla", "CMD", "INSTALL", "--no-multiarch",
690
+ "-l", shQuote(path.expand(library)),
691
+ shQuote(path.expand(tarball))
692
+ )
693
+
694
+ system2(R, args, stdout = TRUE, stderr = TRUE)
695
+
696
+ }
697
+
698
+ renv_bootstrap_platform_prefix_default <- function() {
699
+
700
+ # read version component
701
+ version <- Sys.getenv("RENV_PATHS_VERSION", unset = "R-%v")
702
+
703
+ # expand placeholders
704
+ placeholders <- list(
705
+ list("%v", format(getRversion()[1, 1:2])),
706
+ list("%V", format(getRversion()[1, 1:3]))
707
+ )
708
+
709
+ for (placeholder in placeholders)
710
+ version <- gsub(placeholder[[1L]], placeholder[[2L]], version, fixed = TRUE)
711
+
712
+ # include SVN revision for development versions of R
713
+ # (to avoid sharing platform-specific artefacts with released versions of R)
714
+ devel <-
715
+ identical(R.version[["status"]], "Under development (unstable)") ||
716
+ identical(R.version[["nickname"]], "Unsuffered Consequences")
717
+
718
+ if (devel)
719
+ version <- paste(version, R.version[["svn rev"]], sep = "-r")
720
+
721
+ version
722
+
723
+ }
724
+
725
+ renv_bootstrap_platform_prefix <- function() {
726
+
727
+ # construct version prefix
728
+ version <- renv_bootstrap_platform_prefix_default()
729
+
730
+ # build list of path components
731
+ components <- c(version, R.version$platform)
732
+
733
+ # include prefix if provided by user
734
+ prefix <- renv_bootstrap_platform_prefix_impl()
735
+ if (!is.na(prefix) && nzchar(prefix))
736
+ components <- c(prefix, components)
737
+
738
+ # build prefix
739
+ paste(components, collapse = "/")
740
+
741
+ }
742
+
743
+ renv_bootstrap_platform_prefix_impl <- function() {
744
+
745
+ # if an explicit prefix has been supplied, use it
746
+ prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA)
747
+ if (!is.na(prefix))
748
+ return(prefix)
749
+
750
+ # if the user has requested an automatic prefix, generate it
751
+ auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA)
752
+ if (is.na(auto) && getRversion() >= "4.4.0")
753
+ auto <- "TRUE"
754
+
755
+ if (auto %in% c("TRUE", "True", "true", "1"))
756
+ return(renv_bootstrap_platform_prefix_auto())
757
+
758
+ # empty string on failure
759
+ ""
760
+
761
+ }
762
+
763
+ renv_bootstrap_platform_prefix_auto <- function() {
764
+
765
+ prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity)
766
+ if (inherits(prefix, "error") || prefix %in% "unknown") {
767
+
768
+ msg <- paste(
769
+ "failed to infer current operating system",
770
+ "please file a bug report at https://github.com/rstudio/renv/issues",
771
+ sep = "; "
772
+ )
773
+
774
+ warning(msg)
775
+
776
+ }
777
+
778
+ prefix
779
+
780
+ }
781
+
782
+ renv_bootstrap_platform_os <- function() {
783
+
784
+ sysinfo <- Sys.info()
785
+ sysname <- sysinfo[["sysname"]]
786
+
787
+ # handle Windows + macOS up front
788
+ if (sysname == "Windows")
789
+ return("windows")
790
+ else if (sysname == "Darwin")
791
+ return("macos")
792
+
793
+ # check for os-release files
794
+ for (file in c("/etc/os-release", "/usr/lib/os-release"))
795
+ if (file.exists(file))
796
+ return(renv_bootstrap_platform_os_via_os_release(file, sysinfo))
797
+
798
+ # check for redhat-release files
799
+ if (file.exists("/etc/redhat-release"))
800
+ return(renv_bootstrap_platform_os_via_redhat_release())
801
+
802
+ "unknown"
803
+
804
+ }
805
+
806
+ renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) {
807
+
808
+ # read /etc/os-release
809
+ release <- utils::read.table(
810
+ file = file,
811
+ sep = "=",
812
+ quote = c("\"", "'"),
813
+ col.names = c("Key", "Value"),
814
+ comment.char = "#",
815
+ stringsAsFactors = FALSE
816
+ )
817
+
818
+ vars <- as.list(release$Value)
819
+ names(vars) <- release$Key
820
+
821
+ # get os name
822
+ os <- tolower(sysinfo[["sysname"]])
823
+
824
+ # read id
825
+ id <- "unknown"
826
+ for (field in c("ID", "ID_LIKE")) {
827
+ if (field %in% names(vars) && nzchar(vars[[field]])) {
828
+ id <- vars[[field]]
829
+ break
830
+ }
831
+ }
832
+
833
+ # read version
834
+ version <- "unknown"
835
+ for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) {
836
+ if (field %in% names(vars) && nzchar(vars[[field]])) {
837
+ version <- vars[[field]]
838
+ break
839
+ }
840
+ }
841
+
842
+ # join together
843
+ paste(c(os, id, version), collapse = "-")
844
+
845
+ }
846
+
847
+ renv_bootstrap_platform_os_via_redhat_release <- function() {
848
+
849
+ # read /etc/redhat-release
850
+ contents <- readLines("/etc/redhat-release", warn = FALSE)
851
+
852
+ # infer id
853
+ id <- if (grepl("centos", contents, ignore.case = TRUE))
854
+ "centos"
855
+ else if (grepl("redhat", contents, ignore.case = TRUE))
856
+ "redhat"
857
+ else
858
+ "unknown"
859
+
860
+ # try to find a version component (very hacky)
861
+ version <- "unknown"
862
+
863
+ parts <- strsplit(contents, "[[:space:]]")[[1L]]
864
+ for (part in parts) {
865
+
866
+ nv <- tryCatch(numeric_version(part), error = identity)
867
+ if (inherits(nv, "error"))
868
+ next
869
+
870
+ version <- nv[1, 1]
871
+ break
872
+
873
+ }
874
+
875
+ paste(c("linux", id, version), collapse = "-")
876
+
877
+ }
878
+
879
+ renv_bootstrap_library_root_name <- function(project) {
880
+
881
+ # use project name as-is if requested
882
+ asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE")
883
+ if (asis)
884
+ return(basename(project))
885
+
886
+ # otherwise, disambiguate based on project's path
887
+ id <- substring(renv_bootstrap_hash_text(project), 1L, 8L)
888
+ paste(basename(project), id, sep = "-")
889
+
890
+ }
891
+
892
+ renv_bootstrap_library_root <- function(project) {
893
+
894
+ prefix <- renv_bootstrap_profile_prefix()
895
+
896
+ path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA)
897
+ if (!is.na(path))
898
+ return(paste(c(path, prefix), collapse = "/"))
899
+
900
+ path <- renv_bootstrap_library_root_impl(project)
901
+ if (!is.null(path)) {
902
+ name <- renv_bootstrap_library_root_name(project)
903
+ return(paste(c(path, prefix, name), collapse = "/"))
904
+ }
905
+
906
+ renv_bootstrap_paths_renv("library", project = project)
907
+
908
+ }
909
+
910
+ renv_bootstrap_library_root_impl <- function(project) {
911
+
912
+ root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA)
913
+ if (!is.na(root))
914
+ return(root)
915
+
916
+ type <- renv_bootstrap_project_type(project)
917
+ if (identical(type, "package")) {
918
+ userdir <- renv_bootstrap_user_dir()
919
+ return(file.path(userdir, "library"))
920
+ }
921
+
922
+ }
923
+
924
+ renv_bootstrap_validate_version <- function(version, description = NULL) {
925
+
926
+ # resolve description file
927
+ #
928
+ # avoid passing lib.loc to `packageDescription()` below, since R will
929
+ # use the loaded version of the package by default anyhow. note that
930
+ # this function should only be called after 'renv' is loaded
931
+ # https://github.com/rstudio/renv/issues/1625
932
+ description <- description %||% packageDescription("renv")
933
+
934
+ # check whether requested version 'version' matches loaded version of renv
935
+ sha <- attr(version, "sha", exact = TRUE)
936
+ valid <- if (!is.null(sha))
937
+ renv_bootstrap_validate_version_dev(sha, description)
938
+ else
939
+ renv_bootstrap_validate_version_release(version, description)
940
+
941
+ if (valid)
942
+ return(TRUE)
943
+
944
+ # the loaded version of renv doesn't match the requested version;
945
+ # give the user instructions on how to proceed
946
+ dev <- identical(description[["RemoteType"]], "github")
947
+ remote <- if (dev)
948
+ paste("rstudio/renv", description[["RemoteSha"]], sep = "@")
949
+ else
950
+ paste("renv", description[["Version"]], sep = "@")
951
+
952
+ # display both loaded version + sha if available
953
+ friendly <- renv_bootstrap_version_friendly(
954
+ version = description[["Version"]],
955
+ sha = if (dev) description[["RemoteSha"]]
956
+ )
957
+
958
+ fmt <- heredoc("
959
+ renv %1$s was loaded from project library, but this project is configured to use renv %2$s.
960
+ - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.
961
+ - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.
962
+ ")
963
+ catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote)
964
+
965
+ FALSE
966
+
967
+ }
968
+
969
+ renv_bootstrap_validate_version_dev <- function(version, description) {
970
+
971
+ expected <- description[["RemoteSha"]]
972
+ if (!is.character(expected))
973
+ return(FALSE)
974
+
975
+ pattern <- sprintf("^\\Q%s\\E", version)
976
+ grepl(pattern, expected, perl = TRUE)
977
+
978
+ }
979
+
980
+ renv_bootstrap_validate_version_release <- function(version, description) {
981
+ expected <- description[["Version"]]
982
+ is.character(expected) && identical(expected, version)
983
+ }
984
+
985
+ renv_bootstrap_hash_text <- function(text) {
986
+
987
+ hashfile <- tempfile("renv-hash-")
988
+ on.exit(unlink(hashfile), add = TRUE)
989
+
990
+ writeLines(text, con = hashfile)
991
+ tools::md5sum(hashfile)
992
+
993
+ }
994
+
995
+ renv_bootstrap_load <- function(project, libpath, version) {
996
+
997
+ # try to load renv from the project library
998
+ if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE))
999
+ return(FALSE)
1000
+
1001
+ # warn if the version of renv loaded does not match
1002
+ renv_bootstrap_validate_version(version)
1003
+
1004
+ # execute renv load hooks, if any
1005
+ hooks <- getHook("renv::autoload")
1006
+ for (hook in hooks)
1007
+ if (is.function(hook))
1008
+ tryCatch(hook(), error = warnify)
1009
+
1010
+ # load the project
1011
+ renv::load(project)
1012
+
1013
+ TRUE
1014
+
1015
+ }
1016
+
1017
+ renv_bootstrap_profile_load <- function(project) {
1018
+
1019
+ # if RENV_PROFILE is already set, just use that
1020
+ profile <- Sys.getenv("RENV_PROFILE", unset = NA)
1021
+ if (!is.na(profile) && nzchar(profile))
1022
+ return(profile)
1023
+
1024
+ # check for a profile file (nothing to do if it doesn't exist)
1025
+ path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project)
1026
+ if (!file.exists(path))
1027
+ return(NULL)
1028
+
1029
+ # read the profile, and set it if it exists
1030
+ contents <- readLines(path, warn = FALSE)
1031
+ if (length(contents) == 0L)
1032
+ return(NULL)
1033
+
1034
+ # set RENV_PROFILE
1035
+ profile <- contents[[1L]]
1036
+ if (!profile %in% c("", "default"))
1037
+ Sys.setenv(RENV_PROFILE = profile)
1038
+
1039
+ profile
1040
+
1041
+ }
1042
+
1043
+ renv_bootstrap_profile_prefix <- function() {
1044
+ profile <- renv_bootstrap_profile_get()
1045
+ if (!is.null(profile))
1046
+ return(file.path("profiles", profile, "renv"))
1047
+ }
1048
+
1049
+ renv_bootstrap_profile_get <- function() {
1050
+ profile <- Sys.getenv("RENV_PROFILE", unset = "")
1051
+ renv_bootstrap_profile_normalize(profile)
1052
+ }
1053
+
1054
+ renv_bootstrap_profile_set <- function(profile) {
1055
+ profile <- renv_bootstrap_profile_normalize(profile)
1056
+ if (is.null(profile))
1057
+ Sys.unsetenv("RENV_PROFILE")
1058
+ else
1059
+ Sys.setenv(RENV_PROFILE = profile)
1060
+ }
1061
+
1062
+ renv_bootstrap_profile_normalize <- function(profile) {
1063
+
1064
+ if (is.null(profile) || profile %in% c("", "default"))
1065
+ return(NULL)
1066
+
1067
+ profile
1068
+
1069
+ }
1070
+
1071
+ renv_bootstrap_path_absolute <- function(path) {
1072
+
1073
+ substr(path, 1L, 1L) %in% c("~", "/", "\\") || (
1074
+ substr(path, 1L, 1L) %in% c(letters, LETTERS) &&
1075
+ substr(path, 2L, 3L) %in% c(":/", ":\\")
1076
+ )
1077
+
1078
+ }
1079
+
1080
+ renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) {
1081
+ renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv")
1082
+ root <- if (renv_bootstrap_path_absolute(renv)) NULL else project
1083
+ prefix <- if (profile) renv_bootstrap_profile_prefix()
1084
+ components <- c(root, renv, prefix, ...)
1085
+ paste(components, collapse = "/")
1086
+ }
1087
+
1088
+ renv_bootstrap_project_type <- function(path) {
1089
+
1090
+ descpath <- file.path(path, "DESCRIPTION")
1091
+ if (!file.exists(descpath))
1092
+ return("unknown")
1093
+
1094
+ desc <- tryCatch(
1095
+ read.dcf(descpath, all = TRUE),
1096
+ error = identity
1097
+ )
1098
+
1099
+ if (inherits(desc, "error"))
1100
+ return("unknown")
1101
+
1102
+ type <- desc$Type
1103
+ if (!is.null(type))
1104
+ return(tolower(type))
1105
+
1106
+ package <- desc$Package
1107
+ if (!is.null(package))
1108
+ return("package")
1109
+
1110
+ "unknown"
1111
+
1112
+ }
1113
+
1114
+ renv_bootstrap_user_dir <- function() {
1115
+ dir <- renv_bootstrap_user_dir_impl()
1116
+ path.expand(chartr("\\", "/", dir))
1117
+ }
1118
+
1119
+ renv_bootstrap_user_dir_impl <- function() {
1120
+
1121
+ # use local override if set
1122
+ override <- getOption("renv.userdir.override")
1123
+ if (!is.null(override))
1124
+ return(override)
1125
+
1126
+ # use R_user_dir if available
1127
+ tools <- asNamespace("tools")
1128
+ if (is.function(tools$R_user_dir))
1129
+ return(tools$R_user_dir("renv", "cache"))
1130
+
1131
+ # try using our own backfill for older versions of R
1132
+ envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME")
1133
+ for (envvar in envvars) {
1134
+ root <- Sys.getenv(envvar, unset = NA)
1135
+ if (!is.na(root))
1136
+ return(file.path(root, "R/renv"))
1137
+ }
1138
+
1139
+ # use platform-specific default fallbacks
1140
+ if (Sys.info()[["sysname"]] == "Windows")
1141
+ file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv")
1142
+ else if (Sys.info()[["sysname"]] == "Darwin")
1143
+ "~/Library/Caches/org.R-project.R/R/renv"
1144
+ else
1145
+ "~/.cache/R/renv"
1146
+
1147
+ }
1148
+
1149
+ renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) {
1150
+ sha <- sha %||% attr(version, "sha", exact = TRUE)
1151
+ parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L)))
1152
+ paste(parts, collapse = "")
1153
+ }
1154
+
1155
+ renv_bootstrap_exec <- function(project, libpath, version) {
1156
+ if (!renv_bootstrap_load(project, libpath, version))
1157
+ renv_bootstrap_run(project, libpath, version)
1158
+ }
1159
+
1160
+ renv_bootstrap_run <- function(project, libpath, version) {
1161
+
1162
+ # perform bootstrap
1163
+ bootstrap(version, libpath)
1164
+
1165
+ # exit early if we're just testing bootstrap
1166
+ if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA)))
1167
+ return(TRUE)
1168
+
1169
+ # try again to load
1170
+ if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) {
1171
+ return(renv::load(project = project))
1172
+ }
1173
+
1174
+ # failed to download or load renv; warn the user
1175
+ msg <- c(
1176
+ "Failed to find an renv installation: the project will not be loaded.",
1177
+ "Use `renv::activate()` to re-initialize the project."
1178
+ )
1179
+
1180
+ warning(paste(msg, collapse = "\n"), call. = FALSE)
1181
+
1182
+ }
1183
+
1184
+ renv_json_read <- function(file = NULL, text = NULL) {
1185
+
1186
+ jlerr <- NULL
1187
+
1188
+ # if jsonlite is loaded, use that instead
1189
+ if ("jsonlite" %in% loadedNamespaces()) {
1190
+
1191
+ json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity)
1192
+ if (!inherits(json, "error"))
1193
+ return(json)
1194
+
1195
+ jlerr <- json
1196
+
1197
+ }
1198
+
1199
+ # otherwise, fall back to the default JSON reader
1200
+ json <- tryCatch(renv_json_read_default(file, text), error = identity)
1201
+ if (!inherits(json, "error"))
1202
+ return(json)
1203
+
1204
+ # report an error
1205
+ if (!is.null(jlerr))
1206
+ stop(jlerr)
1207
+ else
1208
+ stop(json)
1209
+
1210
+ }
1211
+
1212
+ renv_json_read_jsonlite <- function(file = NULL, text = NULL) {
1213
+ text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
1214
+ jsonlite::fromJSON(txt = text, simplifyVector = FALSE)
1215
+ }
1216
+
1217
+ renv_json_read_patterns <- function() {
1218
+
1219
+ list(
1220
+
1221
+ # objects
1222
+ list("{", "\t\n\tobject(\t\n\t", TRUE),
1223
+ list("}", "\t\n\t)\t\n\t", TRUE),
1224
+
1225
+ # arrays
1226
+ list("[", "\t\n\tarray(\t\n\t", TRUE),
1227
+ list("]", "\n\t\n)\n\t\n", TRUE),
1228
+
1229
+ # maps
1230
+ list(":", "\t\n\t=\t\n\t", TRUE),
1231
+
1232
+ # newlines
1233
+ list("\\u000a", "\n", FALSE)
1234
+
1235
+ )
1236
+
1237
+ }
1238
+
1239
+ renv_json_read_envir <- function() {
1240
+
1241
+ envir <- new.env(parent = emptyenv())
1242
+
1243
+ envir[["+"]] <- `+`
1244
+ envir[["-"]] <- `-`
1245
+
1246
+ envir[["object"]] <- function(...) {
1247
+ result <- list(...)
1248
+ names(result) <- as.character(names(result))
1249
+ result
1250
+ }
1251
+
1252
+ envir[["array"]] <- list
1253
+
1254
+ envir[["true"]] <- TRUE
1255
+ envir[["false"]] <- FALSE
1256
+ envir[["null"]] <- NULL
1257
+
1258
+ envir
1259
+
1260
+ }
1261
+
1262
+ renv_json_read_remap <- function(object, patterns) {
1263
+
1264
+ # repair names if necessary
1265
+ if (!is.null(names(object))) {
1266
+
1267
+ nms <- names(object)
1268
+ for (pattern in patterns)
1269
+ nms <- gsub(pattern[[2L]], pattern[[1L]], nms, fixed = TRUE)
1270
+ names(object) <- nms
1271
+
1272
+ }
1273
+
1274
+ # repair strings if necessary
1275
+ if (is.character(object)) {
1276
+ for (pattern in patterns)
1277
+ object <- gsub(pattern[[2L]], pattern[[1L]], object, fixed = TRUE)
1278
+ }
1279
+
1280
+ # recurse for other objects
1281
+ if (is.recursive(object))
1282
+ for (i in seq_along(object))
1283
+ object[i] <- list(renv_json_read_remap(object[[i]], patterns))
1284
+
1285
+ # return remapped object
1286
+ object
1287
+
1288
+ }
1289
+
1290
+ renv_json_read_default <- function(file = NULL, text = NULL) {
1291
+
1292
+ # read json text
1293
+ text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
1294
+
1295
+ # convert into something the R parser will understand
1296
+ patterns <- renv_json_read_patterns()
1297
+ transformed <- text
1298
+ for (pattern in patterns)
1299
+ transformed <- gsub(pattern[[1L]], pattern[[2L]], transformed, fixed = TRUE)
1300
+
1301
+ # parse it
1302
+ rfile <- tempfile("renv-json-", fileext = ".R")
1303
+ on.exit(unlink(rfile), add = TRUE)
1304
+ writeLines(transformed, con = rfile)
1305
+ json <- parse(rfile, keep.source = FALSE, srcfile = NULL)[[1L]]
1306
+
1307
+ # evaluate in safe environment
1308
+ result <- eval(json, envir = renv_json_read_envir())
1309
+
1310
+ # fix up strings if necessary -- do so only with reversible patterns
1311
+ patterns <- Filter(function(pattern) pattern[[3L]], patterns)
1312
+ renv_json_read_remap(result, patterns)
1313
+
1314
+ }
1315
+
1316
+
1317
+ # load the renv profile, if any
1318
+ renv_bootstrap_profile_load(project)
1319
+
1320
+ # construct path to library root
1321
+ root <- renv_bootstrap_library_root(project)
1322
+
1323
+ # construct library prefix for platform
1324
+ prefix <- renv_bootstrap_platform_prefix()
1325
+
1326
+ # construct full libpath
1327
+ libpath <- file.path(root, prefix)
1328
+
1329
+ # run bootstrap code
1330
+ renv_bootstrap_exec(project, libpath, version)
1331
+
1332
+ invisible()
1333
+
1334
+ })
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/DESCRIPTION ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Package: renv
2
+ Type: Package
3
+ Title: Project Environments
4
+ Version: 1.1.5
5
+ Authors@R: c(
6
+ person("Kevin", "Ushey", role = c("aut", "cre"), email = "kevin@rstudio.com",
7
+ comment = c(ORCID = "0000-0003-2880-7407")),
8
+ person("Hadley", "Wickham", role = c("aut"), email = "hadley@rstudio.com",
9
+ comment = c(ORCID = "0000-0003-4757-117X")),
10
+ person("Posit Software, PBC", role = c("cph", "fnd"))
11
+ )
12
+ Description: A dependency management toolkit for R. Using 'renv', you can create
13
+ and manage project-local R libraries, save the state of these libraries to
14
+ a 'lockfile', and later restore your library as required. Together, these
15
+ tools can help make your projects more isolated, portable, and reproducible.
16
+ License: MIT + file LICENSE
17
+ URL: https://rstudio.github.io/renv/, https://github.com/rstudio/renv
18
+ BugReports: https://github.com/rstudio/renv/issues
19
+ Imports: utils
20
+ Suggests: BiocManager, cli, compiler, covr, cpp11, devtools, generics,
21
+ gitcreds, jsonlite, jsonvalidate, knitr, miniUI, modules,
22
+ packrat, pak, R6, remotes, reticulate, rmarkdown, rstudioapi,
23
+ shiny, testthat, uuid, waldo, yaml, webfakes
24
+ Encoding: UTF-8
25
+ RoxygenNote: 7.3.2
26
+ VignetteBuilder: knitr
27
+ Config/Needs/website: tidyverse/tidytemplate
28
+ Config/testthat/edition: 3
29
+ Config/testthat/parallel: true
30
+ Config/testthat/start-first:
31
+ bioconductor,python,install,restore,snapshot,retrieve,remotes
32
+ NeedsCompilation: no
33
+ Packaged: 2025-07-24 20:47:34 UTC; kevin
34
+ Author: Kevin Ushey [aut, cre] (ORCID: <https://orcid.org/0000-0003-2880-7407>),
35
+ Hadley Wickham [aut] (ORCID: <https://orcid.org/0000-0003-4757-117X>),
36
+ Posit Software, PBC [cph, fnd]
37
+ Maintainer: Kevin Ushey <kevin@rstudio.com>
38
+ Repository: CRAN
39
+ Date/Publication: 2025-07-24 21:40:02 UTC
40
+ Built: R 4.5.1; ; 2025-10-06 00:52:18 UTC; windows
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/INDEX ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ activate Activate or deactivate a project
2
+ autoload Auto-load the active project
3
+ checkout Checkout a repository
4
+ clean Clean a project
5
+ config User-level settings
6
+ consent Consent to usage of renv
7
+ dependencies Find R package dependencies in a project
8
+ diagnostics Print a diagnostics report
9
+ embed Capture and re-use dependencies within a '.R',
10
+ '.Rmd' or '.qmd'
11
+ history View and revert to a historical lockfile
12
+ imbue Imbue an renv Installation
13
+ init Use renv in a project
14
+ install Install packages
15
+ isolate Isolate a project
16
+ load Load a project
17
+ lockfiles Lockfiles
18
+ migrate Migrate a project from packrat to renv
19
+ modify Modify a Lockfile
20
+ paths Path for storing global state
21
+ project Retrieve the active project
22
+ purge Purge packages from the cache
23
+ rebuild Rebuild the packages in your project library
24
+ record Update package records in a lockfile
25
+ refresh Refresh the local cache of available packages
26
+ rehash Re-hash packages in the renv cache
27
+ remote Resolve a Remote
28
+ remove Remove packages
29
+ renv-package Project-local Environments for R
30
+ repair Repair a project
31
+ restore Restore project library from a lockfile
32
+ retrieve Retrieve packages
33
+ run Run a script
34
+ sandbox The default library sandbox
35
+ scaffold Generate project infrastructure
36
+ settings Project settings
37
+ snapshot Record current state of the project library in
38
+ the lockfile
39
+ status Report inconsistencies between lockfile,
40
+ library, and dependencies
41
+ sysreqs R System Requirements
42
+ update Update packages
43
+ upgrade Upgrade renv
44
+ use_python Use python
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/LICENSE ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ YEAR: 2025
2
+ COPYRIGHT HOLDER: Posit Software, PBC
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/MD5 ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c5d8c489e2157d9d03ab32c719f8a6b2 *DESCRIPTION
2
+ ffc7d98cd968589b4559299a1bec4a48 *INDEX
3
+ 0d37e729582c25a6fc726cf9f8763140 *LICENSE
4
+ fc7fedf0bc60154d18f26e09da68ee4a *Meta/Rd.rds
5
+ 97f39cfa069205fc947ab1e51ea53d4e *Meta/features.rds
6
+ 5cf9daf20085ed2d641679940b048f66 *Meta/hsearch.rds
7
+ 698c2f9238cc8db0e9ead83db7e48d9b *Meta/links.rds
8
+ 19a8aedb20addf5e98236c305580383d *Meta/nsInfo.rds
9
+ 2809cf24689debb00c47a2bb9f37b9e8 *Meta/package.rds
10
+ 7fa855e9d63d009f3ddeb81d63f983d6 *Meta/vignette.rds
11
+ 9cd30053a51f82ef8e77b7f7a33786c2 *NAMESPACE
12
+ 337f9cc15b344eb4f51124af121f5d84 *NEWS.md
13
+ d6c68f1fe41ced6e98a766a3757313da *R/renv
14
+ 373b7cab7b29d54a28c22e232f22bd5f *R/renv.rdb
15
+ 304080e5caadfc883c104f6dc66e0773 *R/renv.rdx
16
+ bbd0f31a99032014b85ee7e57b604da8 *bin/renv
17
+ 64af3537ec68355c83d8c11a9edc5ace *bin/renv.bat
18
+ ed79102f3bbeaa1db3cb59472a5d572c *config.yml
19
+ 25ee8dd0f95a8eb5c34ca2c95e0031c2 *doc/ci.R
20
+ bbc0b57c605ca7bdd7f4ff461631f516 *doc/ci.Rmd
21
+ e7b732d93a986d3f6a4f946748437285 *doc/ci.html
22
+ 25ee8dd0f95a8eb5c34ca2c95e0031c2 *doc/docker.R
23
+ b0aeeb316287ab1a4b33fd39edb6f404 *doc/docker.Rmd
24
+ 32a3fa84767d0490d771704c02aea98a *doc/docker.html
25
+ 967388b8be33dc6690fd11f9ab123ede *doc/faq.R
26
+ 38216911fd5d56f14b213825b74e4c30 *doc/faq.Rmd
27
+ 13b3d8aee5765c66fac10b1098742f5a *doc/faq.html
28
+ c2df4d32fa83979a769004aee71e2055 *doc/index.html
29
+ ac80c906219e0881596ad649e10ca0e7 *doc/package-install.R
30
+ 4ca39246ce092e6750c2e169cd7d7415 *doc/package-install.Rmd
31
+ 55354cb2de7c6c7926bba33506894713 *doc/package-install.html
32
+ 8fad93585af2ca808bc5f0c5f4b9e48f *doc/package-sources.R
33
+ 252378a26c59438a315dfbf7c0323e86 *doc/package-sources.Rmd
34
+ 7e245342a719fc750d7e38928fd6a9ae *doc/package-sources.html
35
+ cb0bb561a0c04947b860c100b28e4e62 *doc/packages.R
36
+ 8ee0f53c4ec62650ffddca39c642b11a *doc/packages.Rmd
37
+ ddd3b400337284cf3c59fd77c9863913 *doc/packages.html
38
+ 35adc15da3c96ab90464927525185a3c *doc/packrat.R
39
+ 6c5c41c499a5b7df70d63f64772c9050 *doc/packrat.Rmd
40
+ b31c489ea4a2e1e38ec1b7f91d44150e *doc/packrat.html
41
+ 958902b8cd108c353df2c6c41a6c7612 *doc/profiles.R
42
+ 6ca67b63922c88c4b46f78417d0c7d23 *doc/profiles.Rmd
43
+ a2dec62988a7c04d7f64681cf806500a *doc/profiles.html
44
+ 25ee8dd0f95a8eb5c34ca2c95e0031c2 *doc/python.R
45
+ 44f57dfdaa4ed236deb9fdd4070a8e59 *doc/python.Rmd
46
+ c9eeedc715edc6cd9d9dde296fd0d12e *doc/python.html
47
+ 6c5b1238e42fc8a2488ad73aa1cb7dfd *doc/renv.R
48
+ d30e4c4f776341b6ff2648a496095bfb *doc/renv.Rmd
49
+ ea39c9ac07269d67364c15a271b14aab *doc/renv.html
50
+ 25ee8dd0f95a8eb5c34ca2c95e0031c2 *doc/rsconnect.R
51
+ ca8ebc764f16251d80cba7c1fed0f40d *doc/rsconnect.Rmd
52
+ a9dd905639ed0b21e13e9dd490e6d94e *doc/rsconnect.html
53
+ 2ae06701f8059e053b6862920fcab4b9 *ext/renv.c
54
+ 66791df47f538fdc1dcf07d279bcc348 *help/AnIndex
55
+ 446b065bb406ef8a4724a989611c2797 *help/aliases.rds
56
+ 268d837fc485cdd1a80a48b8dcfde613 *help/figures/logo.svg
57
+ 23b98263e3e7d5f49c29297e8e6892ee *help/paths.rds
58
+ 8620256521337c665eed6e78e8e8f279 *help/renv.rdb
59
+ f80c2b1a3a42bb25d854b9b1b6411fa5 *help/renv.rdx
60
+ dd05677433fd5c706810facee5f3e5e3 *html/00Index.html
61
+ 8b9362669af13540a86a3ac6cf22f99d *html/R.css
62
+ 286fec9ce3625c787546337b633c330d *repos/src/contrib/PACKAGES
63
+ a4559dbd631559c694552f82b51629b5 *repos/src/contrib/PACKAGES.gz
64
+ 82040a1a2e09e1d8378d2c668b146767 *repos/src/contrib/PACKAGES.rds
65
+ 810097cd50cabaa53f5be2e489ad3ad4 *repos/src/contrib/renv_1.1.5.tar.gz
66
+ c852598faf15e9a614eee1ae5933ad09 *resources/WELCOME
67
+ 60e2e5f466d4aa607c2e80fdc8108e0d *resources/activate.R
68
+ 38ebcc4778f15ad0c0e1cf144f17bf4e *resources/scripts-git-askpass.cmd
69
+ 0f28660d57f2dd9dad52380e812e83d5 *resources/scripts-git-askpass.sh
70
+ 63ba0c4b0cfe770b0241478e3e93ef37 *resources/vendor/renv.R
71
+ d41d8cd98f00b204e9800998ecf8427e *resources/watchdog-process.R
72
+ 5a30cca829fc56645aa643e1b9b12ae9 *rstudio/addins.dcf
73
+ a4018a811560562430f0a19df6439ab4 *schema/draft-07.renv.lock.schema.json
74
+ 5de6852987292942c6ca1d805d8c6290 *sysreqs/sysreqs.json
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/Rd.rds ADDED
Binary file (1.76 kB). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/features.rds ADDED
Binary file (123 Bytes). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/hsearch.rds ADDED
Binary file (1.58 kB). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/links.rds ADDED
Binary file (706 Bytes). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/nsInfo.rds ADDED
Binary file (794 Bytes). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/package.rds ADDED
Binary file (1.55 kB). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/Meta/vignette.rds ADDED
Binary file (490 Bytes). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/NAMESPACE ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated by roxygen2: do not edit by hand
2
+
3
+ export(activate)
4
+ export(autoload)
5
+ export(checkout)
6
+ export(clean)
7
+ export(config)
8
+ export(consent)
9
+ export(deactivate)
10
+ export(dependencies)
11
+ export(diagnostics)
12
+ export(embed)
13
+ export(equip)
14
+ export(history)
15
+ export(hydrate)
16
+ export(init)
17
+ export(install)
18
+ export(isolate)
19
+ export(load)
20
+ export(lockfile_create)
21
+ export(lockfile_modify)
22
+ export(lockfile_read)
23
+ export(lockfile_validate)
24
+ export(lockfile_write)
25
+ export(migrate)
26
+ export(modify)
27
+ export(paths)
28
+ export(project)
29
+ export(purge)
30
+ export(rebuild)
31
+ export(record)
32
+ export(refresh)
33
+ export(rehash)
34
+ export(remove)
35
+ export(repair)
36
+ export(restore)
37
+ export(retrieve)
38
+ export(revert)
39
+ export(run)
40
+ export(sandbox)
41
+ export(scaffold)
42
+ export(settings)
43
+ export(snapshot)
44
+ export(status)
45
+ export(sysreqs)
46
+ export(update)
47
+ export(upgrade)
48
+ export(use)
49
+ export(use_python)
50
+ importFrom(tools,file_ext)
51
+ importFrom(tools,md5sum)
52
+ importFrom(tools,package_dependencies)
53
+ importFrom(tools,pskill)
54
+ importFrom(tools,psnice)
55
+ importFrom(tools,write_PACKAGES)
56
+ importFrom(utils,Rprof)
57
+ importFrom(utils,URLencode)
58
+ importFrom(utils,adist)
59
+ importFrom(utils,available.packages)
60
+ importFrom(utils,browseURL)
61
+ importFrom(utils,citation)
62
+ importFrom(utils,contrib.url)
63
+ importFrom(utils,download.file)
64
+ importFrom(utils,download.packages)
65
+ importFrom(utils,file.edit)
66
+ importFrom(utils,getCRANmirrors)
67
+ importFrom(utils,head)
68
+ importFrom(utils,help)
69
+ importFrom(utils,install.packages)
70
+ importFrom(utils,installed.packages)
71
+ importFrom(utils,modifyList)
72
+ importFrom(utils,old.packages)
73
+ importFrom(utils,packageDescription)
74
+ importFrom(utils,packageVersion)
75
+ importFrom(utils,read.table)
76
+ importFrom(utils,remove.packages)
77
+ importFrom(utils,sessionInfo)
78
+ importFrom(utils,str)
79
+ importFrom(utils,summaryRprof)
80
+ importFrom(utils,tail)
81
+ importFrom(utils,tar)
82
+ importFrom(utils,toBibtex)
83
+ importFrom(utils,untar)
84
+ importFrom(utils,unzip)
85
+ importFrom(utils,update.packages)
86
+ importFrom(utils,zip)
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/NEWS.md ADDED
@@ -0,0 +1,2067 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # renv 1.1.5
3
+
4
+ * Fixed an issue where `renv::dependencies()` could fail for chunks which
5
+ had a `label` which was not a length-one character vector. (#2144)
6
+
7
+ * Fixed an issue where `file.rename()` could fail when unpacking a
8
+ package during installation in certain Windows environments. (#2156)
9
+
10
+ * `renv`'s dependency discovery now supports usages of `base::use()`. (#2130)
11
+
12
+ * Fixed an issue where `renv` could fail to parse remote references
13
+ containing an `@` character. (#2135)
14
+
15
+ * Fixed an issue where `renv::sysreqs(distro = <...>)` could fail when
16
+ passed an alternate distribution without a version specifier. (#2105)
17
+
18
+ * Fixed an issue where multimode R documents containing chunk headers
19
+ which did not parse to an R list could cause dependency inference
20
+ to fail. (#2110)
21
+
22
+
23
+ # renv 1.1.4
24
+
25
+ * Fixed an issue where `renv` could erroneously record packages installed
26
+ from Posit Package Manager snapshots as being installed from CRAN. (#2104)
27
+
28
+ * `renv` now only checks for archived packages during installation when
29
+ `options(renv.install.allowArchivedPackages = TRUE)` is set. This fixes
30
+ an issue where `renv` could erroneously discover that Rcpp 1.3 was
31
+ available when using the Posit Package Manager repository.
32
+
33
+ * Fixed an issue where `renv::dependencies()` could fail with an
34
+ unhelpful error message if the scanned document contained a
35
+ YAML header whose contents was not a map. (#2117)
36
+
37
+
38
+ # renv 1.1.3
39
+
40
+ * Fixed an issue where `renv::hydrate()` could fail to install packages
41
+ discovered in the user library during `renv::init()`. (#2109)
42
+
43
+ * `renv::update()` now only updates the packages installed in the project
44
+ library by default. `renv::update(all = TRUE)` can be used to also
45
+ check if packages installed in the default library are out-of-date, and
46
+ install updated copies into the project library. (#2108)
47
+
48
+ * Fixed an issue where package installation could fail on Arch Linux with the
49
+ error message "don't know how to check sysreqs on this system". (#2107)
50
+
51
+ * `renv` now supports profile-specific comments within `.gitignore` and
52
+ `.renvignore` files. These are comments of the form `#| <code>`, where
53
+ `<code>` is R code which should indicate if the `.renvignore` rules should
54
+ apply. Typically, this should be of the form `#| profile == "extra"`, or
55
+ `#| profile %in% c("extra", "other")`. Note that only a small subset of
56
+ base R functions are available for evaluation in this context. Note that
57
+ the first section in a `.renvignore` implicitly applies to all profiles --
58
+ if you want to limit it to just the default profile, you can use
59
+ `#| profile == "default"` for the first line. (#1662)
60
+
61
+ * The environment variable `RENV_PATHS_VERSION` can now be used to substitute
62
+ the R version component normally used in library / cache paths. The provided
63
+ path can include placeholders like `%V` for the full R version including
64
+ the patch level, and `%v` for the R version without the patch level. Defaults
65
+ to `R-%v` when unset. (#1687)
66
+
67
+ * `renv::install()` gains the `transactional` argument, for parity with
68
+ `renv::restore()`. (#1109)
69
+
70
+
71
+ # renv 1.1.2
72
+
73
+ * `renv` gains the `sysreqs()` function, which can be used to query the system
74
+ packages required by a set of R packages. Functionality is currently available
75
+ for Debian-based distributions, as well as Red Hat distributions.
76
+
77
+ * On Linux, `renv` now uses the database from
78
+ <https://github.com/rstudio/r-system-requirements> when determining if
79
+ an R package's required system libraries are installed, and notifies
80
+ the user which packages (if any) are missing during install / restore.
81
+
82
+ * Fixed an issue where `renv` could fail to retrieve credentials registered
83
+ for 'github.com' when querying URLs at 'api.github.com'.
84
+
85
+ * Fixed an issue where `renv` could stall when loading a project and validating
86
+ that the configured version of Bioconductor is compatible with the version
87
+ of R currently in use.
88
+
89
+ * `renv::snapshot()` no longer fails to generate a new lockfile if the project
90
+ contains a lockfile which could not be read or parsed.
91
+
92
+ * Fixed an issue where lockfiles containing unicode characters were not
93
+ correctly written or read with versions of R (< 4.2.0) on Windows. (#2091)
94
+
95
+
96
+ # renv 1.1.1
97
+
98
+ * Fixed an issue where very long lockfiles could be truncated on write. (#2089)
99
+
100
+ * Fixed an issue where `renv` inadvertently made web requests in
101
+ tests during `R CMD check`.
102
+
103
+
104
+ # renv 1.1.0
105
+
106
+ ## Major Changes
107
+
108
+ * `renv` now includes additional package DESCRIPTION fields in the lockfile.
109
+ This can be useful for validating the provenance of packages recorded in the
110
+ lockfile, and also for applications using `renv` which would like to
111
+ recompute the hash used for package caching from the lockfile itself.
112
+
113
+ If needed, old-style lockfiles can be generated by setting the option
114
+ `options(renv.lockfile.version = 1)`. Note that this version of `renv`
115
+ remains compatible both with the older (minimal) lockfiles, as well
116
+ as with the newer lockfiles in this release. (#2057)
117
+
118
+ ## Other Fixes
119
+
120
+ * The `renv` sandbox is now unlocked on exit after a call to `renv::use()`.
121
+ This should alleviate issues seen where R's attempts to clean up the
122
+ temporary directory could fail due to inadequate permissions on the
123
+ sandbox directory. (#2076)
124
+
125
+ * Fixed an issue where `renv::restore()` did not respect the named repository
126
+ within the lockfile when installing packages from the archives of the
127
+ configured package repositories. (#2081)
128
+
129
+ * Fixed an issue where `renv::snapshot()` could fail if invoked within
130
+ a project containing empty or invalid `.ipynb` files. (#2073)
131
+
132
+ * Fixed an issue where R package installation could fail if the project
133
+ depended on a package whose current version available from the configured
134
+ package repositories required on a newer version of R than what was currently
135
+ installed, even if that package need not be updated. (#2071)
136
+
137
+ * Fixed an issue where `RENV_CONFIG_EXTERNAL_LIBRARIES` was incorrectly
138
+ split when using Windows paths. (#2069)
139
+
140
+ * Fixed an issue where `renv` failed to restore packages installed from
141
+ r-universe when the associated lockfile record had no `RemoteRef` field.
142
+ (#2068)
143
+
144
+ * `renv` now detects dependencies from usages of `utils::citation()`. (#2047)
145
+
146
+ * Fixed an issue where packages installed from r-universe via an explicit
147
+ URL remote could not be restored. (#2060)
148
+
149
+ * Fixed an issue where the repositories provided to `renv::init()` were ignored
150
+ when also initializing `renv` with a specific version of Bioconductor.
151
+
152
+ * `renv::install()` gains the `include` parameter, which can be useful when
153
+ you'd like to install a subset of dependencies within a project while also
154
+ respecting any declared remotes in that project's `DESCRIPTION` file. (#2055)
155
+
156
+ * Fixed an issue where `renv` could fail to check for updates for packages
157
+ installed using `pak` without an explicit branch specified. (#2040)
158
+
159
+ * `renv::use()` no longer re-installs packages which are already installed
160
+ and compatible with the requested packages. (#2044)
161
+
162
+ * Fixed an issue where `renv::init()` could fail when using named remotes
163
+ in a DESCRIPTION file's `Remotes:` field. (#2055)
164
+
165
+ * Fixed an issue where ignore rules of the form `!*.*` were not parsed
166
+ and handled correctly during dependency discovery. (#2052)
167
+
168
+ * Fixed an issue where `renv` erroneously reported that installed packages were
169
+ cached when the cache was not writable. (#2041).
170
+
171
+ * `renv` now supports updating of currently-installed packages via `renv::install()`
172
+ when configured to use `pak`. (#2037)
173
+
174
+ * Fixed an issue where `renv` library paths were not properly reset following
175
+ a suspend / resume in RStudio Server. (#2036)
176
+
177
+ * `renv::run()` gains the `args` parameter, which can be used to pass command-line
178
+ arguments to a script. (#2015)
179
+
180
+ * `renv` now infers a dependency on `rmarkdown` and `knitr` for R scripts which
181
+ include YAML front-matter. (#2023)
182
+
183
+ * The performance of `renv`'s built-in JSON reader has been improved. (#2021)
184
+
185
+ * Fixed an issue where `renv` could erroneously create a binding called 'object'
186
+ in the global environment on startup. (#2017)
187
+
188
+
189
+ # renv 1.0.11
190
+
191
+ * Fixed an issue where headers were not properly passed to `available.packages()`
192
+ during `renv` bootstrap. (#1942)
193
+
194
+ * `renv` now assumes that Artifactory package repositories will use a CRAN-like
195
+ layout of packages for packages in the archive. (#1996)
196
+
197
+ * `renv` now includes compiled extensions on Linux + macOS. These
198
+ extensions are primarily used to improve the performance of
199
+ `renv::dependencies()` and other static analysis code.
200
+ Support for Windows may come in a future release.
201
+
202
+ * Fixed an issue where `renv::snapshot()` could fail if the project
203
+ contained a call to `module()` with no arguments. (#2007)
204
+
205
+ * On Linux, `renv` now emits a message on load if the R temporary directory
206
+ is within a folder that has been mounted as 'noexec'. This message can be
207
+ suppressed by setting the `RENV_TEMPDIR_NOEXEC_CHECK=FALSE` environment
208
+ variable.
209
+
210
+
211
+ # renv 1.0.10
212
+
213
+ * Fixed a performance regression in `renv::dependencies()`. (#1999)
214
+
215
+ * Fixed an issue where `renv` tests could fail if the `parallel` package was
216
+ loaded during test execution.
217
+
218
+ * `renv` now determines a package repository's type through the HTTP headers
219
+ provided when accessing `src/contrib/PACKAGES`. This is mainly relevant
220
+ when detecting Nexus and Artifactory repositories.
221
+
222
+
223
+ # renv 1.0.9
224
+
225
+ * Fixed an issue where repository URLs were inappropriately transformed into
226
+ binary repository URLs on Linux. (#1991)
227
+
228
+ * Fixed an issue where code following `source("renv/activate.R")` in the project
229
+ `.Rprofile` was not invoked for projects using RStudio. (#1990)
230
+
231
+
232
+ # renv 1.0.8
233
+
234
+ * `renv` now infers a dependency on the `ragg` package when the `ragg_png` device
235
+ is used in R Markdown / Quarto documents, for documents using the code
236
+ `knitr::opts_chunk$set(dev = "ragg_png")`. (#1985)
237
+
238
+ * `renv` now automatically generates a lockfile when loading a project containing
239
+ a `manifest.json` file (typical for application bundles published to Posit Connect).
240
+ (#1980, @toph-allen)
241
+
242
+ * `renv::install()` now errs if an incompatible `type` argument is provided.
243
+
244
+ * `renv::checkout()` now also checks out the version of `renv` available
245
+ and associated with the requested snapshot date. (#1966)
246
+
247
+ * Fixed an issue where `renv::hydrate()` did not hydrate packages which
248
+ were also listed as dependencies within a project's `DESCRIPTION` file.
249
+ (#1970)
250
+
251
+ * Fixed an issue where `renv::checkout()` omitted some fields from lockfile
252
+ records when using `actions = c("snapshot", "restore")`. (#1969)
253
+
254
+ * `renv` gains the function `renv::retrieve()`, which can be used to download
255
+ packages without installing them. This is primarily useful in CI / CD scenarios,
256
+ where you might want to download packages in a single stage before attempting
257
+ to install / restore them. (#1965)
258
+
259
+ * `renv` now preserves `Remote` fields present on packages installed from
260
+ public package repositories (e.g. <https://r-universe.dev/>). (#1961)
261
+
262
+ * Fixed an issue where `renv::load()` could fail to load an alternate project
263
+ when `options(renv.config.autoloader.enabled = FALSE)` was set. (#1959)
264
+
265
+ * `renv` now emits clickable hyperlinks for runnable code snippets and help,
266
+ for front-ends which support the `ide:run` and `ide:help` ANSI escapes.
267
+
268
+ * `renv::init(bioc = "<version>")` now prompts the user in interactive sessions
269
+ when requesting a version of Bioconductor which is not compatible with the
270
+ current version of R. (#1943)
271
+
272
+ * `renv::restore()` gains the `transactional` argument, which can be
273
+ used to control whether `renv` will allow successfully-installed
274
+ packages remain in the project library even if a package fails
275
+ to install during a later step. (#1109)
276
+
277
+ * `renv` now infers a dependency on the `xml2` package for projects
278
+ using the `testthat::JunitReporter` for tests. (#1936)
279
+
280
+ * Fixed an issue where `renv::dependencies()` could emit a warning
281
+ when attempting to parse chunks using chunk options like
282
+ `#| eval: c(1, 2)`. (#1906)
283
+
284
+ * `renv::install()` now properly delegates the `type` and `rebuild`
285
+ arguments to `pak` when `options(renv.config.pak.enabled = TRUE)`
286
+ is set. (#1924)
287
+
288
+ * `renv` now infers a dependency on the `svglite` package if it detects
289
+ calls of the form `ggsave(filename = "path.svg")`. (#1930)
290
+
291
+ * `renv` now supports setting of GitHub authentication credentials via
292
+ any of `GITHUB_TOKEN`, `GITHUB_PAT`, and `GH_TOKEN`. (#1937)
293
+
294
+ * `renv` now also passes any custom headers available to
295
+ `utils::available.packages()` during bootstrap. (#1942)
296
+
297
+ * Fixed an issue where `renv` could fail during installation of packages
298
+ stored within repository sub-directories, if that repository also
299
+ contained a top-level DESCRIPTION file. (#1941)
300
+
301
+ * `renv` now normalizes lockfile entries for Bioconductor packages installed
302
+ via `pak::pkg_install()`, to help prevent spurious diffs being produced
303
+ via `renv::status()`. (#1920)
304
+
305
+ * `renv::install()` now respects the `prompt` parameter when `pak` is enabled,
306
+ as via `options(renv.config.pak.enabled = TRUE)`. (#1907)
307
+
308
+ * Fixed an issue with `renv`'s `pak` integration where `renv` could install the
309
+ wrong version of a GitHub package during restore if
310
+ `options(renv.config.pak.enabled = TRUE)` was set. (#1883)
311
+
312
+ * `renv` no longer interacts with the user during autoloading, which coincides
313
+ with R startup. If the IDE offers a session init hook (RStudio does),
314
+ loading is deferred until startup is complete and interaction is possible.
315
+ Otherwise, any suggested renv actions, such as `renv::restore()`, are emitted
316
+ as a message for the user to act on. (#1879, #1915).
317
+
318
+ * Fixed an issue where installation of packages from local sources, as via
319
+ `install("<package>", repos = NULL, type = "source")`, could fail. (#1880)
320
+
321
+ * A new function, `renv::lockfile_validate()`, can be used to validate your `renv.lock`
322
+ against a default or custom schema. (#1889)
323
+
324
+
325
+ # renv 1.0.7
326
+
327
+ * Fixed an issue where `renv`'s activate script failed to report version
328
+ conflict errors when starting up. (#1874)
329
+
330
+
331
+ # renv 1.0.6
332
+
333
+ * Fixed an issue where downloads could fail with curl >= 8.7.1. (#1869)
334
+
335
+ * Fixed an issue where `renv::snapshot()` did not properly normalize
336
+ package records generated from packages installed using the `pak`
337
+ package, e.g. via `pak::pkg_install("cran::<package>")`.
338
+
339
+ * Fixed an issue where `renv` could incorrectly prompt the user to record
340
+ a version of `renv` installed from GitHub in some cases. (#1857)
341
+
342
+ * `renv::load()` now delegates to `base::load()` when it detects that the
343
+ call was likely intended for `base::load()`, but `renv::load()` was used
344
+ instead (e.g. because `base::load()` was masked by `renv::load()`).
345
+
346
+ * `renv::update()` gains the `lock` argument, which can be used to
347
+ instruct `renv` to automatically update the lockfile after the requested
348
+ packages have been updated. (#1849)
349
+
350
+ * Fixed an issue where `renv` could fail to update the project autoloader
351
+ after calling `renv::upgrade()`. (#1837)
352
+
353
+ * Fixed an issue where attempts to install binary packages from older
354
+ PPM snapshots could fail. (#1839)
355
+
356
+ * `renv` now uses a platform-specific prefix on Linux for library and
357
+ cache paths by default with R (>= 4.4.0). This is equivalent to setting
358
+ `RENV_PATHS_PREFIX_AUTO = TRUE`. If necessary, this behavior can be
359
+ disabled by setting `RENV_PATHS_PREFIX_AUTO = FALSE` in an appropriate
360
+ R startup file. (#1211)
361
+
362
+
363
+ # renv 1.0.5
364
+
365
+ * `renv` now only writes a `.renvignore` file into the cache directory
366
+ if the cache appears to be part of the current project.
367
+
368
+ * `renv` now reports missing system libraries as part of its ABI
369
+ checks in `renv::diagnostics()`.
370
+
371
+ * Fixed an issue where `renv::install(lock = TRUE)` produced lockfiles
372
+ containing records with extraneous data. (#1828)
373
+
374
+
375
+ # renv 1.0.4
376
+
377
+ * `renv::install()` gains the `lock` argument. When `TRUE`, the project
378
+ lockfile will be updated after the requested packages have been
379
+ successfully installed. (#1811)
380
+
381
+ * `renv` now supports the use of GitHub Enterprise servers with the
382
+ `gitcreds` package for authentication credentials. (#1814)
383
+
384
+ * `renv::dependencies()` now treats `#| eval: !expr <...>` chunk options
385
+ as truthy by default, implying that such chunks are scanned for their
386
+ R package dependencies. (#1816)
387
+
388
+ * `renv::dependencies()` now requires usages of the [import](https://cran.r-project.org/package=import)
389
+ package to be namespace-qualified in order to be handled via static
390
+ analysis; that is, `import::from(<pkg>)` is parsed for dependencies,
391
+ but `from(pkg)` is not. (#1815)
392
+
393
+ * `renv::load()` gains the `profile` argument, allowing one to
394
+ explicitly load a specific profile associated with an `renv` project.
395
+ See `vignette("profiles", package = "renv")` or
396
+ https://rstudio.github.io/renv/articles/profiles.html
397
+ for more details.
398
+
399
+ * `renv::dependencies()` no longer includes `R` dependency versions
400
+ declared from a `DESCRIPTION` file in its output. (#1806)
401
+
402
+ * Fixed an issue where `renv` could fail to infer dependencies from
403
+ R Markdown code chunks using engine 'R' (upper-case) rather than
404
+ 'r' (lower-case). (#1803)
405
+
406
+ * Fixed an issue where `renv` did not report out-of-sync packages when
407
+ one or more packages used in the project were not installed. (#1788)
408
+
409
+ * Fixed an issue where `renv` could over-aggressively activate P3M
410
+ repositories when initializing a project. (#1782)
411
+
412
+ * `renv::status()` now notifies the user if the version of R recorded in
413
+ the lockfile does not match the version of R currently in use. (#1779)
414
+
415
+ * Fixed an issue where packages could appear multiple times in the lockfile,
416
+ if that package was installed into multiple library paths. (#1781)
417
+
418
+ * Installation of historical binaries of packages is once again enabled,
419
+ now using the [Posit Public Package Manager (P3M)](https://packagemanager.posit.co)
420
+ service instead of Microsoft's (now defunct) MRAN service.
421
+
422
+ * `renv::init()` now respects the `Remotes:` field declared in a project's
423
+ `DESCRIPTION` file, if any. (#1522)
424
+
425
+ * `renv::embed()` now supports Quarto Markdown (`.qmd`) files. (#1700)
426
+
427
+ * renv now sets the `R_INSTALL_TAR` environment variable to match the default
428
+ `tar` executable (if any) when installing packages. (#1724)
429
+
430
+ * renv now uses `--ssl-revoke-best-effort` by default when downloading files
431
+ using `curl` on Windows. (#1739)
432
+
433
+ * Fixed an issue where `renv::install()` could fail to detect incompatible
434
+ recursive package dependencies. (#1671)
435
+
436
+ * `renv::install()` now records remote information for packages installed from
437
+ CRAN-like repositories, and uses that information when generating a lockfile
438
+ and restoring those packages. This helps ensure that packages installed within
439
+ an renv project via calls like `renv::install("<pkg>", repos = "<repos>")` can
440
+ still be successfully restored in future sessions. (#1765)
441
+
442
+ * `renv::install()` now lazily resolves project remotes. (#1755)
443
+
444
+ * `renv::init()` now respects Remotes declared within a project's `DESCRIPTION`
445
+ file, if any.
446
+
447
+ * Calling `renv::activate()` without explicitly providing the `profile` argument
448
+ now preserves the current profile, if any. Use `renv::activate(profile = "default")`
449
+ if you'd like to re-activate a project using the default profile. (#1217)
450
+
451
+ * Fixed an issue where `renv` would try to prompt for the installation of
452
+ `BiocManager` when activating a project using Bioconductor. (#1754)
453
+
454
+ * Fixed an issue where directories containing a large number of files could
455
+ cause `renv` to fail to activate a project. (#1733)
456
+
457
+ * Expanded the set of Linux distributions detected for automatic transformation
458
+ of Posit Package Manager URLs to install binary packages. `renv` now correctly
459
+ detects Red Hat Enterprise Linux 9, Rocky Linux 8 and 9, SLES 15 SP4 and SP5,
460
+ Debian 11 and 12, AlmaLinux 8 and 9, and Amazon Linux 2. (#1720, #1721)
461
+
462
+
463
+ # renv 1.0.3
464
+
465
+ * Fixed an issue where `renv` could warn the project appeared to be out-of-sync
466
+ when using packages installed without an explicit source recorded. (#1683)
467
+
468
+ * `renv::install()` gains the `exclude` argument, which can be useful when
469
+ installing a subset of project dependencies.
470
+
471
+ * Fixed an issue where PPM repositories were not appropriately transformed
472
+ into the correct binary repository in `renv::restore()` when using pak.
473
+
474
+ * `renv::init()` no longer prompts the user for the intended action for
475
+ projects containing a library with only renv installed. (#1668)
476
+
477
+ * Fixed an issue where non-interactive usages of `renv::init()` could fail
478
+ with projects containing a DESCRIPTION file. (#1663)
479
+
480
+ * Fixed an issue that could cause code within a project `.Rprofile` to execute
481
+ before the project had been loaded in RStudio. (#1650)
482
+
483
+ * `renv::snapshot()` and `renv::status()` gain the `dev` argument. This
484
+ can be used when you'd like to capture package dependencies from
485
+ the *Suggests* field of your package's DESCRIPTION file. (#1019)
486
+
487
+
488
+ # renv 1.0.2
489
+
490
+ * renv now parses package `NAMESPACE` files for imported dependencies. (#1637)
491
+
492
+ * renv no longer locks the sandbox by default.
493
+
494
+ * Fixed an issue where renv used the wrong library paths when attempting
495
+ to activate the watchdog. This could cause a 10 second delay when activating
496
+ the sandbox.
497
+
498
+
499
+ # renv 1.0.1
500
+
501
+ * Fixed an issue where authentication headers could be duplicated when
502
+ using the `libcurl` download method. (#1605)
503
+
504
+ * `renv::use()` now defaults to setting `isolate = TRUE` when `sandbox = TRUE`.
505
+
506
+ * Fixed an issue where the renv watchdog could fail to load, leading to slowness
507
+ in activating the sandbox on startup. (#1617)
508
+
509
+ * Fixed an issue where renv did not display warnings / errors from `renv::snapshot()`
510
+ when `options(renv.verbose = FALSE)` was set. The display of these messages
511
+ is now controlled via the `renv.caution.verbose` R option. (#1607, #1608)
512
+
513
+ * `renv::load()` now notifies the user if the synchronization check took an
514
+ excessive amount of time due to the number of files being scanned in the
515
+ project. (#1573)
516
+
517
+ * `renv::init()` gains the `load` argument, making it possible to initialize
518
+ a project without explicitly loading it. (#1583)
519
+
520
+ * renv now uses a lock when synchronizing installed packages with the cache.
521
+ This should help alleviate issues that can arise when multiple R processes
522
+ are installing and caching packages concurrently. (#1571)
523
+
524
+ * Fixed a regression in parsing expressions within R Markdown chunk options. (#1558)
525
+
526
+ * Fixed an issue that prevented `renv::install()` from functioning
527
+ when source-only repositories were included. (#1578)
528
+
529
+ * Fixed a logic error in reading `RENV_AUTOLOAD_ENABLED`. (#1580)
530
+
531
+ * `renv::restore()` no longer runs without prompting on load if the
532
+ library is empty. (#1543)
533
+
534
+ * `renv::repair()` now checks for installed packages which lack a known
535
+ remote source, and updates their `DESCRIPTION` files if it can infer an
536
+ appropriate remote source. This typically occurs when a package is installed
537
+ from local sources, but appears to be maintained or published on a remote
538
+ repository (e.g. GitHub). This was previously done in `renv::snapshot()`, but
539
+ we've rolled back that change as the prompting was over-aggressive. (#1574)
540
+
541
+ * `renv::status()` now first reports on uninstalled packages, before reporting on
542
+ used <-> installed mismatches. (#1538)
543
+
544
+ * When the `RENV_STARTUP_DIAGNOSTICS` environment variable is set to `TRUE`,
545
+ renv now displays a short diagnostics report after a project's autoloader
546
+ has been run. This can be useful when diagnosing why renv is slow to load
547
+ in certain projects. (#1557)
548
+
549
+ * renv now ensures the sandbox is activated on load, for R processes which
550
+ are launched with the renv sandbox on the library paths. (#1565)
551
+
552
+ * `renv::restore()` no longer erroneously prompts when determining the packages
553
+ which need to be installed. (#1544)
554
+
555
+ * `renv::update()` now ensures the `prompt` parameter is properly respected
556
+ during package installation. (#1540)
557
+
558
+ * `renv::activate()` no longer erroneously preserves the previous library
559
+ paths after restarting the session within RStudio. (#1530)
560
+
561
+ * Use correct spelling of IRkernel package (#1528).
562
+
563
+ * Honor `R_LIBCURL_SSL_REVOKE_BEST_EFFORT` when using an external `curl.exe`
564
+ binary to download files. (#1624)
565
+
566
+
567
+ # renv 1.0.0
568
+
569
+ ## New features
570
+
571
+ * New `renv::checkout()` installings the latest-available packages from a
572
+ repository. For example, `renv::checkout(date = "2023-02-08")` will install
573
+ the packages available on 2023-02-08 from the Posit
574
+ [Package Manager](https://packagemanager.rstudio.com/) repository.
575
+ The `actions` argument allows you choose whether a lockfile is generated from
576
+ the provided repositories ("snapshot"), or whether packages are installed
577
+ from the provided repositories ("restore").
578
+
579
+ * `renv::deactivate()` gains a `clean` argument: when `TRUE` it will delete
580
+ all renv files/directories, leaving the project the way it was found.
581
+
582
+ * `renv::init()` now uses [Posit Public Package Manager](https://packagemanager.posit.co)
583
+ by default, for new projects where the repositories have not already been
584
+ configured externally. See the options `renv.config.ppm.enabled`,
585
+ `renv.config.ppm.default`, and `renv.config.ppm.url` in `?config` for more
586
+ details (#430).
587
+
588
+ * `renv::lockfile_create()`, `renv::lockfile_read()`, `renv::lockfile_write()`
589
+ and `renv::lockfile_modify()` provide a small family of functions for
590
+ interacting with renv lockfiles programmatically (#1438).
591
+
592
+ * Handling of development dependencies has been refined. `renv::snapshot()`
593
+ and `renv::status()` no longer track development dependencies, while
594
+ `install()` continues to install them (#1019). `Suggested` packages listed in
595
+ `DESCRIPTION` files are declared as development dependencies regardless of
596
+ whether or not they're a "package" project.
597
+
598
+ * MRAN integration is now disabled by default, pending the upcoming shutdown
599
+ of Microsoft's MRAN service. Users who require binaries of older R packages
600
+ on Windows + macOS can consider using the instance of CRAN mirrored by the
601
+ [Posit Public Package Manager](https://packagemanager.posit.co) (#1343).
602
+
603
+ ## Bug fixes and minor improvements
604
+
605
+ * Development versions of renv are now tracked using the Git SHA of the
606
+ current commit, rather than a version number that's incremented on every
607
+ change (#1327). This shouldn't have any user facing impact, but makes
608
+ renv maintenance a little easier.
609
+
610
+ * Fixed an issue causing "restarting interrupted promise evaluation" warnings
611
+ to be displayed when querying available packages failed. (#1260)
612
+
613
+ * `renv::activate()` uses a three option menu that hopefully make your choices
614
+ more clear (#1372).
615
+
616
+ * `renv::dependencies()` now discovers R package dependencies inside Jupyter
617
+ notebooks (#929).
618
+
619
+ * `renv::dependencies()` includes packages used by user profile (`~/.Rprofile`)
620
+ if `renv::config$user.profile()` is `TRUE`. They are set as development
621
+ dependencies, which means that they will be installed by `install()` but not
622
+ recorded in the snapshot.
623
+
624
+ * `renv::dependencies()` only extracts dependencies from text in YAML
625
+ headers that looks like valid R code (#1288).
626
+
627
+ * `renv::dependencies()` no longer treats `box::use(module/file)` as using
628
+ package `module` (#1377).
629
+
630
+ * `renv::init()` now prompts the user to select a snapshot type if the project
631
+ contains a top-level DESCRIPTION file (#1485).
632
+
633
+ * `renv::install(type = "source")` now ensures source repositories are used
634
+ in projects using [PPM](https://packagemanager.posit.co/). (#927)
635
+
636
+ * `renv::install()` activates Bioconductor repositories when installing a
637
+ package from a remote (e.g. GitHub) which declares a Bioconductor dependency
638
+ (via a non-empty 'biocViews' field) (#934).
639
+
640
+ * `renv::install()` respects the project snapshot type, if set.
641
+
642
+ * `renv::install()` now keeps source when installing packages from source (#522).
643
+
644
+ * `renv::install()` now validates that binary packages can be loaded after
645
+ installation, in a manner similar to source packages (#1275).
646
+
647
+ * `renv::install()` now supports Bioconductor remotes of the form
648
+ `bioc::<BiocVersion>/<Package>`, for installing packages from
649
+ a particular version of Bioconductor. Aliases like 'release' and
650
+ 'devel' are also supported (#1195).
651
+
652
+ * `renv::install()` now requires interactive confirmation that you want to
653
+ install packages (#587).
654
+
655
+ * `renv::load()` gives a more informative message if a lockfile is present but
656
+ no packages are installed (#353).
657
+
658
+ * `renv::load()` no longer attempts to query package repositories when checking
659
+ if a project is synchronized (#812).
660
+
661
+ * `renv::load()` no longer duplicates entries on the `PATH` environment variable
662
+ (#1095).
663
+
664
+ * `renv::restore()` can now use `pak::pkg_install()` to install packages
665
+ when `pak` integration is enabled. Set `RENV_CONFIG_PAK_ENABLED = TRUE`
666
+ in your project's `.Renviron` if you'd like to opt-in to this behavior.
667
+ Note that this requires a nightly build of `pak` (>= 0.4.0-9000);
668
+ see https://pak.r-lib.org/dev/reference/install.html for more details.
669
+
670
+ * `renv::restore()` now emits an error if called within a project that
671
+ does not contain a lockfile (#1474).
672
+
673
+ * `renv::restore()` correctly restores packages downloaded and installed
674
+ from [r-universe](https://r-universe.dev/) (#1359).
675
+
676
+ * `renv::snapshot()` now standardises pak metadata so CRAN packages installed via
677
+ pak look the same as CRAN packages installed with renv or `install.packages()`
678
+ (#1239).
679
+
680
+ * If `renv::snapshot()` finds missing packages, a new prompt allows you to
681
+ install them before continuing (#1198).
682
+
683
+ * `renv::snapshot()` no longer requires confirmation when writing the first
684
+ snapshot, since that's an action that can easily be undone (by deleting
685
+ `renv.lock`) (#1281).
686
+
687
+ * `renv::snapshot()` reports if the R version changes, even if no packages
688
+ change (#962).
689
+
690
+ * `renv::snapshot(exclude = <...>)` no longer warns when attempting to exclude
691
+ a package that is not installed (#1396).
692
+
693
+ * `renv::status()` now uses a more compact display when packages have some
694
+ inconsistent combination of being installed, used, and recorded.
695
+
696
+ * `renv::status()` now works more like `renv::restore()` when package versions
697
+ are different (#675).
698
+
699
+ * `renv::update()` can now update packages installed from GitLab (#136) and
700
+ BitBucket (#1194).
701
+
702
+ * `renv::settings$package.dependency.fields()` now only affects packages
703
+ installed directly by the user, not downstream dependencies of those packages.
704
+
705
+ * renv functions give a clearer error if `renv.lock` has somehow become
706
+ corrupted (#1027).
707
+
708
+
709
+ # renv 0.17.3
710
+
711
+ * Fixed an issue where `renv::install("bioc::<package>")` could fail if
712
+ `BiocManager` was not already installed. (#1184)
713
+
714
+ * Fixed an issue where package names were not included in the output
715
+ of `renv::diagnostics()`. (#1182)
716
+
717
+ * The clarity of the message printed by `renv::status()` has been improved;
718
+ in particular, renv should better report the recommended actions when
719
+ a package required by the project is not installed.
720
+
721
+ * `renv::snapshot()` gains the `exclude` argument, for explicitly
722
+ excluding certain packages from the generated lockfile.
723
+
724
+ * Fixed an issue where renv was passing the wrong argument name to
725
+ `installed.packages()`, causing usages of renv to fail with
726
+ R (<= 3.4.0). (#1173)
727
+
728
+ * renv now sets the `SDKROOT` environment variable on macOS if it detects
729
+ that R was built using an LLVM build of `clang` on macOS.
730
+
731
+ * `renv::install()` now parses the remotes included within, for example,
732
+ a `DESCRIPTION` file's `Config/Needs/...` field.
733
+
734
+ * renv now checks that the index directory is writable before attempting to
735
+ use it, e.g. for the `R` available packages index maintained by renv. (#1171)
736
+
737
+ * renv now checks that the version of `curl` used for downloads appears to
738
+ be functional, and reports a warning if it does not (for example, because
739
+ a requisite system library is missing). The version of `curl` used for
740
+ downloads can also be configured via the `RENV_CURL_EXECUTABLE` environment
741
+ variable.
742
+
743
+
744
+ # renv 0.17.2
745
+
746
+ * Fixed a regression that caused package hashes to be computed incorrectly
747
+ in some cases. This was a regression in the 0.17.1 release. (#1168)
748
+
749
+
750
+ # renv 0.17.1
751
+
752
+ * renv gains the configuration option `install.remotes`, which can be used
753
+ to control whether renv attempts to read and use the `Remotes:` field
754
+ included with installed packages. This can be set to `FALSE` if you'd
755
+ like to ignore this field; e.g. because you know they will not be
756
+ accessible. (#1133)
757
+
758
+ * General performance optimizations. In particular, `renv::update(check = TRUE)`
759
+ should now execute much faster.
760
+
761
+ * renv now stores project settings within `renv/settings.json` rather than
762
+ `renv/settings.dcf`. Old settings will be automatically migrated.
763
+
764
+ * The renv sandbox is now placed within the renv cache directory. (#1158)
765
+
766
+ * Fixed an issue where `renv::status()` could erroneously report a project was
767
+ out-of-sync when using explicit snapshots. (#1159)
768
+
769
+ * Fixed an issue where `renv::hydrate()` would print spurious warnings. (#1160)
770
+
771
+ * `renv::status()` now suggests running `renv::restore()` if there are no
772
+ packages installed in the project library. (#1060)
773
+
774
+ * Fixed an issue where renv would fail to query [r-universe](https://r-universe.dev/)
775
+ repositories. (#1156)
776
+
777
+ * renv no longer tries to set the `SDKROOT` environment variable on
778
+ macOS for R (>= 4.0.0).
779
+
780
+ * Fixed an issue where installation of Bioconductor packages could fail
781
+ when `BiocManager` was not installed. (#1156, #1155)
782
+
783
+ * Fixed an issue where the amount of time elapsed reported by `renv::install()`
784
+ failed to include the time spent retrieving packages.
785
+
786
+
787
+ # renv 0.17.0
788
+
789
+ * The performance of `renv::snapshot()` has improved.
790
+
791
+ * renv now maintains an index of available packages, as retrieved from the
792
+ active package repositories, that is shared across `R` sessions. This should
793
+ improve renv's performance when querying for available packages across
794
+ multiple different `R` sessions.
795
+
796
+ * `renv::hydrate()` gains the `prompt` parameter. When `TRUE` (the default),
797
+ renv will prompt for confirmation before attempting to hydrate the active
798
+ library.
799
+
800
+ * Improved handling of package installation via SSH URLs with `git`. (#667)
801
+
802
+ * Improved handling of R version validation when using projects with
803
+ Bioconductor. If you find renv is erroneously reporting that your version
804
+ of R is incompatible with the version of Bioconductor you are using, you can
805
+ set `options(renv.bioconductor.validate = FALSE)` to disable this validation
806
+ behaviour. (#1148)
807
+
808
+ * Package names can now be associated with remotes in `renv::install()`; for
809
+ example, you can use `renv::install("igraph=igraph/rigraph")` to install
810
+ the `igraph` package. This is mainly important when using the `renv.auth`
811
+ authentication tools, where the package name of a remote needs to be
812
+ declared explicitly. (#667)
813
+
814
+ * Fixed an issue that could prevent `renv::restore()` from functioning when
815
+ attempting to install packages which had been archived on CRAN. (#1141)
816
+
817
+ * `renv::install()` gains the `dependencies` argument, which behaves similarly
818
+ to the equivalent argument in `remotes::install_*()`. In particular, this can
819
+ be set to fields like `Config/Needs/dev` to tell renv to use custom
820
+ DESCRIPTION fields for dependency resolution in installation.
821
+
822
+ * Fixed an issue where the function variant of the `renv.auth` option was not
823
+ resolved correctly. (#667)
824
+
825
+ * `renv::install()` now supports remotes with a trailing slash -- such slashes
826
+ are now removed. (#1135)
827
+
828
+ * Integration with the RStudio (Posit) Package Manager is now disabled
829
+ by default on aarch64 Linux instances.
830
+
831
+ * The `RENV_CACHE_MODE` environment variable can now also be used
832
+ to adjust the permissions set on downloaded package tarballs / binaries.
833
+ (#988)
834
+
835
+ * Fixed an issue where fields of the form `Remotes.1` could
836
+ enter lockfile records for older versions of R. (#736)
837
+
838
+ * Fixed the performance of `renv::update()` in cases where
839
+ integration with MRAN is enabled.
840
+
841
+ * Fixed an issue where package installation using `pak` could fail
842
+ in some cases.
843
+
844
+ * `renv_file_find()` can now scan up to the root directory in Docker
845
+ containers. (#1115)
846
+
847
+ * renv no longer uses the R temporary directory on Windows for the
848
+ sandbox. The sandbox directory can be customized via the
849
+ `RENV_PATHS_SANDBOX` environment variable if required. (#835)
850
+
851
+ * renv now reports the elapsed time when installing packages. (#1104)
852
+
853
+ * For projects using "explicit" snapshots, renv now reports if
854
+ a package is required by the project, but the package is not
855
+ currently installed. (#949)
856
+
857
+ * Fixed an issue where `renv::snapshot()` could fail to detect when
858
+ no changes had been made to the lockfile.
859
+
860
+ * Fixed an issue where renv could emit JSON lockfiles which could not
861
+ be parsed by external JSON readers. (#1102)
862
+
863
+ * renv now marks the sandbox as non-writable, which should hopefully
864
+ alleviate issues where attempts to update installed packages would
865
+ inadvertently install the updated package into the sandbox. (#1090)
866
+
867
+ * `renv::use()` gains the `sandbox` argument, which allows one to control
868
+ whether the system library is sandboxed after a call to `renv::use()`.
869
+ (#1083)
870
+
871
+ * The path to the Conda `environment.yml` file created by renv can
872
+ now be customized via the `RENV_PATHS_CONDA_EXPORT` environment
873
+ variable. We recommend setting this within your project-local
874
+ `.Renviron` file as appropriate. (#1089)
875
+
876
+ * Fixed an issue where the renv sandbox location did not respect the
877
+ active renv profile. (#1088)
878
+
879
+
880
+ # renv 0.16.0
881
+
882
+ * renv now supports installation of packages with remotes of the form
883
+ `<package>=<remote>`. However, the provided package name is ignored
884
+ and is instead parsed from the remote itself. (#1064)
885
+
886
+ * renv now passes along the headers produced by the `renv.download.headers`
887
+ option when bootstrapping itself in the call to `utils::download.file()`.
888
+ (#1084)
889
+
890
+ * renv now reports if `renv::snapshot()` will change or update the
891
+ version of R recorded in the lockfile. (#1069)
892
+
893
+ * renv now supports the `install.packages.check.source` R option, which
894
+ is used to allow R to query source repositories even if the option
895
+ `options(pkgType = "binary")` is set. (#1074)
896
+
897
+ * renv better handles packages containing git submodules when installed
898
+ from GitHub remotes. (#1075)
899
+
900
+ * renv now handles local sources within the current working directory. (#1079)
901
+
902
+ * The renv sandbox is once again enabled by default. On Unix, the sandbox
903
+ is now created by default within the project's `renv/sandbox` library.
904
+ On Windows, the sandbox is created within the R session's `tempdir()`.
905
+ The path to the renv sandbox can be customized via the `RENV_PATHS_SANDBOX`
906
+ environment variable if required.
907
+
908
+ * Fixed an issue where `renv::status()` could report spurious changes when
909
+ comparing packages installed using `pak` in some cases. (#1070)
910
+
911
+ * `renv::restore()` now also ensures the project activate script is updated
912
+ after a successful restore. (#1066)
913
+
914
+ * Fixed an issue where renv could attempt to install a package from the
915
+ repository archives even when `type = "binary"` was set. (#1046)
916
+
917
+ * Fixed an issue where package installation could fail when the R session
918
+ is configured to use multiple repositories, some of which do not provide
919
+ any information on available packages for certain binary arms of the
920
+ repository. (#1045)
921
+
922
+ * renv now uses `jsonlite` for reading lockfiles when loaded. This should
923
+ help ensure useful errors are provided for manually-edited lockfiles
924
+ which contain a JSON parsing error. If the `jsonlite` package is not loaded,
925
+ renv will fall back to its own internal JSON parser. (#1027)
926
+
927
+ * Fixed an issue that would cause renv to fail to source the user
928
+ `~/.Rprofile` if it attempted to register global calling handlers,
929
+ e.g. as `prompt::set_prompt()` does. (#1036)
930
+
931
+ * (Linux only) renv now resets ACLs on packages copied to the cache, to
932
+ avoid persisting default ACLs that might have been inherited on packages
933
+ installed into a local project library. If desired, this behavior can be
934
+ disabled by setting the `RENV_CACHE_ACLS` environment variable to `FALSE`.
935
+ If you need finer control over ACLs set on packages moved into the cache,
936
+ consider defining a custom callback via the `renv.cache.callback` R option.
937
+ (#1025)
938
+
939
+ * Fixed an issue where `.gitignore` inclusion rules for sub-directories were
940
+ not parsed correctly by renv for dependency discovery. (#403)
941
+
942
+ * Fixed an issue where renv could report spurious diffs within `renv::status()`
943
+ when comparing package records installed from `pak` versus the default R
944
+ package installer. (#998)
945
+
946
+ * Fixed an issue where `renv::use_python()` could cause the Requirements field
947
+ for packages in the lockfile to be unintentionally dropped. (#974)
948
+
949
+ * The R option `renv.cache.callback` can now be set, to run a user-defined
950
+ callback after a package has been copied into the cache. This can be useful
951
+ if you'd like to take some action on the cached package's contents after
952
+ the package has been moved into the cache.
953
+
954
+ * (Unix only) The `RENV_CACHE_MODE` environment variable can now be used to
955
+ change the access permissions of packages copied into the cache. When set,
956
+ after a package is copied into the cache, renv will use `chmod -Rf` to try
957
+ and change the permissions of the cache entry to the requested permissions.
958
+
959
+ * (Unix only) The `RENV_CACHE_USER` environment variable can now be used to
960
+ change the ownership of folders copied into the cache. When set, after a
961
+ package is copied into the cache, renv will use `chown -Rf` to try and
962
+ change the ownership of that cache entry to the requested user account.
963
+
964
+ * Fixed an issue where repositories containing multiple packages in
965
+ sub-directories could fail to install. (#1016)
966
+
967
+
968
+ # renv 0.15.5
969
+
970
+ * Fixed an issue where indexing of packages in the package cellar could
971
+ be slow. (#1014)
972
+
973
+ * Fixed an issue where installation of packages from Bioconductor's binary
974
+ Linux package repositories could fail. (#1013)
975
+
976
+ * `renv::restore()` now supports restoration of packages installed from
977
+ [R-Forge](https://r-forge.r-project.org/). (#671)
978
+
979
+ * Fixed an issue where `renv::init(bioconductor = TRUE)` would not update
980
+ the version of Bioconductor used if a project setting had already been
981
+ set.
982
+
983
+ * It is now possible to "update" an existing lockfile by using
984
+ `renv::snapshot(update = TRUE)`. When set, any records existing in the
985
+ old lockfile, but not the new lockfile, will be preserved. (#727)
986
+
987
+ * Fixed an issue where renv could fail to parse Git remotes for users
988
+ whose username contains a number. (#1004)
989
+
990
+ * renv no longer infers a dependency on the "quarto" R package in projects
991
+ containing a `_quarto.yml` file. (#995)
992
+
993
+ * Fixed an issue where renv could fail to download a package from MRAN if
994
+ a compatible source package of the same version was available from the
995
+ active R repositories. (#990)
996
+
997
+ * renv now reports permission errors during download more clearly. (#985)
998
+
999
+ * Fixed an issue where `RENV_PATHS_LIBRARY_ROOT_ASIS` was not interpreted
1000
+ correctly. (#976)
1001
+
1002
+ * `renv::modify()` gains the `changes` argument, which can be used to modify
1003
+ a project lockfile non-interactively.
1004
+
1005
+ * `renv::clean()` now returns the project directory, as documented. (#922)
1006
+
1007
+ * Fixed an issue where renv could fail to parse embedded YAML chunk options
1008
+ in R Markdown documents. (#963)
1009
+
1010
+ * renv now sets default placeholder names for the `repos` R option, for
1011
+ any repository URLs which happen to be unnamed. (#964)
1012
+
1013
+ * Fixed an issue where renv didn't respect the `PATH` ordering when
1014
+ discovering Python installations via `renv_python_discover()`. (#961)
1015
+
1016
+ * Fixed an issue where renv could fail to install packages containing
1017
+ multibyte unicode characters in their DESCRIPTION file. (#956)
1018
+
1019
+ * Fixed detection of Rtools 4.2 (#1002)
1020
+
1021
+
1022
+ # renv 0.15.4
1023
+
1024
+ * Fixed an issue where package installation could fail when referencing the
1025
+ cache via a tilde-aliased path, e.g. `~/.local/share/renv`. (#953)
1026
+
1027
+
1028
+ # renv 0.15.3
1029
+
1030
+ * A variety of fixes for R CMD check.
1031
+
1032
+ * renv gains an experimental function, `renv::autoload()`, to be used as a
1033
+ helper for automatically loading a project for R processes launched within a
1034
+ sub-directory of that project. See `?renv::autoload` for more details.
1035
+
1036
+ * renv will now print a warning message when attempting to read a lockfile
1037
+ containing merge conflict markers (as from e.g. a git merge). (#945)
1038
+
1039
+ * Fixed an issue where `renv::install()` could install into the wrong library
1040
+ path on Windows, if the R installation had a site-wide profile that mutated
1041
+ the library paths. (#941)
1042
+
1043
+ * Fixed an issue where `renv::install()` would fail to find a package within
1044
+ the cache when using an abbreviated commit hash for installation. (#943)
1045
+
1046
+ * Fixed an issue where renv's automatic snapshot was not run after calls to
1047
+ `renv::install()` in some cases. (#939)
1048
+
1049
+ * Fixed an issue where renv would incorrectly copy a package from the cache,
1050
+ if the cached version of the package and the requested version of the package
1051
+ had the same package version, even if they were retrieved from different
1052
+ sources. (#938)
1053
+
1054
+ * The path to an renv tarball can now be set via the environment variable
1055
+ `RENV_BOOTSTRAP_TARBALL`, to be used to help renv bootstrap from local
1056
+ sources. This can either be the path to a directory containing renv
1057
+ source tarballs, or the path to the tarball itself.
1058
+
1059
+ * Fixed an issue where the R site library would not be appropriately masked
1060
+ for resumed RStudio sessions. (#936)
1061
+
1062
+
1063
+ # renv 0.15.2
1064
+
1065
+ * Fixed issues encountered in R CMD check.
1066
+
1067
+
1068
+ # renv 0.15.1
1069
+
1070
+ * Fixed an issue where renv inadvertently inserted extra newlines into
1071
+ a `DESCRIPTION` file when adding `Remotes` fields after install. (#914)
1072
+
1073
+ * Fixed an issue where packages installed from a remote sub-directory would
1074
+ fail to install when later re-installed from the cache. (#913)
1075
+
1076
+ * renv now recognizes YAML chunk options of the form `#| key: value` when
1077
+ used in R Markdown documents. (#912)
1078
+
1079
+ * Fixed an issue where the R site library was visible in renv projects with
1080
+ the system library sandbox disabled.
1081
+
1082
+ * Fixed an issue where renv could update the wrong `.gitignore` in R
1083
+ processes launched by `callr` (e.g. in `devtools::install`). (#910)
1084
+
1085
+ * Fixed an issue where renv could fail to read mis-encoded
1086
+ DESCRIPTION files. (#908)
1087
+
1088
+ * Fixed an issue where `config$cache.symlinks()` would report `NULL` when
1089
+ unset. (#906)
1090
+
1091
+
1092
+ # renv 0.15.0
1093
+
1094
+ * The development branch for renv has moved from master to main.
1095
+
1096
+ * renv package records in the lockfile now include a `Requirements`
1097
+ entry, which gives a list of R packages this package depends on
1098
+ in some way. This is primarily for internal use by the `pak`
1099
+ package.
1100
+
1101
+ * Fixed an issue where packages containing DESCRIPTION files using
1102
+ a latin1 encoding would not be read correctly by renv.
1103
+
1104
+ * Fixed an issue that could cause `renv::dependencies()` to fail
1105
+ when a malformed `DESCRIPTION` file was encountered. (#892)
1106
+
1107
+ * The path to the project-local renv folder can now be configured
1108
+ via the `RENV_PATHS_RENV` environment variable. This can be useful
1109
+ if you'd prefer to store your project's renv resources within
1110
+ an alternate location in the project. (#472)
1111
+
1112
+ * renv now uses an external library by default for R package projects,
1113
+ with the library located within `tools::R_user_dir("renv", "cache")`.
1114
+ This directory can be configured via the `RENV_PATHS_LIBRARY_ROOT`
1115
+ environment variable if desired. See
1116
+ `vignette("packages", package = "renv")` for more details. (#384)
1117
+
1118
+ * renv now uses the repositories as defined within the project lockfile
1119
+ (if any) when attempting to bootstrap itself in a project. (#820)
1120
+
1121
+ * The renv sandbox is now disabled by default -- see #614 for more details.
1122
+
1123
+ * renv gains the function `repair()`, to be used to attempt to repair
1124
+ the project library when links into the global package cache appear to
1125
+ be broken. (#378)
1126
+
1127
+ * Fixed an issue where the staging library used during install could fail to
1128
+ inherit the same directory permissions as the target library itself. (#331)
1129
+
1130
+ * Fixed an regression which caused `renv::history()` to fail. (#886)
1131
+
1132
+ * renv gains experimental support for the [pak](https://pak.r-lib.org/)
1133
+ package. Set `RENV_CONFIG_PAK_ENABLED = TRUE` in an appropriate `.Renviron`
1134
+ file to enable `pak` integration. When enabled, calls to `renv::install()`
1135
+ will use `pak` to download and install packages.
1136
+
1137
+ * `renv::init()` gains the `bioconductor` argument, to be used to initialize
1138
+ a project with a particular Bioconductor release. You can also use
1139
+ `renv::init(bioconductor = TRUE)` to initialize with the latest-available
1140
+ release for the version of R being used.
1141
+
1142
+ * Project settings can now be overridden by setting an R option of the same
1143
+ name. For example, one could force a project to use Bioconductor 3.14 by
1144
+ setting `options(renv.settings.bioconductor.version = "3.14")` within
1145
+ the project `.Rprofile` (or similar startup R profile).
1146
+
1147
+ * The ad-hoc package repository called "local sources" has been renamed to
1148
+ the "package cellar". In addition, the path to the cellar is now
1149
+ controlled by the `RENV_PATHS_CELLAR` environment variable, rather than
1150
+ `RENV_PATHS_LOCAL`. This change was made to reduce confusion between
1151
+ "local sources" of packages located somewhere on the filesystem, as
1152
+ opposed to packages explicitly placed in this ad-hoc repository.
1153
+ `RENV_PATHS_LOCAL` remains supported for backwards compatibility.
1154
+
1155
+ * The `RENV_PATHS_CELLAR` environment variable can now be set to multiple
1156
+ paths. Use `;` as a separator between paths; for example,
1157
+ `RENV_PATHS_LOCAL=/path/to/sources/v1;/path/to/sources/v2`. (#550)
1158
+
1159
+ * Packages installed via e.g. `renv::install("./path/to/package")`
1160
+ will now retain the relative path to that package within the lockfile.
1161
+ (#873)
1162
+
1163
+ * Fixed an issue where invalid `config` option values were not properly
1164
+ reported. (#773)
1165
+
1166
+ * renv now supports restoration of packages installed via one of the
1167
+ [r-universe](https://r-universe.dev/) repositories.
1168
+
1169
+ * renv gains the `bioconductor.version` project setting, used to freeze
1170
+ the version of Bioconductor used in a particular project. When set, this
1171
+ will override any version that might be selected via the `BiocManager`
1172
+ package. (#864)
1173
+
1174
+ * renv now infers that parameterized R Markdown documents have a dependency
1175
+ on the `shiny` package. In addition, R code included within the `params:`
1176
+ list will be parsed for dependencies. (#859)
1177
+
1178
+ * renv now ignores hidden directories during dependency discovery by default.
1179
+ If you want to force a particular hidden directory to be included for
1180
+ discovery, you can use a `.renvignore` file with an explicit inclusion
1181
+ criteria; e.g. `!.hidden/`.
1182
+
1183
+ * renv now supports the `*release` remotes specifier for GitHub repositories,
1184
+ for requesting installation of the latest declared release of a package from
1185
+ GitHub. (#792)
1186
+
1187
+ * renv now handles packages stored within the sub-directory of a Git
1188
+ repository better. (#793)
1189
+
1190
+ * Fixed an issue where `renv::history()` would fail to resolve the correct
1191
+ lockfile path if the working directory was changed. (#834)
1192
+
1193
+ * Refined dependency discovery within `glue::glue()` expressions.
1194
+
1195
+ * renv now parses packages referenced via the `base_format` field within
1196
+ an R Markdown document's YAML header. (#854)
1197
+
1198
+ * Fixed an issue where renv would fail to produce the appropriate binary
1199
+ repository URL for RSPM repositories built using Red Hat Enterprise Linux.
1200
+
1201
+ * Fixed an issue where `renv::snapshot()` could cause the environment name
1202
+ and / or path associated with a Python environment to be omitted from the
1203
+ lockfile. (#843)
1204
+
1205
+ * Fixed an issue where `renv::restore()` could fail to restore packages which
1206
+ referred to their source via an explicit path in the `Source` field. (#849)
1207
+
1208
+ * renv no longer requires explicit user consent when used within Singularity
1209
+ containers. (#824, @kiwiroy)
1210
+
1211
+ * renv now respects the `R_PROFILE_USER` environment variable, in addition
1212
+ to the `user.profile` configuration option, when considering whether the
1213
+ user `.Rprofile` should be examined for package dependencies. (#821)
1214
+
1215
+ * The renv auto-loader can now be disabled by setting the environment
1216
+ variable `RENV_AUTOLOADER_ENABLED = FALSE`. This can be useful if you'd like
1217
+ to explicitly control how a project is loaded, e.g. by calling `renv::load()`
1218
+ explicitly.
1219
+
1220
+ * `renv::snapshot()` gains the `repos` argument, to be used to force
1221
+ the lockfile to be generated with the requested set of R repositories
1222
+ encoded within.
1223
+
1224
+ * renv now validates that the `repos` option, as used by `renv::snapshot()`,
1225
+ is a named vector. (#811)
1226
+
1227
+ * Fixed an issue where renv's shims, e.g. for `install.packages()`, failed
1228
+ to pass along other optional arguments to the shimmed function correctly.
1229
+ (#808)
1230
+
1231
+
1232
+ # renv 0.14.0
1233
+
1234
+ * renv now uses `tools::R_user_dir()` to resolve the default path to the
1235
+ global renv cache, for R installations 4.0.0 or greater. If the renv
1236
+ cache still exists at the old location, that location will be used instead.
1237
+ This change should only affect brand new installations of renv on newer
1238
+ versions of `R`.
1239
+
1240
+ * Fixed an issue with renv tests failing with R (>= 4.2.0).
1241
+
1242
+ * renv will no longer auto-activate itself within R processes launched via
1243
+ `R CMD INSTALL`. This behavior can be controlled if necessary via the
1244
+ `RENV_ACTIVATE_PROJECT` environment variable -- set this to `TRUE` to
1245
+ force the project in the current working directory to be activated, and
1246
+ `FALSE` to suppress the renv auto-loader altogether. (#804)
1247
+
1248
+ * Added dependency discovery support for R utility scripts identified by a
1249
+ shebang line instead of a file extension. (#801; @klmr)
1250
+
1251
+ * Fixed an issue where `renv::install("<package>", type = "both")` would attempt
1252
+ to install the package from sources, even if the current system did not have
1253
+ the requisite build tools available. (#800)
1254
+
1255
+ * `renv::scaffold()` gains the `settings` argument, used to create a project
1256
+ scaffolding with some default project options set. (#791)
1257
+
1258
+ * renv now determines the default branch name for packages installed from
1259
+ GitLab without an explicit reference supplied; for example, as in
1260
+ `renv::install("gitlab::<user>/<repo>")`. (#795)
1261
+
1262
+ * renv now infers a dependency on the `bslib` package for R Markdown
1263
+ documents using custom themes. (#790)
1264
+
1265
+ * renv will now prompt users to activate the current project when calling
1266
+ `renv::snapshot()` or `renv::restore()` from within a project that has not
1267
+ yet been activated. (#777)
1268
+
1269
+ * renv now has improved handling for `git` remotes. (#776; @matthewstrasiotto)
1270
+
1271
+ * `renv::restore()` gains the `exclude` argument, used to exclude a subset of
1272
+ packages during restore. (#746)
1273
+
1274
+ * Fixed an issue where `renv::dependencies()` could fail to parse
1275
+ dependencies in calls to `glue::glue()` that used custom open
1276
+ and close delimiters. (#772)
1277
+
1278
+ * Fixed an issue where `renv::init(bare = TRUE)` would unnecessarily
1279
+ scour the project for R package dependencies. (#771)
1280
+
1281
+ * Fixed an issue where renv could fail to install packages located
1282
+ on GitHub within sub-subdirectories. (#759)
1283
+
1284
+ * renv gains the function `embed()`, used to embed a lockfile with an
1285
+ R document (via a call to `renv::use()`).
1286
+
1287
+ * `renv::use()` gains the lockfile argument. This can be useful for
1288
+ R Markdown documents and scripts that you'd like to run with the
1289
+ context for a particular lockfile applied.
1290
+
1291
+ * `renv::rebuild()` gains the `type` parameter, for parity with
1292
+ `renv::install()`.
1293
+
1294
+ * Fixed an issue where renv could incorrectly copy an incompatible version
1295
+ of an R package from a site library into the project library during install.
1296
+ (#750)
1297
+
1298
+ * `renv::dependencies()` can now parse (some) usages of `parsnip::set_engine()`.
1299
+
1300
+ * `renv::dependencies()` now has improved handling for piped expressions.
1301
+
1302
+ * Fixed crash during dependency discovery when encountering `box::use()`
1303
+ declarations that use a trailing comma, and no longer treat `.` and `..` as
1304
+ package names. (@klmr)
1305
+
1306
+ * `renv::clean()` no longer attempts to clean the system library by default.
1307
+ (#737)
1308
+
1309
+ * Fixed an issue where `install.packages()` could fail when used within an
1310
+ renv project to install a package from local sources. (#724)
1311
+
1312
+ * The chunk `renv.ignore` parameter can now be set to `FALSE`. When set,
1313
+ renv will explicitly parse dependencies from chunks even if other
1314
+ chunk metadata would have told renv to ignore it (e.g. because it
1315
+ was marked with `eval=F`). (#722)
1316
+
1317
+ * Fixed an issue where chunks with the chunk option `eval=F` would
1318
+ still be scanned for dependencies. (#421)
1319
+
1320
+ * In interactive sessions, `renv::use_python()` will now prompt for
1321
+ the version of Python to be used. Python installations in a set
1322
+ of common locations will be searched. See `?renv::use_python()`
1323
+ for more details.
1324
+
1325
+ * Fixed an issue where renv would fail to retrieve packages from the
1326
+ archives if the lockfile entry was tagged with a `RemoteSha` field.
1327
+
1328
+ * `renv::restore()` will now prefer restoring packages from the repository
1329
+ named in the `Repository` field if available. The name is matched against
1330
+ the repository names set in the R `repos` option, or as encoded in the
1331
+ renv lockfile. (#701)
1332
+
1333
+ * renv now supports the discovery of dependencies within interpolated strings
1334
+ as used by the `glue` package.
1335
+
1336
+ * `RENV_CONFIG_EXTERNAL_LIBRARIES` can now be configured to use multiple
1337
+ library paths, delimited by either `:`, `;`, or `,`. (#700)
1338
+
1339
+ * renv gains the configuration option, `exported.functions`, controlling
1340
+ which functions and objects are placed on the R search path when renv
1341
+ is attached (e.g. via `library(renv)`). Set this to `NULL` to instruct renv
1342
+ not to place any functions on the search path. This helps avoid issues with,
1343
+ for example, `renv::load()` masking `base::load()`. When set, all usages
1344
+ of renv APIs must be explicitly qualified with the `renv::` prefix.
1345
+
1346
+
1347
+ # renv 0.13.2
1348
+
1349
+ * `renv::install("user/repo/subdir with spaces")` now works as expected. (#694)
1350
+
1351
+ * renv can now parse package dependencies declared by
1352
+ `targets::tar_option_set(packages = <...>)`. (#698)
1353
+
1354
+ * renv no longer performs an automatic snapshot following a user-canceled
1355
+ renv action -- for example, if `renv::restore()` is canceled, the next
1356
+ automatic snapshot will be suppressed. (#697)
1357
+
1358
+ * Added the `vcs.ignore.local` project setting, to control whether the
1359
+ project's `renv/local` folder is added to renv's VCS ignore file
1360
+ (e.g. `renv/.gitignore`). (#696)
1361
+
1362
+ * Fixed an issue where renv's bootstrapping code could inadvertently bootstrap
1363
+ with the wrong version of renv, if the source and binary versions of renv
1364
+ on CRAN were not in sync. (#695)
1365
+
1366
+ * Fixed an issue where `renv::status()` could provide a misleading message
1367
+ for packages which are recorded in the lockfile, but not explicitly
1368
+ required by the project. (#684)
1369
+
1370
+
1371
+ # renv 0.13.1
1372
+
1373
+ * `renv::clean()` gains the `actions` argument, allowing the caller to control
1374
+ which specific actions are taken during a `clean()` operation.
1375
+
1376
+ * renv no longer performs an automatic snapshot after a call to
1377
+ `renv::status()`. (#651)
1378
+
1379
+ * Fixed an issue where attempts to transform RSPM repository URLs could
1380
+ fail if the copy of R was installed without a local `CRAN_mirrors.csv`
1381
+ file.
1382
+
1383
+ * Fixed an issue where `renv::init()` could fail when passed a relative
1384
+ path to a directory. (#673)
1385
+
1386
+ * Fixed an issue where `renv::dependencies()` would miss dependencies in
1387
+ R Markdown YAML headers containing multiple output formats. (#674)
1388
+
1389
+ * `renv::install()` now better respects the `Remotes` field in a project
1390
+ `DESCRIPTION` file, if available. (#670)
1391
+
1392
+ * `RENV_DOWNLOAD_METHOD` is now treated as an alias for
1393
+ `RENV_DOWNLOAD_FILE_METHOD`.
1394
+
1395
+ * Fixed an issue where renv would fail to load if the `~/.Rprofile` existed
1396
+ but was an empty file.
1397
+
1398
+ # renv 0.13.0
1399
+
1400
+ * `renv::snapshot()` no longer creates an `renv/activate.R` file in the project
1401
+ folder if one does not already exist. (#655)
1402
+
1403
+ * The `renv::hydrate()` function gains the `update` argument, used to control
1404
+ whether `renv::hydrate()` chooses to update packages when invoked. When set
1405
+ to `TRUE`, if the version of a package installed in the source library is
1406
+ newer than that of the project library, then renv will copy that version
1407
+ of the package into the project library. (#647)
1408
+
1409
+ * The `RENV_PATHS_PREFIX_AUTO` environment variable can now be set to instruct
1410
+ renv to include an OS-specific component as part of the library and
1411
+ cache paths. This is primarily useful for Linux systems, where one might
1412
+ want to share a global cache with multiple different operating systems.
1413
+ The path component is constructed from the `ID` and `VERSION_CODENAME` /
1414
+ `VERSION_ID` components of the system's `/etc/os-release` file.
1415
+
1416
+ * renv's dependency discovery machinery now has preliminary support
1417
+ for packages imported via the [box](https://github.com/klmr/box) package;
1418
+ e.g. `box::use(dplyr[...])`.
1419
+
1420
+ * Multiple cache paths can now be specified, with each cache path separated
1421
+ by either a `;` or `:`. This can be useful when you'd like to use multiple
1422
+ package caches within the same project; for example, because you'd like to
1423
+ share a read-only cache with a set of projects. (#653, @vandenman)
1424
+
1425
+ * Fixed an issue where renv could fail to discover dependencies in directories
1426
+ with very large `.gitignore` or `.renvignore` files. (#652)
1427
+
1428
+ * renv gains a new configuration option, `install.shortcuts`. When enabled,
1429
+ if renv discovers that a package to be installed is already available in
1430
+ the user or site libraries, renv will instead install a copy of that package
1431
+ into the project library. (#636)
1432
+
1433
+ * renv gains a new function, `renv::use()`, used to download, install, and
1434
+ load a set of packages directly within an R script. `renv::use()` can make it
1435
+ easier to share a standalone R script, with the packages required to install
1436
+ that script embedded directly in the script. It is inspired in part by the
1437
+ [groundhog](https://groundhogr.com/) package.
1438
+
1439
+ * `renv::install(".")` can now be used to install a package from sources within
1440
+ the current working directory. (#634)
1441
+
1442
+ * Fixed an issue where `renv::update()` could fail if a package installed from
1443
+ GitHub was missing the `RemoteHost` field in its DESCRIPTION file. (#632)
1444
+
1445
+ * renv now has support for custom project profiles. Profiles can be used to
1446
+ activate different sets of project libraries + lockfiles for different workflows
1447
+ in a given project. See `vignette("profiles", package = "renv")` for more
1448
+ details.
1449
+
1450
+ * Fixed an issue where attempts to initialize an renv project in a path
1451
+ containing non-ASCII characters could fail on Windows. (#629)
1452
+
1453
+ * Fixed an issue where `renv::install("<package>")` could fail if renv chose
1454
+ to install the package from MRAN rather than from one of the active package
1455
+ repositories. (#627)
1456
+
1457
+ * renv again defaults to using the project's `renv/staging` folder for staged
1458
+ / transactional installs. Use the `RENV_PATHS_LIBRARY_STAGING` environment
1459
+ variable if more granular control over the staging library path is required.
1460
+ This fixes issues on Windows with creating junction points to the global
1461
+ package cache on Windows. (#584)
1462
+
1463
+ * renv no longer skips downloading a requested source package if an existing
1464
+ cached download exists and appears to be valid. This should help avoid issues
1465
+ when attempting to install a package whose associated tarball has changed
1466
+ remotely. (#504)
1467
+
1468
+ * During bootstrap, renv will now attempt to download and unpack a binary
1469
+ copy of renv if available from the specified package repositories.
1470
+
1471
+ * renv now always attempts to bootstrap itself from the R Project's
1472
+ Cloud package repository, as a fallback in case no other repository
1473
+ is available. (#613)
1474
+
1475
+ * `renv::rebuild(<package>)` now uses the latest-available version of the
1476
+ requested package(s) if those packages are not currently installed.
1477
+
1478
+ * Fixed an issue where `renv::restore(library = "/path/to/lib")` would fail to
1479
+ restore packages, if those packages were already installed on the active
1480
+ library paths (as reported by `.libPaths()`). (#612)
1481
+
1482
+ * `renv::snapshot()` gains the `reprex` argument. Set this to `TRUE` if you'd
1483
+ like to embed an renv lockfile as part of a reproducible example, as
1484
+ generated by the [`reprex`](https://www.tidyverse.org/help/#reprex-pkg)
1485
+ package.
1486
+
1487
+ * `renv::status()` now reports packages that are referenced in a project's
1488
+ scripts, but are neither installed in the project library nor recorded in the
1489
+ lockfile. (#588)
1490
+
1491
+ * Fixed an issue where package installation could fail if the `configure.vars`
1492
+ option was set to be a named character, rather than a named list. (#609)
1493
+
1494
+
1495
+ # renv 0.12.5
1496
+
1497
+ * Fixed an issue where renv would fail to bootstrap. (#608)
1498
+
1499
+
1500
+ # renv 0.12.4
1501
+
1502
+ * renv now invalidates the available packages cache if the `https_proxy`
1503
+ environment variable changes. (#579)
1504
+
1505
+ * `renv::install(<pkg>)` will now install the latest-available version of
1506
+ that package from local sources, if that package is available and newer than
1507
+ any package available on the active package repositories. (#591)
1508
+
1509
+ * The configuration option `startup.quiet` has been added, allowing one to
1510
+ control whether renv will display the typical startup banner when a
1511
+ project is loaded.
1512
+
1513
+ * renv now better handles being unloaded and reloaded within the
1514
+ same R session. In particular, warnings related to a corrupted
1515
+ lazy-load database should no longer occur. (#600)
1516
+
1517
+ * renv no longer reinstalls packages that are already installed and
1518
+ up-to-date in bare calls to `renv::install()`.
1519
+
1520
+ * renv now uses the R temporary directory for staging, when performing
1521
+ transactional restores / installs. If you need to control the path used
1522
+ for staged installs, please set the `RENV_PATHS_LIBRARY_STAGING` environment
1523
+ variable.
1524
+
1525
+ * The `install.verbose` configuration option has been added. When set to
1526
+ `TRUE`, renv will stream the output generated by R when performing a
1527
+ package installation. This can be helpful in some cases when diagnosing
1528
+ a failed restore / install. (#330)
1529
+
1530
+ * Fixed an issue where renv could fail to parse R Markdown chunk headers
1531
+ with an empty label. (#598)
1532
+
1533
+ * The environment variable `RENV_PATHS_LIBRARY_ROOT_ASIS` can now be used
1534
+ to control whether the project name should be used as-is when forming the
1535
+ library path within the `RENV_PATHS_LIBRARY_ROOT` folder. Set this to
1536
+ `"TRUE"` if you would prefer renv did not append a unique identifier
1537
+ to your project's library path. (#593)
1538
+
1539
+ * Fixed an issue where GitLab references were not URL encoded. (#590)
1540
+
1541
+ * renv no longer emits warnings when parsing multi-mode R files that make
1542
+ use of re-used knitr chunks (those specified as `<<label>>`). (#586)
1543
+
1544
+ * The library used for staged installs can now be configured via the
1545
+ `RENV_PATHS_LIBRARY_STAGING` environment variable. (#584)
1546
+
1547
+ * Fixed an issue where bootstrapping an older version of renv could
1548
+ fail if the R repositories had not been appropriately set.
1549
+
1550
+
1551
+ # renv 0.12.3
1552
+
1553
+ * Fixed an issue where `renv::dependencies()` could give an error if called
1554
+ with a `path` argument of length > 1.
1555
+
1556
+ * `renv::restore()` gains the `rebuild` argument, allowing users to control
1557
+ whether packages should be rebuilt on `restore()` rather than installed
1558
+ via links or copies from the cache, or other sources providing
1559
+ already-installed packages.
1560
+
1561
+ * renv will now attempt to bootstrap itself from CRAN, in addition to any
1562
+ repositories declared via `getOption("repos")`. If you'd prefer to disable
1563
+ this behavior, you can set `options(renv.bootstrap.repos = character())`.
1564
+
1565
+ * The renv setting `r.version` has been added. This can be set if you'd like
1566
+ to associate a particular project with a specific version of R, independent
1567
+ of the version of R actually used when subsequent lockfiles are created via
1568
+ `renv::snapshot()`. For example, setting `renv::settings$r.version("4.0")`
1569
+ will ensure that R version `"4.0"` is encoded in the lockfile for future
1570
+ calls to `renv::snapshot()` in a project. (#254)
1571
+
1572
+ * `renv::dependencies()` now detects the usage of R packages within dotfiles;
1573
+ e.g. the project `.Rprofile`. (#569)
1574
+
1575
+ * `renv::status()` gains the `cache` argument, used to control whether
1576
+ `renv::status()` also performs diagnostics on the global package cache. (#570)
1577
+
1578
+ * Fixed an issue where `renv::status()` would make an un-necessary call to
1579
+ `renv::dependencies()`. (#570)
1580
+
1581
+ * Fixed an issue where `renv::install("bioc::<package>", rebuild = TRUE)` would
1582
+ fail to install the requested package. (#565)
1583
+
1584
+ * Fixed an issue where the repository name for a package installed from
1585
+ an R package repository was sometimes incorrect. (#402)
1586
+
1587
+ * When `RENV_PATHS_LIBRARY_ROOT` is set, renv will now disambiguate library
1588
+ paths based on a hash of the project's path. (#564)
1589
+
1590
+
1591
+ # renv 0.12.2
1592
+
1593
+ * renv no longer errs when running tests with `_R_CHECK_SUGGESTS_ONLY_=false`.
1594
+
1595
+
1596
+ # renv 0.12.1
1597
+
1598
+ * renv now ensures all of its dependencies are loaded eagerly when running
1599
+ tests, to avoid issues with missing + lazily-loaded packages.
1600
+
1601
+ * `renv::snapshot()` now accepts library paths specified with a relative
1602
+ path. (#562)
1603
+
1604
+ * `renv::snapshot()` no longer excludes the project itself, for `R` package
1605
+ projects that use [golem](https://engineering-shiny.org/). (#538)
1606
+
1607
+ * The renv configuration option `cache.symlinks` can now be used to control
1608
+ whether renv used symlinks into the cache, as opposed to full package
1609
+ copies. Please see `?renv::config` for more details. (#556)
1610
+
1611
+ * `renv::snapshot()` gains the `packages` argument, to be used when creating a
1612
+ lockfile that captures a specific set of packages and their dependencies.
1613
+ renv will use the currently-installed versions of those packages when
1614
+ determining the package records to be written to the lockfile. (#554)
1615
+
1616
+ * `renv::dependencies()` now accepts an R function as the first argument,
1617
+ for finding the packages used by a particular function. Currently,
1618
+ package usages must be prefixed with `::` to be detected. (#554)
1619
+
1620
+ * `renv::record(<package>)` now ensures that the latest-available version of
1621
+ that package is recorded in the lockfile. Previously, a package record
1622
+ without any specified version was added instead. For existing records
1623
+ without a recorded version, the latest-available version on the package
1624
+ repositories will be used during `restore()` instead. (#540)
1625
+
1626
+ * renv now reads the default branch tagged for repositories created on GitHub,
1627
+ ensuring that calls of the form `renv::install("<user>/<repo>")` resolve to
1628
+ the declared default branch, rather than always defaulting to `"master"`.
1629
+ (#557)
1630
+
1631
+ * renv now only installs packages from sources if it detects that build tools
1632
+ are available. This determination is done by checking whether `make` is
1633
+ available on the `PATH`. (#552)
1634
+
1635
+ * Warnings related to unknown sources can now be suppressed by setting
1636
+ `options(renv.warnings.unknown_sources = FALSE)`. (#546)
1637
+
1638
+ * renv now ignores chunks with the parameter `exercise=TRUE` set, under the
1639
+ assumption that such chunks might contain errors and so otherwise be
1640
+ un-parsable.
1641
+
1642
+ * renv now warns if sandbox generation takes a long time (> 30 seconds).
1643
+
1644
+ * renv now provides an optional locking mechanism, to help minimize the
1645
+ chance of interprocess conflicts when multiple R processes need to use the
1646
+ same renv project. The option is currently disabled by default; it can be
1647
+ enabled by setting `options(renv.config.locking.enabled = TRUE)` in an
1648
+ appropriate R startup file. (#525)
1649
+
1650
+
1651
+ # renv 0.12.0
1652
+
1653
+ * renv now uses R's internal tar implementation by default on Windows. This is
1654
+ done to avoid issues that may occur when a version of `tar.exe` on the `PATH`
1655
+ exists, but does not accept Windows-style paths. The `TAR` environment
1656
+ variable can be set if one needs to explicitly force the use of a particular
1657
+ `tar.exe` executable. (#521)
1658
+
1659
+ * renv now prepends `renv (<version>)` to the user agent string. This should
1660
+ help ensure that package binaries are located when installing packages from
1661
+ RSPM outside of RStudio. (#520)
1662
+
1663
+ * renv now uses a task callback to detect mutations to the project library
1664
+ when the `auto.snapshot` configuration option is enabled. This will help
1665
+ ensure that automatic snapshots occur when packages are installed via a
1666
+ mechanism not explicitly understood by renv. (#501)
1667
+
1668
+ * renv now treats the user + site libraries as package sources during a
1669
+ restore. If renv sees that a package already installed in one of these
1670
+ libraries is compatible with the record requested via `renv::install()` or
1671
+ `renv::restore()`, that copy of the package will be copied and used. (#492)
1672
+
1673
+ * renv now performs a lighter-weight check as to whether the project lockfile
1674
+ is synchronized with the project library on load. The default value for the
1675
+ `synchronized.check` config option has been changed back to `TRUE`. (#496)
1676
+
1677
+ * renv now handles the `remotes` syntax for installing packages lying within
1678
+ the sub-directory of a GitHub repository; that is,
1679
+ `renv::install("user/repo/subdir")` should work as expected. (#497)
1680
+
1681
+ * Fixed an issue where renv did not construct the correct URL for packages to
1682
+ be installed from Bitbucket remotes. (#494)
1683
+
1684
+ * Fixed an issue where the `RENV_PATHS_PREFIX` environment variable was
1685
+ inappropriately normalized when renv was loaded. (#465)
1686
+
1687
+
1688
+ # renv 0.11.0
1689
+
1690
+ * Fixed an issue where `renv::install(..., type = "binary")` would
1691
+ still attempt to install packages from sources in some cases. (#461)
1692
+
1693
+ * renv now always writes `renv/.gitignore`, to ensure that the appropriate
1694
+ directories are ignored for projects which initialize `git` after renv
1695
+ itself is initialized. (#462)
1696
+
1697
+ * R Markdown documents with the `.Rmarkdown` file extension are now parsed for
1698
+ dependencies.
1699
+
1700
+ * Fixed an issue where setting the `external.libraries` configuration option
1701
+ would trigger a warning. (#452)
1702
+
1703
+ * Improved handling of unicode paths on Windows. (#451)
1704
+
1705
+ * `renv::snapshot(project = <path>)` now properly respects `.gitignore` /
1706
+ `.renvignore` files, even when that project has not yet been explicitly
1707
+ initialized yet. (#439)
1708
+
1709
+ * The default value of the `synchronized.check` option has been changed from
1710
+ TRUE to FALSE.
1711
+
1712
+ * Fixed an issue where packages downloaded from Bitbucket and GitLab did not
1713
+ record the associated commit hash.
1714
+
1715
+ * Fixed an issue where attempting to install packages from GitLab could fail
1716
+ to install the correct version of the package. (#436)
1717
+
1718
+ * `renv::snapshot()` now preserves records in a lockfile that are only
1719
+ available for a different operating system. This should make it easier
1720
+ to share lockfiles that make use of platform-specific packages. (#419)
1721
+
1722
+ * renv better handles files that are removed during an invocation to
1723
+ `renv::dependencies()`. (#429)
1724
+
1725
+ * The configuration option `install.staged` has been renamed to
1726
+ `install.transactional`, to better reflect its purpose. `install.staged`
1727
+ remains supported as a deprecated alias.
1728
+
1729
+ * Fixed an issue where renv could fail to parse non-ASCII content on Windows.
1730
+ (#421)
1731
+
1732
+ * `renv::update()` gains the `exclude` argument, useful in cases where one
1733
+ would like to update all packages used in a project, except for a small
1734
+ subset of excluded packages. (#425)
1735
+
1736
+ * `renv::update()` now respects the project `ignored.packages` setting. (#425)
1737
+
1738
+ * Fixed an issue where RSPM binary URL transformations could fail for
1739
+ Ubuntu Trusty. (#423)
1740
+
1741
+ * renv now records the `OS_type` reported in a package's `DESCRIPTION` file
1742
+ (if any), and ignores packages incompatible with the current operating
1743
+ system during restore. (#394)
1744
+
1745
+
1746
+ # renv 0.10.0
1747
+
1748
+ * `renv::install()` gains the `type` argument, used to control whether renv
1749
+ should attempt to install packages from sources (`"source"`) or using
1750
+ binaries (`"binary"`).
1751
+
1752
+ * renv now knows how to find and activate Rtools40, for R 4.0.0 installations
1753
+ on Windows.
1754
+
1755
+ * The `RENV_PATHS_PREFIX` environment variable can now be used to prepend an
1756
+ optional path component to the project library and global cache paths.
1757
+ This is primarily useful for users who want to share the renv cache across
1758
+ multiple operating systems on Linux, but need to disambigutate these paths
1759
+ according to the operating system in use. See `?renv::paths` for more details.
1760
+
1761
+ * Fixed an issue where `renv::install()` could fail for packages from GitHub
1762
+ whose DESCRIPTION files contained Windows-style line endings. (#408)
1763
+
1764
+ * `renv::update()` now also checks and updates any Bioconductor packages
1765
+ used within a project. (#392)
1766
+
1767
+ * renv now properly parses negated entries within a `.gitignore`; e.g.
1768
+ `!script.R` will indicate that renv should include `script.R` when
1769
+ parsing dependencies. (#403)
1770
+
1771
+ * Fixed an issue where packages which had only binaries available on a
1772
+ package repository were not detected as being from a package repository.
1773
+ (#402)
1774
+
1775
+ * Fixed an issue where calls of the form `p_load(char = <vctr>)` caused a
1776
+ failure when enumerating dependencies. (#401)
1777
+
1778
+ * Fixed an issue where `renv::install()` could fail when multiple versions
1779
+ of a package are available from a single repository, but some versions of
1780
+ those packages are incompatible with the current version of R. (#252)
1781
+
1782
+ * Fixed an issue where downloads could fail when the associated pre-flight
1783
+ HEAD request failed as well. (#390)
1784
+
1785
+ * Fixed an issue where empty records within a DESCRIPTION file could cause
1786
+ `renv::dependencies()` to fail. (#382)
1787
+
1788
+ * renv will now download binaries of older packages from MRAN when possible.
1789
+
1790
+ * renv will now attempt to re-generate the system library sandbox if it is
1791
+ deleted while a session is active. (#361)
1792
+
1793
+ * Fixed an issue where Python packages referenced using `reticulate::import()`
1794
+ were incorrectly tagged as R package dependencies. Similarly, renv now only
1795
+ considers calls to `modules::import()` if those calls occur within a call to
1796
+ `modules::module()`. (#359)
1797
+
1798
+ * `renv::scaffold()` now also generates a lockfile when invoked. (#351)
1799
+
1800
+ * The argument `confirm` has been renamed to `prompt` in all places where it
1801
+ is used. `confirm` remains supported for backwards compatibility, but is no
1802
+ longer explicitly documented. (#347)
1803
+
1804
+ * The continuous integration renv vignette now also contains a template for
1805
+ using renv together with GitLab CI. (#348, @artemklevtsov)
1806
+
1807
+ * renv now properly resets the session library paths when calling
1808
+ `renv::deactivate()` from within RStudio. (#219)
1809
+
1810
+ * `renv::init()` now restores the associated project library when called in a
1811
+ project containing a lockfile but no project library nor any pre-existing
1812
+ project infrastructure.
1813
+
1814
+ * Fixed an issue on Windows where attempts to download packages from package
1815
+ repositories referenced with a `file://` scheme could fail.
1816
+
1817
+ * The configuration option `dependency.errors` has been added, controlling how
1818
+ errors are handled during dependency enumeration. This is used, for
1819
+ example, when enumerating dependencies during a call to `renv::snapshot()`.
1820
+ By default, errors are reported, and (for interactive sessions) the user is
1821
+ prompted to continue. (#342)
1822
+
1823
+ * `renv::dependencies()` gains two new arguments: the `progress` argument
1824
+ controls whether renv reports progress while enumerating dependencies,
1825
+ and `errors` controls how renv handles and reports errors encountered
1826
+ during dependency discovery. The `quiet` argument is now soft-deprecated,
1827
+ but continues to be supported for backwards compatibility. Specifying
1828
+ `quiet = TRUE` is equivalent to specifying `progress = FALSE` and
1829
+ `errors = "ignored"`. Please see the documentation in `?dependencies`
1830
+ for more details. (#342)
1831
+
1832
+ * The environment variable `RENV_PATHS_LIBRARY_ROOT` can now be set, to
1833
+ instruct renv to use a particular directory as a host for any project
1834
+ libraries that are used by renv. This can be useful for certain cases
1835
+ where it is cumbersome to include the project library within the project
1836
+ itself; for example, when developing an R package. (#345)
1837
+
1838
+ * The code used to bootstrap renv (that is, the code used to install renv
1839
+ into a project) has been overhauled. (#344)
1840
+
1841
+ * renv no longer unsets an error handler set within the user profile when
1842
+ loading a project. (#343)
1843
+
1844
+ * renv gains the "explicit" snapshot type, wherein only packages explicitly
1845
+ listed as dependencies within the project `DESCRIPTION` file (and those
1846
+ package's transitive dependencies) will enter the lockfile when
1847
+ `renv::snapshot()` is called. (#338)
1848
+
1849
+ * renv will now transform RSPM source URLs into binary URLs as appropriate,
1850
+ allowing renv to use RSPM's binary repositories during restore. See
1851
+ `?config` for more details. (#124)
1852
+
1853
+ * renv will now infer a dependency on `hexbin` in projects that make
1854
+ use of the `ggplot2::geom_hex()` function.
1855
+
1856
+ * renv now tries to place Rtools on the PATH when a package is installed
1857
+ with the `install.packages()` hook active. (#335)
1858
+
1859
+
1860
+ # renv 0.9.3
1861
+
1862
+ * Fixed an issue where attempts to specify `RENV_PATHS_RTOOLS` would
1863
+ be ignored by renv. (#335)
1864
+
1865
+ * Fixed an issue where downloads could fail when using the `wininet`
1866
+ downloader, typically with a message of the form
1867
+ "InternetOpenUrl failed: 'The requested header was not found'".
1868
+
1869
+ * renv better handles projects containing special characters on Windows.
1870
+ (#334)
1871
+
1872
+ * renv better handles unnamed repositories. (#333)
1873
+
1874
+ * renv gains the config option `hydrate.libpaths`, allowing one to control
1875
+ the library paths used by default for `renv::hydrate()`. (#329)
1876
+
1877
+ * `renv::hydrate()` gains the `sources` argument, used to control the library
1878
+ paths used by renv when hydrating a project. (#329)
1879
+
1880
+ * renv now sandboxes the system library by default on Windows.
1881
+
1882
+ * renv now validates that the Xcode license has been accepted before
1883
+ attempting to install R packages from sources. (#296)
1884
+
1885
+ * The R option `renv.download.override` can now be used to override the
1886
+ machinery used by renv when downloading files. For example, setting
1887
+ `options(renv.download.override = utils::download.file)` would instruct
1888
+ renv to use R's own downloader when downloading files from the internet.
1889
+ This can be useful when configuration of `curl` is challenging or
1890
+ intractable in your environment, or you've already configured the base
1891
+ R downloader suitably.
1892
+
1893
+ * `renv::use_python("~/path/to/python")` now works as expected.
1894
+
1895
+ * renv now properly expands `R_LIBS_SITE` and `R_LIBS_USER` when set within a
1896
+ startup `.Renviron` file. (#318)
1897
+
1898
+ * The `renv.download.headers` option can now be used to provide arbitrary HTTP
1899
+ headers when downloading files. See the **Authentication** section in
1900
+ `vignette("renv")` for more details. (#307)
1901
+
1902
+ * renv gains the project setting `package.dependency.fields`, for controlling
1903
+ which fields in an R package's `DESCRIPTION` file are examined when
1904
+ discovering recursive package dependencies. This can be useful when you'd like
1905
+ to instruct renv to track, for example, the `Suggests` dependencies of the
1906
+ packages used in your project. (#315)
1907
+
1908
+ * renv now better handles repositories referenced using file URIs.
1909
+
1910
+ * Packages installed from GitHub using `renv::install()` will now also have
1911
+ `Github*` fields added, in addition to the default `Remote*` fields. This
1912
+ should help fix issues when attempting to deploy projects to RStudio Connect
1913
+ requiring packages installed by renv. (#397)
1914
+
1915
+ * renv now prefers using a RemoteType field (if any) when attempting to
1916
+ determine a package's source. (#306)
1917
+
1918
+ * renv gains a new function `renv::scaffold()`, for generating renv project
1919
+ infrastructure without explicitly loading the project. (#303)
1920
+
1921
+ * renv now updates its local `.gitignore` file, when part of a git repository
1922
+ whose git root lives in a parent directory. (#300)
1923
+
1924
+
1925
+ # renv 0.9.2
1926
+
1927
+ * Fixed an issue in invoking `find` on Solaris.
1928
+
1929
+
1930
+ # renv 0.9.1
1931
+
1932
+ * Fixed an issue in invoking `cp` on Solaris.
1933
+
1934
+
1935
+ # renv 0.9.0
1936
+
1937
+ * renv gains a new function `renv::record()`, for recording new packages
1938
+ within an existing lockfile. This can be useful when one or more of the
1939
+ recorded packages need to be modified for some reason.
1940
+
1941
+ * An empty `.renvignore` no longer erroneously ignores all files within a
1942
+ directory. (#286)
1943
+
1944
+ * renv now warns if the version of renv loaded within a project does not
1945
+ match the version declared within the renv autoloader. (#285)
1946
+
1947
+ * renv gains a new function `renv::run()`, for running R scripts within
1948
+ a particular project's context inside an R subprocess. (#126)
1949
+
1950
+ * The algorithm used by renv for hashing packages has changed. Consider
1951
+ using `renv::rehash()` to migrate packages from the old renv cache to
1952
+ the new renv cache.
1953
+
1954
+ * `renv::status()` now reports packages which are referenced in your project
1955
+ code, but are not currently installed. (#271)
1956
+
1957
+ * renv is now able to restore packages with a recorded URL remote. (#272)
1958
+
1959
+ * `renv::dependencies()` can now parse R package dependencies used as custom
1960
+ site generator in an Rmd yaml header. (#269, @cderv)
1961
+
1962
+ * renv now properly respects a downloader requested by the environment
1963
+ variable `RENV_DOWNLOAD_FILE_METHOD`.
1964
+
1965
+ * renv no longer sources the user profile (normally located at `~/.Rprofile`)
1966
+ by default. If you desire this behavior, you can opt-in by setting
1967
+ `RENV_CONFIG_USER_PROFILE = TRUE`; e.g. within your project or user
1968
+ `.Renviron` file. (#261)
1969
+
1970
+ * `renv::restore()` gains the `packages` argument, to be used to restore
1971
+ a subset of packages recorded within the lockfile. (#260)
1972
+
1973
+ * renv now tries harder to preserve the existing structure in infrastructure
1974
+ files (e.g. the project `.Rprofile`) that it modifies. (#259)
1975
+
1976
+ * renv now warns if any Bioconductor packages used in the project appear
1977
+ to be from a different Bioconductor release than the one currently active
1978
+ and stored in the lockfile. (#244)
1979
+
1980
+ * renv now normalizes any paths set in the `RENV_PATHS_*` family of
1981
+ environment variables when renv is loaded.
1982
+
1983
+ * Fixed an issue where renv would not properly clean up after a failed
1984
+ attempt to call `Sys.junction()`. (#251)
1985
+
1986
+ * Fixed an issue where renv would, in some cases, copy rather than link from
1987
+ the package cache when the library path had been customized with the
1988
+ `RENV_PATHS_LIBRARY` environment variable. (#245)
1989
+
1990
+ * The method renv uses when copying directories can now be customized. When
1991
+ copying directories, renv now by default uses `robocopy` on Windows, and
1992
+ `cp` on Unix. This should improve robustness when attempting to copy files
1993
+ in some contexts; e.g. when copying across network shares.
1994
+
1995
+ * renv now tracks the version of Bioconductor used within a project
1996
+ (if applicable), and uses that when retrieving the set of repositories
1997
+ to be used during `renv::restore()`.
1998
+
1999
+ * `renv::dependencies()` can now parse R package dependencies declared and
2000
+ used by the `modules` package. (#238, @labriola)
2001
+
2002
+ * Fixed an issue where `renv::restore()` could fail in Docker environments,
2003
+ usually with an error message like 'Invalid cross-device link'. (#243)
2004
+
2005
+ * `renv::install()` disables staged package install when running with the
2006
+ Windows Subsystem for Linux. (#239)
2007
+
2008
+
2009
+ # renv 0.8.3
2010
+
2011
+ * `renv::dependencies()` gains a new argument `dev`, indicating whether
2012
+ development dependencies should also be included in the set of discovered
2013
+ package dependencies. By default, only runtime dependencies will be reported.
2014
+
2015
+ * renv has gained the function `renv::diagnostics()`, which can occasionally
2016
+ be useful in understanding and diagnosing renv (mis)behaviors.
2017
+
2018
+ * `renv::equip()` can now be used on macOS to install the R LLVM toolchain
2019
+ normally used when compiling packages from source. renv will also use
2020
+ this toolchain as appropriate when building packages from source.
2021
+
2022
+ * `renv::install()` now provides a custom Makevars when building packages on
2023
+ macOS with Apple Clang, to avoid issues due to the use of '-fopenmp' during
2024
+ compilation.
2025
+
2026
+ * `renv::install()` now respects explicit version requests when discovered
2027
+ in a project's DESCRIPTION file. (#233)
2028
+
2029
+ * Fixed an issue where `renv:::actions()` would fail to report any actions if
2030
+ the project lockfile was empty. (#232)
2031
+
2032
+ * When using renv for R package development, renv will no longer attempt to
2033
+ write the package being developed to the lockfile. (#231)
2034
+
2035
+ * Fixes for checks run on CRAN.
2036
+
2037
+ * renv will now search for Rtools in more locations. (#225)
2038
+
2039
+ * `renv::load()` now ensures that the version of renv associated with
2040
+ the loaded project is loaded when possible. In addition, experimental
2041
+ support for switching between projects with `renv::load()` has been
2042
+ implemented. (#229)
2043
+
2044
+ * `renv::dependencies()` no longer treats folders named with the extension
2045
+ `.Rmd` as though they were regular files. (#228)
2046
+
2047
+ * It is now possible to install source packages contained within `.zip`
2048
+ archives using `renv::install()`.
2049
+
2050
+ * Fixed an issue where attempts to call `renv::restore()` with the path to the
2051
+ lockfile explicitly provided would fail. (#227)
2052
+
2053
+
2054
+ # renv 0.8.2
2055
+
2056
+ * Further fixes for checks run on CRAN.
2057
+
2058
+
2059
+ # renv 0.8.1
2060
+
2061
+ * Fixes for checks run on CRAN.
2062
+
2063
+
2064
+ # renv 0.8.0
2065
+
2066
+ * Initial CRAN release.
2067
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # File share/R/nspackloader.R
2
+ # Part of the R package, https://www.R-project.org
3
+ #
4
+ # Copyright (C) 1995-2012 The R Core Team
5
+ #
6
+ # This program is free software; you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation; either version 2 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # A copy of the GNU General Public License is available at
17
+ # https://www.r-project.org/Licenses/
18
+
19
+ local({
20
+ info <- loadingNamespaceInfo()
21
+ pkg <- info$pkgname
22
+ ns <- .getNamespace(as.name(pkg))
23
+ if (is.null(ns))
24
+ stop("cannot find namespace environment for ", pkg, domain = NA);
25
+ dbbase <- file.path(info$libname, pkg, "R", pkg)
26
+ lazyLoad(dbbase, ns, filter = function(n) n != ".__NAMESPACE__.")
27
+ })
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv.rdb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5d8029d4b03fcaa47769f85a84f67f0ea025563e16e7aea01f4778f56126e63
3
+ size 1293590
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/R/renv.rdx ADDED
Binary file (20.1 kB). View file
 
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/bin/renv ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env sh
2
+
3
+ if [ -z "${RENV_CONFIG_SYNCHRONIZED_CHECK}" ]; then
4
+ RENV_CONFIG_SYNCHRONIZED_CHECK=FALSE
5
+ export RENV_CONFIG_SYNCHRONIZED_CHECK
6
+ fi
7
+
8
+ R --no-save --no-restore -s -e "renv:::renv_cli_exec()" --args "$@"
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/bin/renv.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ set "RENV_CONFIG_SYNCHRONIZED_CHECK=FALSE"
2
+ R --no-save --no-restore -s -e "renv:::renv_cli_exec()" --args %*
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/config.yml ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ - name: "activate.prompt"
3
+ type: "logical[1]"
4
+ default: true
5
+ description: >
6
+ Automatically prompt the user to activate the current project, if it does
7
+ not appear to already be activated? This is mainly useful to help ensure
8
+ that calls to `renv::snapshot()` and `renv::restore()` use the project
9
+ library. See `?renv::activate` for more details.
10
+
11
+ - name: "autoloader.enabled"
12
+ type: "logical[1]"
13
+ default: true
14
+ description: >
15
+ Enable the renv auto-loader? When `FALSE`, renv will not
16
+ automatically load a project containing an renv autoloader within
17
+ its `.Rprofile`. In addition, renv will not write out the project
18
+ auto-loader in calls to `renv::init()`.
19
+
20
+ - name: "auto.snapshot"
21
+ type: "logical[1]"
22
+ default: false
23
+ description: >
24
+ Automatically snapshot changes to the project library when the project
25
+ dependencies change?
26
+
27
+ - name: "bitbucket.host"
28
+ type: "character[1]"
29
+ default: "api.bitbucket.org/2.0"
30
+ description: >
31
+ The default Bitbucket host to be used during package retrieval.
32
+
33
+ - name: "copy.method"
34
+ type: "*"
35
+ default: "auto"
36
+ description: >
37
+ The method to use when attempting to copy directories. See **Copy Methods**
38
+ for more information.
39
+
40
+ - name: "connect.timeout"
41
+ type: "integer[1]"
42
+ default: 20
43
+ description: >
44
+ The amount of time to spend (in seconds) when attempting to download
45
+ a file. Only applicable when the `curl` downloader is used.
46
+
47
+ - name: "connect.retry"
48
+ type: "integer[1]"
49
+ default: 3
50
+ description: >
51
+ The number of times to attempt re-downloading a file, when transient
52
+ download errors occur. Only applicable when the `curl` downloader is used.
53
+
54
+ - name: "cache.enabled"
55
+ type: "logical[1]"
56
+ default: true
57
+ description: >
58
+ Enable the global renv package cache? When active, renv will install
59
+ packages into a global cache, and link or copy packages from the cache
60
+ into your \R library as appropriate. This can greatly save on disk space
61
+ and install time when \R packages are shared across multiple projects in
62
+ the same environment.
63
+
64
+ - name: "cache.symlinks"
65
+ type: "logical[1]"
66
+ code: >
67
+ .Platform$OS.type == "unix"
68
+ description: >
69
+ Symlink packages from the global renv package cache into your project
70
+ library? When `TRUE`, renv will use symlinks (or, on Windows, junction
71
+ points) to reference packages installed in the cache. Set this to `FALSE`
72
+ if you'd prefer to copy packages from the cache into your project library.
73
+ Enabled by default, except on Windows where this feature is only enabled
74
+ if the project library and global package cache are on the same volume.
75
+
76
+ - name: "dependency.errors"
77
+ type: "character[1]"
78
+ default: "reported"
79
+ description: >
80
+ Many renv APIs require the enumeration of your project's \R package
81
+ dependencies. This option controls how errors that occur during this enumeration
82
+ are handled. By default, errors are reported but are non-fatal. Set this to `"fatal"`
83
+ to force errors to be fatal, and `"ignored"` to ignore errors altogether. See
84
+ [`dependencies()`] for more details.
85
+
86
+ - name: "dependencies.limit"
87
+ type: "integer[1]"
88
+ default: 1000
89
+ description: >
90
+ By default, renv reports if it discovers more than this many files when
91
+ looking for dependencies, as that may indicate you are running
92
+ `dependencies()` in the wrong place. Set to `Inf` to disable this warning.
93
+
94
+ - name: "exported.functions"
95
+ type: "character[*]"
96
+ default: "*"
97
+ description: >
98
+ When `library(renv)` is called, should its exports be placed on the search
99
+ path? Set this to `FALSE` to avoid issues that can arise with, for example,
100
+ `renv::load()` masking `base::load()`. In general, we recommend referencing
101
+ renv functions from its namespace explicitly; e.g. prefer
102
+ `renv::snapshot()` over `snapshot()`.
103
+
104
+ By default, all exported renv functions are attached and placed on the
105
+ search path, for backwards compatibility with existing scripts using renv.
106
+
107
+
108
+ - name: "external.libraries"
109
+ type: "character[*]"
110
+ default: ~
111
+ description: >
112
+ A character vector of external libraries, to be used in tandem with
113
+ your projects. Be careful when using external libraries: it's possible that things
114
+ can break within a project if the version(s) of packages used in your project
115
+ library happen to be incompatible with packages in your external libraries; for
116
+ example, if your project required `xyz 1.0` but `xyz 1.1` was present and loaded
117
+ from an external library. Can also be an \R function that provides the paths to
118
+ external libraries. Library paths will be expanded via [`.expand_R_libs_env_var()`]
119
+ as necessary.
120
+
121
+ - name: "filebacked.cache"
122
+ type: "logical[1]"
123
+ default: true
124
+ description: >
125
+ Enable the renv file-backed cache? When enabled, renv will cache the
126
+ contents of files that are read (e.g. DESCRIPTION files) in memory, thereby
127
+ avoiding re-reading the file contents from the filesystem if the file has
128
+ not changed. renv uses the file `mtime` to determine if the file has
129
+ changed; consider disabling this if `mtime` is unreliable on your system.
130
+
131
+ - name: "github.host"
132
+ type: "character[1]"
133
+ default: "api.github.com"
134
+ description: >
135
+ The default GitHub host to be used during package retrieval.
136
+
137
+ - name: "gitlab.host"
138
+ type: "character[1]"
139
+ default: "gitlab.com"
140
+ description: >
141
+ The default GitLab host to be used during package retrieval.
142
+
143
+ - name: "hydrate.libpaths"
144
+ type: "character[*]"
145
+ default: ~
146
+ description: >
147
+ A character vector of library paths, to be used by [hydrate()]
148
+ when attempting to hydrate projects. When empty, the default set of library paths
149
+ (as documented in `?renv::hydrate`) are used instead. See [`hydrate()`] for more details.
150
+
151
+ - name: "install.build"
152
+ type: "logical[1]"
153
+ default: false
154
+ description: >
155
+ Should downloaded package archives be built (via `R CMD build`) before installation?
156
+ When TRUE, package vignettes will also be built as part of package installation.
157
+ Because building packages before installation may require packages within 'Suggests'
158
+ to be available, this option is not enabled by default.
159
+
160
+ - name: "install.remotes"
161
+ type: "logical[1]"
162
+ default: true
163
+ description: >
164
+ Should renv read a package's `Remotes:` field when determining how
165
+ package dependencies should be installed?
166
+
167
+ - name: "install.shortcuts"
168
+ type: "logical[1]"
169
+ default: true
170
+ description: >
171
+ Allow for a set of 'shortcuts' when installing packages with renv? When
172
+ enabled, if renv discovers that a package to be installed is already
173
+ available within the user or site libraries, then it will install a
174
+ local copy of that package.
175
+
176
+ - name: "install.staged"
177
+ type: "logical[1]"
178
+ default: true
179
+ description: >
180
+ DEPRECATED: Please use `renv.config.install.transactional` instead.
181
+
182
+ - name: "install.transactional"
183
+ type: "logical[1]"
184
+ default: true
185
+ description: >
186
+ Perform a transactional install of packages during install and restore? When
187
+ enabled, renv will first install packages into a temporary library, and later
188
+ copy or move those packages back into the project library only if all packages
189
+ were successfully downloaded and installed. This can be useful if you'd like to
190
+ avoid mutating your project library if installation of one or more packages fails.
191
+
192
+ - name: "install.verbose"
193
+ type: "logical[1]"
194
+ default: false
195
+ description: >
196
+ Be verbose when installing R packages from sources? When `TRUE`, renv will
197
+ stream any output generated during package build + installation to the console.
198
+
199
+ - name: "locking.enabled"
200
+ type: "logical[1]"
201
+ default: false
202
+ description: >
203
+ Use interprocess locks when invoking methods which might mutate the project
204
+ library? Enable this to allow multiple processes to use the same renv
205
+ project, while minimizing risks relating to concurrent access to the
206
+ project library. Disable this if you encounter locking issues. Locks are stored
207
+ as files within the project at `renv/lock`; if you need to manually remove a
208
+ stale lock you can do so via `unlink("renv/lock", recursive = TRUE)`.
209
+
210
+ - name: "mran.enabled"
211
+ type: "logical[1]"
212
+ default: false
213
+ description: >
214
+ DEPRECATED: MRAN is no longer maintained by Microsoft.
215
+
216
+ - name: "pak.enabled"
217
+ type: "logical[1]"
218
+ default: false
219
+ description: >
220
+ Use the [pak](https://pak.r-lib.org/) package to install packages?
221
+
222
+ - name: "ppm.enabled"
223
+ type: "logical[1]"
224
+ default: true
225
+ description: >
226
+ Boolean; enable [Posit Package Manager](https://packagemanager.posit.co/)
227
+ integration in renv projects? When `TRUE`, renv will attempt to transform
228
+ repository URLs used by PPM into binary URLs as appropriate for the
229
+ current Linux platform. Set this to `FALSE` if you'd like to continue using
230
+ source-only PPM URLs, or if you find that renv is improperly transforming
231
+ your repository URLs. You can still set and use PPM repositories with this
232
+ option disabled; it only controls whether renv tries to transform source
233
+ repository URLs into binary URLs on your behalf.
234
+
235
+ - name: "ppm.default"
236
+ type: "logical[1]"
237
+ default: true
238
+ description: >
239
+ Boolean; should new projects use the
240
+ [Posit Public Package Manager](https://packagemanager.posit.co/)
241
+ instance by default? When `TRUE` (the default), projects initialized with
242
+ `renv::init()` will use the P3M instance if the `repos` R option has not
243
+ already been set by some other means (for example, in a startup `.Rprofile`).
244
+
245
+ - name: "ppm.url"
246
+ type: "character[1]"
247
+ default: "https://packagemanager.posit.co/cran/latest"
248
+ description: >
249
+ The default PPM URL to be used for new renv projects. Defaults to the
250
+ CRAN mirror maintained by Posit at <https://packagemanager.posit.co/>.
251
+ This option can be changed if you'd like renv to use an alternate package manager instance.
252
+
253
+ - name: "repos.override"
254
+ type: "character[*]"
255
+ default: ~
256
+ description: >
257
+ Override the R package repositories used during [`restore()`]? Primarily
258
+ useful for deployment / continuous integration, where you might want to enforce
259
+ the usage of some set of repositories over what is defined in `renv.lock` or otherwise
260
+ set by the R session.
261
+
262
+ - name: "rspm.enabled"
263
+ type: "logical[1]"
264
+ default: true
265
+ description: >
266
+ DEPRECATED: Please use `renv.config.ppm.enabled` instead.
267
+
268
+ - name: "sandbox.enabled"
269
+ type: "logical[1]"
270
+ default: true
271
+ description: >
272
+ Enable sandboxing for renv projects? When active, renv will attempt
273
+ to sandbox the system library, preventing non-system packages installed in the
274
+ system library from becoming available in renv projects. (That is, only packages
275
+ with priority `"base"` or `"recommended"`, as reported by `installed.packages()`,
276
+ are made available.)
277
+
278
+ Sandboxing is done by linking or copying system packages into a separate
279
+ library path, and then instructing R to use that library path as the system
280
+ library path. In some environments, this action can take a large amount of
281
+ time -- in such a case, you may want to disable the renv sandbox.
282
+
283
+ - name: "shims.enabled"
284
+ type: "logical[1]"
285
+ default: true
286
+ description: >
287
+ Should renv shims be installed on package load? When enabled, renv
288
+ will install its own shims over the functions `install.packages()`, `update.packages()`
289
+ and `remove.packages()`, delegating these functions to [`renv::install()`],
290
+ [`renv::update()`] and [`renv::remove()`] as appropriate.
291
+
292
+ - name: "snapshot.inference"
293
+ type: "logical[1]"
294
+ default: true
295
+ description: >
296
+ For packages which were installed from local sources, should renv try to infer the
297
+ package's remote from its DESCRIPTION file? When `TRUE`, renv will check and prompt
298
+ you to update the package's DESCRIPTION file if the remote source can be ascertained.
299
+ Currently, this is only implemented for packages hosted on GitHub. Note that this
300
+ check is only performed in interactive R sessions.
301
+
302
+ - name: "snapshot.validate"
303
+ type: "logical[1]"
304
+ default: true
305
+ description: >
306
+ Validate \R package dependencies when calling snapshot? When `TRUE`,
307
+ renv will attempt to diagnose potential issues in the project library before
308
+ creating `renv.lock` -- for example, if a package installed in the project library
309
+ depends on a package which is not currently installed.
310
+
311
+ - name: "startup.quiet"
312
+ type: "logical[1]"
313
+ default: ~
314
+ description: >
315
+ Be quiet during startup? When set, renv will not display the typical
316
+ `Project <path> loaded. [renv <version>]` banner on startup.
317
+
318
+ - name: "synchronized.check"
319
+ type: "logical[1]"
320
+ default: true
321
+ description: >
322
+ Check that the project library is synchronized with the lockfile on load?
323
+
324
+ - name: "sysreqs.check"
325
+ type: "logical[1]"
326
+ default: true
327
+ description: >
328
+ Check whether the requisite system packages are installed during package
329
+ installation and restore? This feature uses the R System Requirements
330
+ database maintained at <https://github.com/rstudio/r-system-requirements>.
331
+
332
+ - name: "updates.check"
333
+ type: "logical[1]"
334
+ default: false
335
+ description: >
336
+ Check for package updates when the session is initialized? This can
337
+ be useful if you'd like to ensure that your project lockfile remains up-to-date
338
+ with packages as they are released on CRAN.
339
+
340
+ - name: "updates.parallel"
341
+ type: "*"
342
+ default: 2
343
+ description: >
344
+ Check for package updates in parallel? This can be useful when a large
345
+ number of packages installed from non-CRAN remotes are installed, as these packages
346
+ can then be checked for updates in parallel.
347
+
348
+ - name: "user.environ"
349
+ type: "logical[1]"
350
+ default: true
351
+ description: >
352
+ Load the user R environ (typically located at `~/.Renviron`) when renv
353
+ is loaded?
354
+
355
+ - name: "user.library"
356
+ type: "logical[1]"
357
+ default: false
358
+ description: >
359
+ Include the system library on the library paths for your projects? Note
360
+ that this risks breaking project encapsulation and is not recommended for projects
361
+ which you intend to share or collaborate on with other users. See also the caveats
362
+ for the `renv.config.external.libraries` option.
363
+
364
+ - name: "user.profile"
365
+ type: "logical[1]"
366
+ default: false
367
+ description: >
368
+ Load the user R profile (typically located at `~/.Rprofile`) when renv
369
+ is loaded? This is disabled by default, as running arbitrary code from
370
+ the the user `~/.Rprofile` could risk breaking project encapsulation.
371
+ If your goal is to set environment variables that are visible within all
372
+ renv projects, then placing those in `~/.Renviron` is often a better
373
+ choice.
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.R ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.Rmd ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Using renv with continuous integration"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Using renv with continuous integration}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ When building, deploying, or testing an renv-using project with continuous
19
+ integration (CI) systems (e.g. [GitHub Actions][github-actions],
20
+ [GitLab CI][gitlab-ci], and others) you need some way to tell the CI system
21
+ to use renv to restore the same packages that you're using locally.
22
+
23
+ The general idea is:
24
+
25
+ 1. Call `renv::snapshot()` on your local machine to generate `renv.lock`.
26
+
27
+ 2. Call `renv::restore()` on your CI service to restore the project library
28
+ from `renv.lock`.
29
+
30
+ 3. Cache the project library and global renv cache on the CI service.
31
+
32
+ Note that this workflow is not generally a good fit for CRAN packages, because
33
+ CRAN itself runs `R CMD check` using the latest version of all dependencies.
34
+
35
+ ## GitHub actions
36
+
37
+ Here, we describe two common approaches for integrating renv with a [GitHub Actions](https://github.com/features/actions) workflow:
38
+
39
+ * Use the `r-lib/setup-renv` action.
40
+ * Use GitHub's built-in cache action together with existing renv functionality;
41
+
42
+ ### Using r-lib/actions/setup-renv
43
+
44
+ The r-lib organization offers some actions for R users, and among them a [`setup-renv`][r-lib-actions-renv] action is provided for projects using renv. To use this action, you can add the following steps to your workflow:
45
+
46
+ ```yaml
47
+ steps:
48
+ - uses: actions/checkout@v3
49
+ - uses: r-lib/actions/setup-r@v2
50
+ - uses: r-lib/actions/setup-renv@v2
51
+ ```
52
+
53
+ Using these steps will automatically perform the following actions:
54
+
55
+ * renv will be installed, via `install.packages("renv")`,
56
+ * renv will be configured to use the GitHub cache,
57
+ * If provided via a `with: profile:` key, that renv profile will be activated,
58
+ * The project will be restored via `renv::restore()`.
59
+
60
+ After this, any steps using R will use the active renv project by default.
61
+
62
+ ### Using the GitHub Actions Cache with renv
63
+
64
+ When using renv in your own custom GitHub action workflow, there are two main requirements:
65
+
66
+ 1. Cache any packages installed by renv across runs,
67
+ 2. Use `renv::restore()` to restore packages using this cache to speed up installation
68
+
69
+ As an example, these steps might look like:
70
+
71
+ ```yaml
72
+ env:
73
+ RENV_PATHS_ROOT: ~/.cache/R/renv
74
+
75
+ steps:
76
+
77
+ - name: Cache packages
78
+ uses: actions/cache@v1
79
+ with:
80
+ path: ${{ env.RENV_PATHS_ROOT }}
81
+ key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
82
+ restore-keys: |
83
+ ${{ runner.os }}-renv-
84
+
85
+ - name: Restore packages
86
+ shell: Rscript {0}
87
+ run: |
88
+ if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv")
89
+ renv::restore()
90
+ ```
91
+
92
+ See also the [example][github-actions-renv] on GitHub actions.
93
+
94
+ ## GitLab CI
95
+
96
+ The following template can be used as a base when using renv with
97
+ [GitLab CI][gitlab-ci]:
98
+
99
+ ```yaml
100
+ variables:
101
+ RENV_PATHS_ROOT: ${CI_PROJECT_DIR}/renv
102
+
103
+ cache:
104
+ key: ${CI_PROJECT_NAME}
105
+ paths:
106
+ - ${RENV_PATHS_ROOT}
107
+
108
+ before_script:
109
+ - < ... other pre-deploy steps ... >
110
+ - Rscript -e "if (!requireNamespace('renv', quietly = TRUE)) install.packages('renv')"
111
+ - Rscript -e "renv::restore()"
112
+ ```
113
+
114
+
115
+ [gitlab-ci]: https://about.gitlab.com/solutions/continuous-integration/
116
+ [github-actions]: https://github.com/features/actions
117
+ [github-actions-renv]: https://github.com/actions/cache/blob/main/examples.md#r---renv
118
+ [r-lib-actions-renv]: https://github.com/r-lib/actions/tree/v2-branch/setup-renv
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/ci.html ADDED
@@ -0,0 +1,459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Using renv with continuous integration</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Using renv with continuous integration</h1>
341
+
342
+
343
+
344
+ <p>When building, deploying, or testing an renv-using project with
345
+ continuous integration (CI) systems (e.g. <a href="https://github.com/features/actions">GitHub Actions</a>, <a href="https://about.gitlab.com/solutions/continuous-integration/">GitLab
346
+ CI</a>, and others) you need some way to tell the CI system to use renv
347
+ to restore the same packages that you’re using locally.</p>
348
+ <p>The general idea is:</p>
349
+ <ol style="list-style-type: decimal">
350
+ <li><p>Call <code>renv::snapshot()</code> on your local machine to
351
+ generate <code>renv.lock</code>.</p></li>
352
+ <li><p>Call <code>renv::restore()</code> on your CI service to restore
353
+ the project library from <code>renv.lock</code>.</p></li>
354
+ <li><p>Cache the project library and global renv cache on the CI
355
+ service.</p></li>
356
+ </ol>
357
+ <p>Note that this workflow is not generally a good fit for CRAN
358
+ packages, because CRAN itself runs <code>R CMD check</code> using the
359
+ latest version of all dependencies.</p>
360
+ <div id="github-actions" class="section level2">
361
+ <h2>GitHub actions</h2>
362
+ <p>Here, we describe two common approaches for integrating renv with a
363
+ <a href="https://github.com/features/actions">GitHub Actions</a>
364
+ workflow:</p>
365
+ <ul>
366
+ <li>Use the <code>r-lib/setup-renv</code> action.</li>
367
+ <li>Use GitHub’s built-in cache action together with existing renv
368
+ functionality;</li>
369
+ </ul>
370
+ <div id="using-r-libactionssetup-renv" class="section level3">
371
+ <h3>Using r-lib/actions/setup-renv</h3>
372
+ <p>The r-lib organization offers some actions for R users, and among
373
+ them a <a href="https://github.com/r-lib/actions/tree/v2-branch/setup-renv"><code>setup-renv</code></a>
374
+ action is provided for projects using renv. To use this action, you can
375
+ add the following steps to your workflow:</p>
376
+ <div class="sourceCode" id="cb1"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">steps</span><span class="kw">:</span></span>
377
+ <span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a><span class="kw">-</span><span class="at"> </span><span class="fu">uses</span><span class="kw">:</span><span class="at"> actions/checkout@v3</span></span>
378
+ <span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="kw">-</span><span class="at"> </span><span class="fu">uses</span><span class="kw">:</span><span class="at"> r-lib/actions/setup-r@v2</span></span>
379
+ <span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a><span class="kw">-</span><span class="at"> </span><span class="fu">uses</span><span class="kw">:</span><span class="at"> r-lib/actions/setup-renv@v2</span></span></code></pre></div>
380
+ <p>Using these steps will automatically perform the following
381
+ actions:</p>
382
+ <ul>
383
+ <li>renv will be installed, via
384
+ <code>install.packages(&quot;renv&quot;)</code>,</li>
385
+ <li>renv will be configured to use the GitHub cache,</li>
386
+ <li>If provided via a <code>with: profile:</code> key, that renv profile
387
+ will be activated,</li>
388
+ <li>The project will be restored via <code>renv::restore()</code>.</li>
389
+ </ul>
390
+ <p>After this, any steps using R will use the active renv project by
391
+ default.</p>
392
+ </div>
393
+ <div id="using-the-github-actions-cache-with-renv" class="section level3">
394
+ <h3>Using the GitHub Actions Cache with renv</h3>
395
+ <p>When using renv in your own custom GitHub action workflow, there are
396
+ two main requirements:</p>
397
+ <ol style="list-style-type: decimal">
398
+ <li>Cache any packages installed by renv across runs,</li>
399
+ <li>Use <code>renv::restore()</code> to restore packages using this
400
+ cache to speed up installation</li>
401
+ </ol>
402
+ <p>As an example, these steps might look like:</p>
403
+ <div class="sourceCode" id="cb2"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="fu">env</span><span class="kw">:</span></span>
404
+ <span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="at"> </span><span class="fu">RENV_PATHS_ROOT</span><span class="kw">:</span><span class="at"> ~/.cache/R/renv</span></span>
405
+ <span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a></span>
406
+ <span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="fu">steps</span><span class="kw">:</span></span>
407
+ <span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a></span>
408
+ <span id="cb2-6"><a href="#cb2-6" tabindex="-1"></a><span class="kw">-</span><span class="at"> </span><span class="fu">name</span><span class="kw">:</span><span class="at"> Cache packages</span></span>
409
+ <span id="cb2-7"><a href="#cb2-7" tabindex="-1"></a><span class="at"> </span><span class="fu">uses</span><span class="kw">:</span><span class="at"> actions/cache@v1</span></span>
410
+ <span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a><span class="at"> </span><span class="fu">with</span><span class="kw">:</span></span>
411
+ <span id="cb2-9"><a href="#cb2-9" tabindex="-1"></a><span class="at"> </span><span class="fu">path</span><span class="kw">:</span><span class="at"> ${{ env.RENV_PATHS_ROOT }}</span></span>
412
+ <span id="cb2-10"><a href="#cb2-10" tabindex="-1"></a><span class="at"> </span><span class="fu">key</span><span class="kw">:</span><span class="at"> ${{ runner.os }}-renv-${{ hashFiles(&#39;**/renv.lock&#39;) }}</span></span>
413
+ <span id="cb2-11"><a href="#cb2-11" tabindex="-1"></a><span class="fu"> restore-keys</span><span class="kw">: </span><span class="ch">|</span></span>
414
+ <span id="cb2-12"><a href="#cb2-12" tabindex="-1"></a> ${{ runner.os }}-renv-</span>
415
+ <span id="cb2-13"><a href="#cb2-13" tabindex="-1"></a></span>
416
+ <span id="cb2-14"><a href="#cb2-14" tabindex="-1"></a><span class="kw">-</span><span class="at"> </span><span class="fu">name</span><span class="kw">:</span><span class="at"> Restore packages</span></span>
417
+ <span id="cb2-15"><a href="#cb2-15" tabindex="-1"></a><span class="at"> </span><span class="fu">shell</span><span class="kw">:</span><span class="at"> Rscript {0}</span></span>
418
+ <span id="cb2-16"><a href="#cb2-16" tabindex="-1"></a><span class="fu"> run</span><span class="kw">: </span><span class="ch">|</span></span>
419
+ <span id="cb2-17"><a href="#cb2-17" tabindex="-1"></a> if (!requireNamespace(&quot;renv&quot;, quietly = TRUE)) install.packages(&quot;renv&quot;)</span>
420
+ <span id="cb2-18"><a href="#cb2-18" tabindex="-1"></a> renv::restore()</span></code></pre></div>
421
+ <p>See also the <a href="https://github.com/actions/cache/blob/main/examples.md#r---renv">example</a>
422
+ on GitHub actions.</p>
423
+ </div>
424
+ </div>
425
+ <div id="gitlab-ci" class="section level2">
426
+ <h2>GitLab CI</h2>
427
+ <p>The following template can be used as a base when using renv with <a href="https://about.gitlab.com/solutions/continuous-integration/">GitLab
428
+ CI</a>:</p>
429
+ <div class="sourceCode" id="cb3"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="fu">variables</span><span class="kw">:</span></span>
430
+ <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a><span class="at"> </span><span class="fu">RENV_PATHS_ROOT</span><span class="kw">:</span><span class="at"> ${CI_PROJECT_DIR}/renv</span></span>
431
+ <span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a></span>
432
+ <span id="cb3-4"><a href="#cb3-4" tabindex="-1"></a><span class="fu">cache</span><span class="kw">:</span></span>
433
+ <span id="cb3-5"><a href="#cb3-5" tabindex="-1"></a><span class="at"> </span><span class="fu">key</span><span class="kw">:</span><span class="at"> ${CI_PROJECT_NAME}</span></span>
434
+ <span id="cb3-6"><a href="#cb3-6" tabindex="-1"></a><span class="at"> </span><span class="fu">paths</span><span class="kw">:</span></span>
435
+ <span id="cb3-7"><a href="#cb3-7" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> ${RENV_PATHS_ROOT}</span></span>
436
+ <span id="cb3-8"><a href="#cb3-8" tabindex="-1"></a></span>
437
+ <span id="cb3-9"><a href="#cb3-9" tabindex="-1"></a><span class="fu">before_script</span><span class="kw">:</span></span>
438
+ <span id="cb3-10"><a href="#cb3-10" tabindex="-1"></a><span class="kw"> - </span><span class="at">&lt; ... other pre-deploy steps ... </span><span class="ch">&gt;</span></span>
439
+ <span id="cb3-11"><a href="#cb3-11" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> Rscript -e &quot;if (!requireNamespace(&#39;renv&#39;, quietly = TRUE)) install.packages(&#39;renv&#39;)&quot;</span></span>
440
+ <span id="cb3-12"><a href="#cb3-12" tabindex="-1"></a><span class="at"> </span><span class="kw">-</span><span class="at"> Rscript -e &quot;renv::restore()&quot;</span></span></code></pre></div>
441
+ </div>
442
+
443
+
444
+
445
+ <!-- code folding -->
446
+
447
+
448
+ <!-- dynamically load mathjax for compatibility with self-contained -->
449
+ <script>
450
+ (function () {
451
+ var script = document.createElement("script");
452
+ script.type = "text/javascript";
453
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
454
+ document.getElementsByTagName("head")[0].appendChild(script);
455
+ })();
456
+ </script>
457
+
458
+ </body>
459
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.R ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.Rmd ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Using renv with Docker"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Using renv with Docker}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ While renv can help capture the state of your R library at some point in time, there are still other aspects of the system that can influence the runtime behavior of your R application. In particular, the same R code can produce different results depending on:
19
+
20
+ - The operating system in use,
21
+ - The compiler flags used when R and packages are built,
22
+ - The LAPACK / BLAS system(s) in use,
23
+ - The versions of system libraries installed and in use,
24
+
25
+ And so on. [Docker](https://www.docker.com/) is a tool that can help solve this problem through the use of **containers**. Very roughly speaking, one can think of a container as a small, self-contained system within which different applications can be run. Using Docker, one can declaratively state how a container should be built (what operating system it should use, and what system software should be installed within), and use that system to run applications. (For more details, please see <https://environments.rstudio.com/docker>.)
26
+
27
+ Using Docker and renv together, one can then ensure that both the underlying system, alongside the required R packages, are fixed and constant for a particular application.
28
+
29
+ The main challenges in using Docker with renv are:
30
+
31
+ - Ensuring that the renv cache is visible to Docker containers, and
32
+
33
+ - Ensuring that required R package dependencies are available at runtime.
34
+
35
+ This vignette will assume you are already familiar with Docker; if you are not yet familiar with Docker, the [Docker Documentation](https://docs.docker.com/) provides a thorough introduction. To learn more about using Docker to manage R environments, visit [environments.rstudio.com](https://environments.rstudio.com/docker.html).
36
+
37
+ We'll discuss two strategies for using renv with Docker:
38
+
39
+ 1. Using renv to install packages when the Docker image is generated;
40
+ 2. Using renv to install packages when Docker containers are run.
41
+
42
+ We'll also explore the pros and cons of each strategy.
43
+
44
+
45
+ ## Creating Docker images with renv
46
+
47
+ With Docker, [Dockerfiles](https://docs.docker.com/engine/reference/builder/) are used to define new images. Dockerfiles can be used to declaratively specify how a Docker image should be created. A Docker image captures the state of a machine at some point in time -- e.g., a Linux operating system after downloading and installing R `r getRversion()[1, 1:2]`. Docker containers can be created using that image as a base, allowing different independent applications to run using the same pre-defined machine state.
48
+
49
+ First, you'll need to get renv installed on your Docker image. For example, you could install the latest release of renv from CRAN:
50
+
51
+ ```dockerfile
52
+ RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
53
+ ```
54
+
55
+ Alternatively, if you need to use the development version of renv, you could use:
56
+
57
+ ```dockerfile
58
+ RUN R -e "install.packages('renv', repos = 'https://rstudio.r-universe.dev')"
59
+ ```
60
+
61
+ Next, we'll copy `renv.lock` into the container:
62
+
63
+ ```dockerfile
64
+ WORKDIR /project
65
+ COPY renv.lock renv.lock
66
+ ```
67
+
68
+ Now, we `renv::restore()` to install those packages. At this stage, you'll need to decide which of R's library paths you'd like to use for pacakge installation. (See `?.libPaths` for more information.) There are a couple of options available:
69
+
70
+
71
+ ### Use the default library paths
72
+
73
+ This method is appropriate if you'd like these packages to be visible to all R processes launched using this image, and can be done via:
74
+
75
+ ```dockerfile
76
+ RUN R -e "renv::restore()"
77
+ ```
78
+
79
+ Note that this method may fail if R's default library paths are not on a writable volume in the Docker image. If this is the case, consider one of the alternatives below.
80
+
81
+
82
+ ### Use the default project library path
83
+
84
+ If you want to use renv's default project-local library path, you'll need to initialize the project within the Docker container as an renv project. This can be done with:
85
+
86
+ ```dockerfile
87
+ RUN R -s -e "renv::init(bare = TRUE)"
88
+ RUN R -s -e "renv::restore()"
89
+ ```
90
+
91
+ Or, alternatively, if you already have a project autoloader + settings available -- e.g. because you're creating a Docker image from an existing renv project -- you could use:
92
+
93
+ ```dockerfile
94
+ RUN mkdir -p renv
95
+ COPY .Rprofile .Rprofile
96
+ COPY renv/activate.R renv/activate.R
97
+ COPY renv/settings.json renv/settings.json
98
+ RUN R -s -e "renv::restore()"
99
+ ```
100
+
101
+ Note that in this mode, the installed packages would only be visible to R sessions launched using `/project` as the working directory. This will be the default behavior as long as `WORKDIR` is not changed, but it's important to keep this in mind.
102
+
103
+
104
+ ### Use a custom library path
105
+
106
+ If you'd like to fully customize the library path used, the simplest approach is likely to use the `RENV_PATHS_LIBRARY` environment variable. This mimics the above approach, but customizes the library paths used by renv. For example:
107
+
108
+ ```dockerfile
109
+ ENV RENV_PATHS_LIBRARY=renv/library
110
+ RUN R -s -e "renv::init(bare = TRUE)"
111
+ RUN R -s -e "renv::restore()"
112
+ ```
113
+
114
+ Alternatively, you could manage the library paths yourself via `.libPaths()` -- see `?.libPaths` in R for more inforamtion.
115
+
116
+
117
+ ## Speeding up package installations
118
+
119
+ The previously-described approaches are useful if you have multiple applications with identical package requirements. In this case, a single image containing this identical package library could serve as the parent image for several containerized applications.
120
+
121
+ However, `renv::restore()` is slow -- it needs to download and install packages, which can take some time. Thus, some care is required to efficiently make use of the renv cache for projects that require:
122
+
123
+ 1. Building an image multiple times (e.g., to debug the production application as source code is updated), or
124
+
125
+ 2. Calling `renv::restore()` each time the container is run.
126
+
127
+ The former process can be sped up using multi-stage builds, the latter by dynamically provisioning R Libraries, as described below.
128
+
129
+
130
+ ### Multi-stage builds
131
+
132
+ For projects that require repeatedly building an image, [multi-stage builds](https://docs.docker.com/build/building/multi-stage/) can be used to speed up the build process. With multi-stage builds, multiple FROM statements are used in the Dockerfile and files can be copied across build stages.
133
+
134
+ This approach can be leveraged to generate more efficient builds by dedicating a first stage build to package synchronization and a second stage build to copying files and executing code that may need to be updated often across builds (e.g., code that needs to be debugged in the container).
135
+
136
+ To implement a two stage build, the following code could be used as part of a Dockerfile.
137
+
138
+ ```dockerfile
139
+ FROM <parent-image> AS base
140
+
141
+ # intialize the project; assuming renv infrastructure available
142
+ WORKDIR /project
143
+ RUN mkdir -p renv
144
+ COPY renv.lock renv.lock
145
+ COPY .Rprofile .Rprofile
146
+ COPY renv/activate.R renv/activate.R
147
+ COPY renv/settings.dcf renv/settings.dcf
148
+
149
+ # change default location of cache to project folder
150
+ RUN mkdir renv/.cache
151
+ ENV RENV_PATHS_CACHE=renv/.cache
152
+
153
+ # restore
154
+ RUN R -s -e "renv::restore()"
155
+ ```
156
+
157
+ The above code uses `FROM <parent-image> AS <name>` to name the first stage of the build `base`. Here, `<parent-image>` should be replaced with an appropriate image name.
158
+
159
+ Subsequently, the code uses approach 2 (described above) to copy the auto-loader to the project directory in the image. It additionally creates the `renv/.cache` directory that is to be used as the renv cache.
160
+
161
+ The second stage of the build is defined by adding the following code to the same Dockerfile, below the previous code chunk.
162
+
163
+ ```dockerfile
164
+ FROM <parent-image>
165
+
166
+ WORKDIR /project
167
+ COPY --from=base /project .
168
+
169
+ # add commands that need to be debugged below
170
+ ```
171
+
172
+ Here, `<parent-image>` could be the same as the parent image of `base`, but does not have to be (see [documentation](https://docs.docker.com/build/building/multi-stage/) for more details).
173
+
174
+ The key line is the `COPY` command, which specifies that the contents of `/project` directory from the `base` image are copied into the `/project` directory of this image.
175
+
176
+ Any commands that will change frequently across builds could be included below the `COPY` command. If only this code associated with the second stage build is updated then `renv::restore()` will not be called again at build time. Instead, the layers associated with the `base` image will be loaded from Docker's cache, thereby saving significant time in build process.
177
+
178
+ In fact, `renv::restore()` will only be called when the `base` image needs to be rebuilt (e.g., when changes are made to `renv.lock`). Docker's cache system is generally good at understanding the dependencies of images. However, if you find that the `base` image is not updating as expected, it is possible to manually enforce a clean build by including the `--no-cache` option in the call to `docker build`.
179
+
180
+
181
+ ### Dynamically Provisioning R Libraries with renv
182
+
183
+ However, on occasion, one will have multiple applications built from a single base image, but each application will have its own independent R package requirements. In this case, rather than including the package dependencies in the image itself, it would be preferable for each container to provision its own library at runtime, based on that application's `renv.lock` lockfile.
184
+
185
+ In effect, this is as simple as ensuring that `renv::restore()` happens at container runtime, rather than image build time. However, on its own, `renv::restore()` is slow -- it needs to download and install packages, which could take prohibitively long if an application needs to be run repeatedly.
186
+
187
+ The renv package cache can be used to help ameliorate this issue. When the cache is enabled, whenever renv attempts to install or restore an R package, it first checks to see whether that package is already available within the renv cache. If it is, that instance of the package is linked into the project library. Otherwise, the package is first installed into the renv cache, and then that newly-installed copy is linked for use in the project.
188
+
189
+ In effect, if the renv cache is available, you should only need to pay the cost of package installation once -- after that, the newly-installed package will be available for re-use across different projects. At the same time, each project's library will remain independent and isolated from one another, so installing a package within one container won't affect another container.
190
+
191
+ However, by default, each Docker container will have its own independent filesystem. Ideally, we'd like for *all* containers launched from a particular image to have access to the same renv cache. To accomplish this, we'll have to tell each container to use an renv cache located on a shared mount.
192
+
193
+ In sum, if we'd like to allow for runtime provisioning of R package dependencies, we will need to ensure the renv cache is located on a shared volume, which is visible to any containers launched. We will accomplish this by:
194
+
195
+ 1. Setting the `RENV_PATHS_CACHE` environment variable, to tell the instance of renv running in each container where the global cache lives;
196
+
197
+ 2. Telling Docker to mount some filesystem location from the host filesystem, at some location (`RENV_PATHS_CACHE_HOST`), to a container-specific location (`RENV_PATHS_CACHE_CONTAINER`).
198
+
199
+ For example, if you had a container running a Shiny application:
200
+
201
+ ```dockerfile
202
+ # the location of the renv cache on the host machine
203
+ RENV_PATHS_CACHE_HOST=/opt/local/renv/cache
204
+
205
+ # where the cache should be mounted in the container
206
+ RENV_PATHS_CACHE_CONTAINER=/renv/cache
207
+
208
+ # run the container with the host cache mounted in the container
209
+ docker run --rm \
210
+ -e "RENV_PATHS_CACHE=${RENV_PATHS_CACHE_CONTAINER}" \
211
+ -v "${RENV_PATHS_CACHE_HOST}:${RENV_PATHS_CACHE_CONTAINER}" \
212
+ -p 14618:14618 \
213
+ R -s -e 'renv::restore(); shiny::runApp(host = "0.0.0.0", port = 14618)'
214
+ ```
215
+
216
+ Note that the invocation above assumes that the project has already been initialized either via calling `renv::init()` or by copying the requisite `renv` project infrastructure. With this, any calls to renv APIs within the created docker container will have access to the mounted cache. The first time you run a container, renv will likely need to populate the cache, and so some time will be spent downloading and installing the required packages. Subsequent runs will be much faster, as renv will be able to reuse the global package cache.
217
+
218
+ The primary downside with this approach compared to the image-based approach is that it requires you to modify how containers are created, and requires a bit of extra orchestration in how containers are launched. However, once the renv cache is active, newly-created containers will launch very quickly, and a single image can then be used as a base for a myriad of different containers and applications, each with their own independent package dependencies.
219
+
220
+
221
+ ## Handling the renv autoloader
222
+
223
+ When `R` is launched within a project folder, the renv auto-loader (if present) will attempt to download and install renv into the project library if it's not available. Depending on how your Docker container is configured, this could fail. For example:
224
+
225
+ ```sh
226
+ Error installing renv:
227
+ ======================
228
+ ERROR: unable to create '/usr/local/pipe/renv/library/master/R-4.0/x86_64-pc-linux-gnu/renv'
229
+ Warning messages:
230
+ 1: In system2(r, args, stdout = TRUE, stderr = TRUE) :
231
+ running command ''/usr/lib/R/bin/R' --vanilla CMD INSTALL -l 'renv/library/master/R-4.0/x86_64-pc-linux-gnu' '/tmp/RtmpwM7ooh/renv_0.12.2.tar.gz' 2>&1' had status 1
232
+ 2: Failed to find an renv installation: the project will not be loaded.
233
+ Use `renv::activate()` to re-initialize the project.
234
+ ```
235
+
236
+ Bootstrapping renv into the project library might be unnecessary for you. If that is the case, then you can avoid this behavior by launching R with the `--vanilla` flag set; for example:
237
+
238
+ ```{sh}
239
+ R --vanilla -s -e 'renv::restore()'
240
+ ```
241
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/docker.html ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Using renv with Docker</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Using renv with Docker</h1>
341
+
342
+
343
+
344
+ <p>While renv can help capture the state of your R library at some point
345
+ in time, there are still other aspects of the system that can influence
346
+ the runtime behavior of your R application. In particular, the same R
347
+ code can produce different results depending on:</p>
348
+ <ul>
349
+ <li>The operating system in use,</li>
350
+ <li>The compiler flags used when R and packages are built,</li>
351
+ <li>The LAPACK / BLAS system(s) in use,</li>
352
+ <li>The versions of system libraries installed and in use,</li>
353
+ </ul>
354
+ <p>And so on. <a href="https://www.docker.com/">Docker</a> is a tool
355
+ that can help solve this problem through the use of
356
+ <strong>containers</strong>. Very roughly speaking, one can think of a
357
+ container as a small, self-contained system within which different
358
+ applications can be run. Using Docker, one can declaratively state how a
359
+ container should be built (what operating system it should use, and what
360
+ system software should be installed within), and use that system to run
361
+ applications. (For more details, please see <a href="https://environments.rstudio.com/docker" class="uri">https://environments.rstudio.com/docker</a>.)</p>
362
+ <p>Using Docker and renv together, one can then ensure that both the
363
+ underlying system, alongside the required R packages, are fixed and
364
+ constant for a particular application.</p>
365
+ <p>The main challenges in using Docker with renv are:</p>
366
+ <ul>
367
+ <li><p>Ensuring that the renv cache is visible to Docker containers,
368
+ and</p></li>
369
+ <li><p>Ensuring that required R package dependencies are available at
370
+ runtime.</p></li>
371
+ </ul>
372
+ <p>This vignette will assume you are already familiar with Docker; if
373
+ you are not yet familiar with Docker, the <a href="https://docs.docker.com/">Docker Documentation</a> provides a
374
+ thorough introduction. To learn more about using Docker to manage R
375
+ environments, visit <a href="https://environments.rstudio.com/docker.html">environments.rstudio.com</a>.</p>
376
+ <p>We’ll discuss two strategies for using renv with Docker:</p>
377
+ <ol style="list-style-type: decimal">
378
+ <li>Using renv to install packages when the Docker image is
379
+ generated;</li>
380
+ <li>Using renv to install packages when Docker containers are run.</li>
381
+ </ol>
382
+ <p>We’ll also explore the pros and cons of each strategy.</p>
383
+ <div id="creating-docker-images-with-renv" class="section level2">
384
+ <h2>Creating Docker images with renv</h2>
385
+ <p>With Docker, <a href="https://docs.docker.com/engine/reference/builder/">Dockerfiles</a>
386
+ are used to define new images. Dockerfiles can be used to declaratively
387
+ specify how a Docker image should be created. A Docker image captures
388
+ the state of a machine at some point in time – e.g., a Linux operating
389
+ system after downloading and installing R 4.5. Docker containers can be
390
+ created using that image as a base, allowing different independent
391
+ applications to run using the same pre-defined machine state.</p>
392
+ <p>First, you’ll need to get renv installed on your Docker image. For
393
+ example, you could install the latest release of renv from CRAN:</p>
394
+ <div class="sourceCode" id="cb1"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-e</span> <span class="st">&quot;install.packages(&#39;renv&#39;, repos = c(CRAN = &#39;https://cloud.r-project.org&#39;))&quot;</span></span></code></pre></div>
395
+ <p>Alternatively, if you need to use the development version of renv,
396
+ you could use:</p>
397
+ <div class="sourceCode" id="cb2"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-e</span> <span class="st">&quot;install.packages(&#39;renv&#39;, repos = &#39;https://rstudio.r-universe.dev&#39;)&quot;</span></span></code></pre></div>
398
+ <p>Next, we’ll copy <code>renv.lock</code> into the container:</p>
399
+ <div class="sourceCode" id="cb3"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="kw">WORKDIR</span> /project</span>
400
+ <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a><span class="kw">COPY</span> renv.lock renv.lock</span></code></pre></div>
401
+ <p>Now, we <code>renv::restore()</code> to install those packages. At
402
+ this stage, you’ll need to decide which of R’s library paths you’d like
403
+ to use for pacakge installation. (See <code>?.libPaths</code> for more
404
+ information.) There are a couple of options available:</p>
405
+ <div id="use-the-default-library-paths" class="section level3">
406
+ <h3>Use the default library paths</h3>
407
+ <p>This method is appropriate if you’d like these packages to be visible
408
+ to all R processes launched using this image, and can be done via:</p>
409
+ <div class="sourceCode" id="cb4"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-e</span> <span class="st">&quot;renv::restore()&quot;</span></span></code></pre></div>
410
+ <p>Note that this method may fail if R’s default library paths are not
411
+ on a writable volume in the Docker image. If this is the case, consider
412
+ one of the alternatives below.</p>
413
+ </div>
414
+ <div id="use-the-default-project-library-path" class="section level3">
415
+ <h3>Use the default project library path</h3>
416
+ <p>If you want to use renv’s default project-local library path, you’ll
417
+ need to initialize the project within the Docker container as an renv
418
+ project. This can be done with:</p>
419
+ <div class="sourceCode" id="cb5"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::init(bare = TRUE)&quot;</span></span>
420
+ <span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::restore()&quot;</span></span></code></pre></div>
421
+ <p>Or, alternatively, if you already have a project autoloader +
422
+ settings available – e.g. because you’re creating a Docker image from an
423
+ existing renv project – you could use:</p>
424
+ <div class="sourceCode" id="cb6"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a><span class="kw">RUN</span> <span class="fu">mkdir</span> <span class="at">-p</span> renv</span>
425
+ <span id="cb6-2"><a href="#cb6-2" tabindex="-1"></a><span class="kw">COPY</span> .Rprofile .Rprofile</span>
426
+ <span id="cb6-3"><a href="#cb6-3" tabindex="-1"></a><span class="kw">COPY</span> renv/activate.R renv/activate.R</span>
427
+ <span id="cb6-4"><a href="#cb6-4" tabindex="-1"></a><span class="kw">COPY</span> renv/settings.json renv/settings.json</span>
428
+ <span id="cb6-5"><a href="#cb6-5" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::restore()&quot;</span></span></code></pre></div>
429
+ <p>Note that in this mode, the installed packages would only be visible
430
+ to R sessions launched using <code>/project</code> as the working
431
+ directory. This will be the default behavior as long as
432
+ <code>WORKDIR</code> is not changed, but it’s important to keep this in
433
+ mind.</p>
434
+ </div>
435
+ <div id="use-a-custom-library-path" class="section level3">
436
+ <h3>Use a custom library path</h3>
437
+ <p>If you’d like to fully customize the library path used, the simplest
438
+ approach is likely to use the <code>RENV_PATHS_LIBRARY</code>
439
+ environment variable. This mimics the above approach, but customizes the
440
+ library paths used by renv. For example:</p>
441
+ <div class="sourceCode" id="cb7"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a><span class="kw">ENV</span> RENV_PATHS_LIBRARY=renv/library</span>
442
+ <span id="cb7-2"><a href="#cb7-2" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::init(bare = TRUE)&quot;</span></span>
443
+ <span id="cb7-3"><a href="#cb7-3" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::restore()&quot;</span></span></code></pre></div>
444
+ <p>Alternatively, you could manage the library paths yourself via
445
+ <code>.libPaths()</code> – see <code>?.libPaths</code> in R for more
446
+ inforamtion.</p>
447
+ </div>
448
+ </div>
449
+ <div id="speeding-up-package-installations" class="section level2">
450
+ <h2>Speeding up package installations</h2>
451
+ <p>The previously-described approaches are useful if you have multiple
452
+ applications with identical package requirements. In this case, a single
453
+ image containing this identical package library could serve as the
454
+ parent image for several containerized applications.</p>
455
+ <p>However, <code>renv::restore()</code> is slow – it needs to download
456
+ and install packages, which can take some time. Thus, some care is
457
+ required to efficiently make use of the renv cache for projects that
458
+ require:</p>
459
+ <ol style="list-style-type: decimal">
460
+ <li><p>Building an image multiple times (e.g., to debug the production
461
+ application as source code is updated), or</p></li>
462
+ <li><p>Calling <code>renv::restore()</code> each time the container is
463
+ run.</p></li>
464
+ </ol>
465
+ <p>The former process can be sped up using multi-stage builds, the
466
+ latter by dynamically provisioning R Libraries, as described below.</p>
467
+ <div id="multi-stage-builds" class="section level3">
468
+ <h3>Multi-stage builds</h3>
469
+ <p>For projects that require repeatedly building an image, <a href="https://docs.docker.com/build/building/multi-stage/">multi-stage
470
+ builds</a> can be used to speed up the build process. With multi-stage
471
+ builds, multiple FROM statements are used in the Dockerfile and files
472
+ can be copied across build stages.</p>
473
+ <p>This approach can be leveraged to generate more efficient builds by
474
+ dedicating a first stage build to package synchronization and a second
475
+ stage build to copying files and executing code that may need to be
476
+ updated often across builds (e.g., code that needs to be debugged in the
477
+ container).</p>
478
+ <p>To implement a two stage build, the following code could be used as
479
+ part of a Dockerfile.</p>
480
+ <div class="sourceCode" id="cb8"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb8-1"><a href="#cb8-1" tabindex="-1"></a><span class="kw">FROM</span> &lt;parent-image&gt; <span class="kw">AS</span> base</span>
481
+ <span id="cb8-2"><a href="#cb8-2" tabindex="-1"></a></span>
482
+ <span id="cb8-3"><a href="#cb8-3" tabindex="-1"></a><span class="co"># intialize the project; assuming renv infrastructure available</span></span>
483
+ <span id="cb8-4"><a href="#cb8-4" tabindex="-1"></a><span class="kw">WORKDIR</span> /project</span>
484
+ <span id="cb8-5"><a href="#cb8-5" tabindex="-1"></a><span class="kw">RUN</span> <span class="fu">mkdir</span> <span class="at">-p</span> renv</span>
485
+ <span id="cb8-6"><a href="#cb8-6" tabindex="-1"></a><span class="kw">COPY</span> renv.lock renv.lock</span>
486
+ <span id="cb8-7"><a href="#cb8-7" tabindex="-1"></a><span class="kw">COPY</span> .Rprofile .Rprofile</span>
487
+ <span id="cb8-8"><a href="#cb8-8" tabindex="-1"></a><span class="kw">COPY</span> renv/activate.R renv/activate.R</span>
488
+ <span id="cb8-9"><a href="#cb8-9" tabindex="-1"></a><span class="kw">COPY</span> renv/settings.dcf renv/settings.dcf</span>
489
+ <span id="cb8-10"><a href="#cb8-10" tabindex="-1"></a></span>
490
+ <span id="cb8-11"><a href="#cb8-11" tabindex="-1"></a><span class="co"># change default location of cache to project folder</span></span>
491
+ <span id="cb8-12"><a href="#cb8-12" tabindex="-1"></a><span class="kw">RUN</span> <span class="fu">mkdir</span> renv/.cache</span>
492
+ <span id="cb8-13"><a href="#cb8-13" tabindex="-1"></a><span class="kw">ENV</span> RENV_PATHS_CACHE=renv/.cache</span>
493
+ <span id="cb8-14"><a href="#cb8-14" tabindex="-1"></a></span>
494
+ <span id="cb8-15"><a href="#cb8-15" tabindex="-1"></a><span class="co"># restore </span></span>
495
+ <span id="cb8-16"><a href="#cb8-16" tabindex="-1"></a><span class="kw">RUN</span> <span class="ex">R</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&quot;renv::restore()&quot;</span></span></code></pre></div>
496
+ <p>The above code uses
497
+ <code>FROM &lt;parent-image&gt; AS &lt;name&gt;</code> to name the first
498
+ stage of the build <code>base</code>. Here,
499
+ <code>&lt;parent-image&gt;</code> should be replaced with an appropriate
500
+ image name.</p>
501
+ <p>Subsequently, the code uses approach 2 (described above) to copy the
502
+ auto-loader to the project directory in the image. It additionally
503
+ creates the <code>renv/.cache</code> directory that is to be used as the
504
+ renv cache.</p>
505
+ <p>The second stage of the build is defined by adding the following code
506
+ to the same Dockerfile, below the previous code chunk.</p>
507
+ <div class="sourceCode" id="cb9"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb9-1"><a href="#cb9-1" tabindex="-1"></a><span class="kw">FROM</span> &lt;parent-image&gt;</span>
508
+ <span id="cb9-2"><a href="#cb9-2" tabindex="-1"></a></span>
509
+ <span id="cb9-3"><a href="#cb9-3" tabindex="-1"></a><span class="kw">WORKDIR</span> /project</span>
510
+ <span id="cb9-4"><a href="#cb9-4" tabindex="-1"></a><span class="kw">COPY</span> <span class="op">--from=base</span> /project .</span>
511
+ <span id="cb9-5"><a href="#cb9-5" tabindex="-1"></a></span>
512
+ <span id="cb9-6"><a href="#cb9-6" tabindex="-1"></a><span class="co"># add commands that need to be debugged below</span></span></code></pre></div>
513
+ <p>Here, <code>&lt;parent-image&gt;</code> could be the same as the
514
+ parent image of <code>base</code>, but does not have to be (see <a href="https://docs.docker.com/build/building/multi-stage/">documentation</a>
515
+ for more details).</p>
516
+ <p>The key line is the <code>COPY</code> command, which specifies that
517
+ the contents of <code>/project</code> directory from the
518
+ <code>base</code> image are copied into the <code>/project</code>
519
+ directory of this image.</p>
520
+ <p>Any commands that will change frequently across builds could be
521
+ included below the <code>COPY</code> command. If only this code
522
+ associated with the second stage build is updated then
523
+ <code>renv::restore()</code> will not be called again at build time.
524
+ Instead, the layers associated with the <code>base</code> image will be
525
+ loaded from Docker’s cache, thereby saving significant time in build
526
+ process.</p>
527
+ <p>In fact, <code>renv::restore()</code> will only be called when the
528
+ <code>base</code> image needs to be rebuilt (e.g., when changes are made
529
+ to <code>renv.lock</code>). Docker’s cache system is generally good at
530
+ understanding the dependencies of images. However, if you find that the
531
+ <code>base</code> image is not updating as expected, it is possible to
532
+ manually enforce a clean build by including the <code>--no-cache</code>
533
+ option in the call to <code>docker build</code>.</p>
534
+ </div>
535
+ <div id="dynamically-provisioning-r-libraries-with-renv" class="section level3">
536
+ <h3>Dynamically Provisioning R Libraries with renv</h3>
537
+ <p>However, on occasion, one will have multiple applications built from
538
+ a single base image, but each application will have its own independent
539
+ R package requirements. In this case, rather than including the package
540
+ dependencies in the image itself, it would be preferable for each
541
+ container to provision its own library at runtime, based on that
542
+ application’s <code>renv.lock</code> lockfile.</p>
543
+ <p>In effect, this is as simple as ensuring that
544
+ <code>renv::restore()</code> happens at container runtime, rather than
545
+ image build time. However, on its own, <code>renv::restore()</code> is
546
+ slow – it needs to download and install packages, which could take
547
+ prohibitively long if an application needs to be run repeatedly.</p>
548
+ <p>The renv package cache can be used to help ameliorate this issue.
549
+ When the cache is enabled, whenever renv attempts to install or restore
550
+ an R package, it first checks to see whether that package is already
551
+ available within the renv cache. If it is, that instance of the package
552
+ is linked into the project library. Otherwise, the package is first
553
+ installed into the renv cache, and then that newly-installed copy is
554
+ linked for use in the project.</p>
555
+ <p>In effect, if the renv cache is available, you should only need to
556
+ pay the cost of package installation once – after that, the
557
+ newly-installed package will be available for re-use across different
558
+ projects. At the same time, each project’s library will remain
559
+ independent and isolated from one another, so installing a package
560
+ within one container won’t affect another container.</p>
561
+ <p>However, by default, each Docker container will have its own
562
+ independent filesystem. Ideally, we’d like for <em>all</em> containers
563
+ launched from a particular image to have access to the same renv cache.
564
+ To accomplish this, we’ll have to tell each container to use an renv
565
+ cache located on a shared mount.</p>
566
+ <p>In sum, if we’d like to allow for runtime provisioning of R package
567
+ dependencies, we will need to ensure the renv cache is located on a
568
+ shared volume, which is visible to any containers launched. We will
569
+ accomplish this by:</p>
570
+ <ol style="list-style-type: decimal">
571
+ <li><p>Setting the <code>RENV_PATHS_CACHE</code> environment variable,
572
+ to tell the instance of renv running in each container where the global
573
+ cache lives;</p></li>
574
+ <li><p>Telling Docker to mount some filesystem location from the host
575
+ filesystem, at some location (<code>RENV_PATHS_CACHE_HOST</code>), to a
576
+ container-specific location
577
+ (<code>RENV_PATHS_CACHE_CONTAINER</code>).</p></li>
578
+ </ol>
579
+ <p>For example, if you had a container running a Shiny application:</p>
580
+ <div class="sourceCode" id="cb10"><pre class="sourceCode dockerfile"><code class="sourceCode dockerfile"><span id="cb10-1"><a href="#cb10-1" tabindex="-1"></a><span class="co"># the location of the renv cache on the host machine</span></span>
581
+ <span id="cb10-2"><a href="#cb10-2" tabindex="-1"></a>RENV_PATHS_CACHE_HOST=/opt/local/renv/cache</span>
582
+ <span id="cb10-3"><a href="#cb10-3" tabindex="-1"></a></span>
583
+ <span id="cb10-4"><a href="#cb10-4" tabindex="-1"></a><span class="co"># where the cache should be mounted in the container</span></span>
584
+ <span id="cb10-5"><a href="#cb10-5" tabindex="-1"></a>RENV_PATHS_CACHE_CONTAINER=/renv/cache</span>
585
+ <span id="cb10-6"><a href="#cb10-6" tabindex="-1"></a></span>
586
+ <span id="cb10-7"><a href="#cb10-7" tabindex="-1"></a><span class="co"># run the container with the host cache mounted in the container</span></span>
587
+ <span id="cb10-8"><a href="#cb10-8" tabindex="-1"></a>docker run --rm <span class="op">\</span></span>
588
+ <span id="cb10-9"><a href="#cb10-9" tabindex="-1"></a> -e <span class="st">&quot;RENV_PATHS_CACHE=${RENV_PATHS_CACHE_CONTAINER}&quot;</span> <span class="op">\</span></span>
589
+ <span id="cb10-10"><a href="#cb10-10" tabindex="-1"></a> -v <span class="st">&quot;${RENV_PATHS_CACHE_HOST}:${RENV_PATHS_CACHE_CONTAINER}&quot;</span> <span class="op">\</span></span>
590
+ <span id="cb10-11"><a href="#cb10-11" tabindex="-1"></a> -p 14618:14618 <span class="op">\</span></span>
591
+ <span id="cb10-12"><a href="#cb10-12" tabindex="-1"></a> R -s -e <span class="st">&#39;renv::restore(); shiny::runApp(host = &quot;0.0.0.0&quot;, port = 14618)&#39;</span></span></code></pre></div>
592
+ <p>Note that the invocation above assumes that the project has already
593
+ been initialized either via calling <code>renv::init()</code> or by
594
+ copying the requisite <code>renv</code> project infrastructure. With
595
+ this, any calls to renv APIs within the created docker container will
596
+ have access to the mounted cache. The first time you run a container,
597
+ renv will likely need to populate the cache, and so some time will be
598
+ spent downloading and installing the required packages. Subsequent runs
599
+ will be much faster, as renv will be able to reuse the global package
600
+ cache.</p>
601
+ <p>The primary downside with this approach compared to the image-based
602
+ approach is that it requires you to modify how containers are created,
603
+ and requires a bit of extra orchestration in how containers are
604
+ launched. However, once the renv cache is active, newly-created
605
+ containers will launch very quickly, and a single image can then be used
606
+ as a base for a myriad of different containers and applications, each
607
+ with their own independent package dependencies.</p>
608
+ </div>
609
+ </div>
610
+ <div id="handling-the-renv-autoloader" class="section level2">
611
+ <h2>Handling the renv autoloader</h2>
612
+ <p>When <code>R</code> is launched within a project folder, the renv
613
+ auto-loader (if present) will attempt to download and install renv into
614
+ the project library if it’s not available. Depending on how your Docker
615
+ container is configured, this could fail. For example:</p>
616
+ <div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" tabindex="-1"></a><span class="ex">Error</span> installing renv:</span>
617
+ <span id="cb11-2"><a href="#cb11-2" tabindex="-1"></a><span class="ex">======================</span></span>
618
+ <span id="cb11-3"><a href="#cb11-3" tabindex="-1"></a><span class="ex">ERROR:</span> unable to create <span class="st">&#39;/usr/local/pipe/renv/library/master/R-4.0/x86_64-pc-linux-gnu/renv&#39;</span></span>
619
+ <span id="cb11-4"><a href="#cb11-4" tabindex="-1"></a><span class="ex">Warning</span> messages:</span>
620
+ <span id="cb11-5"><a href="#cb11-5" tabindex="-1"></a><span class="ex">1:</span> In system2<span class="er">(</span><span class="ex">r,</span> args, stdout = TRUE, stderr = TRUE<span class="kw">)</span> <span class="bu">:</span></span>
621
+ <span id="cb11-6"><a href="#cb11-6" tabindex="-1"></a> <span class="ex">running</span> command <span class="st">&#39;&#39;</span>/usr/lib/R/bin/R<span class="st">&#39; --vanilla CMD INSTALL -l &#39;</span>renv/library/master/R-4.0/x86_64-pc-linux-gnu<span class="st">&#39; &#39;</span>/tmp/RtmpwM7ooh/renv_0.12.2.tar.gz<span class="st">&#39; 2&gt;&amp;1&#39;</span> had status 1</span>
622
+ <span id="cb11-7"><a href="#cb11-7" tabindex="-1"></a><span class="ex">2:</span> Failed to find an renv installation: the project will not be loaded.</span>
623
+ <span id="cb11-8"><a href="#cb11-8" tabindex="-1"></a><span class="ex">Use</span> <span class="kw">`</span><span class="fu">renv::activate()</span><span class="kw">`</span> to re-initialize the project.</span></code></pre></div>
624
+ <p>Bootstrapping renv into the project library might be unnecessary for
625
+ you. If that is the case, then you can avoid this behavior by launching
626
+ R with the <code>--vanilla</code> flag set; for example:</p>
627
+ <div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" tabindex="-1"></a><span class="ex">R</span> <span class="at">--vanilla</span> <span class="at">-s</span> <span class="at">-e</span> <span class="st">&#39;renv::restore()&#39;</span></span></code></pre></div>
628
+ </div>
629
+
630
+
631
+
632
+ <!-- code folding -->
633
+
634
+
635
+ <!-- dynamically load mathjax for compatibility with self-contained -->
636
+ <script>
637
+ (function () {
638
+ var script = document.createElement("script");
639
+ script.type = "text/javascript";
640
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
641
+ document.getElementsByTagName("head")[0].appendChild(script);
642
+ })();
643
+ </script>
644
+
645
+ </body>
646
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.R ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## -----------------------------------------------------------------------------
9
+ # renv::settings$snapshot.type("all")
10
+
11
+ ## -----------------------------------------------------------------------------
12
+ # renv::settings$ignored.packages("<package>")
13
+
14
+ ## -----------------------------------------------------------------------------
15
+ # renv::settings$snapshot.type("explicit")
16
+
17
+ ## -----------------------------------------------------------------------------
18
+ # renv::install()
19
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.Rmd ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Frequently asked questions"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Frequently asked questions}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ ## Why isn't my package being snapshotted into the lockfile?
19
+
20
+ For a package to be recorded in the lockfile, it must be both:
21
+
22
+ 1. Installed your project library, *and*
23
+
24
+ 2. Used by the project, as determined by `renv::dependencies()`.
25
+
26
+ This ensures that only the packages you truly require for your project will enter the lockfile; development dependencies (e.g. `devtools`) normally should not.
27
+
28
+ So if you find a package is not entering the lockfile, check the output of `renv::dependencies()`.
29
+ If an expected package is not listed, it's likely because `dependencies()` uses static analysis and does not understand all of the different ways in which a package might be used in a project.
30
+ See the docs for more details.
31
+
32
+ ### Capturing all dependencies
33
+
34
+ If you'd instead prefer to capture *all* packages installed into your project library (and eschew dependency discovery altogether), you can do so with:
35
+
36
+ ```{r}
37
+ renv::settings$snapshot.type("all")
38
+ ```
39
+
40
+ Packages can also be explicitly ignored through a project setting, e.g. with:
41
+
42
+ ```{r}
43
+ renv::settings$ignored.packages("<package>")
44
+ ```
45
+
46
+ You might also want to double-check the set of ignored packages (`renv::settings$ignored.packages()`) and confirm that you aren't unintentionally ignoring a package you actually require.
47
+
48
+ See the documentation in `?snapshot` for more details.
49
+
50
+ ### Capturing explicit dependencies
51
+
52
+ If you'd like to explicitly declare which packages your project depends on, you can do so by telling renv to form "explicit" snapshots:
53
+
54
+ ```{r}
55
+ renv::settings$snapshot.type("explicit")
56
+ ```
57
+
58
+ In this mode, renv will only include packages which are explicitly listed in the project's `DESCRIPTION` file as dependencies.
59
+
60
+ ## How do I update the lockfile?
61
+
62
+ The most important thing to remember is that `renv::snapshot()` captures the state of your project at the point in time when `renv::snapshot()` was called.
63
+ In that sense, the "right" way to update the lockfile is to:
64
+
65
+ 1. Load the renv project,
66
+ 2. Make the changes you want; e.g. install packages; call `options(repos = <...>)`; ...
67
+ 3. Call `renv::snapshot()` to update the lockfile.
68
+
69
+ That said, you are also free to modify the `renv.lock` lockfile by hand if necessary; e.g. if you want to manually add / change repositories, change the version of a package used, and so on.
70
+ The `renv.lock` lockfile is a [JSON](https://www.json.org/json-en.html) file. A [JSON schema](https://json-schema.org/) is provided in the [renv repository](https://github.com/rstudio/renv/tree/main/inst/schema).
71
+
72
+ The main downside to editing a package record in the lockfile directly is that you won't be able to provide a `Hash` for that package, and so renv won't be able to use its global package cache when installing that package.
73
+
74
+ ## How should I handle development dependencies?
75
+
76
+ This is related to the above question: by design, `renv.lock` normally only captures build-time or deploy-time dependencies; it may not capture the packages that you use in iterative workflows (e.g. `devtools`).
77
+ However, you may want some way of still ensuring these development dependencies get installed when trying to restore a project library.
78
+
79
+ For cases like these, we recommend tracking these packages in a project DESCRIPTION file; typically, within the `Suggests:` field.
80
+ Then, you can execute:
81
+
82
+ ```{r}
83
+ renv::install()
84
+ ```
85
+
86
+ to request that renv install the packages as described in the DESCRIPTION file.
87
+ In addition, the `Remotes:` fields will be parsed and used, to ensure packages are installed from their declared remote source as appropriate.
88
+
89
+ ## I'm returning to an older renv project. What do I do?
90
+
91
+ Suppose you were using renv to manage an older project's dependencies.
92
+ You have an older lockfile, capturing the dependencies in use when you were last working with that project.
93
+ You now need to resume work on this project -- what do you do?
94
+
95
+ The answer depends on how exactly you want to use the project.
96
+ Do you want to treat it as a "time capsule", with dependencies frozen in time?
97
+ Or are the dependencies in this project fluid, and you are primarily using renv just for isolation of project dependencies?
98
+
99
+ For time capsules, use `renv::restore()` to reinstall the exact packages as declared in the project lockfile `renv.lock`.
100
+ You may also need to find and install the older version of R used previously with that project, unless your intention is to upgrade R.
101
+
102
+ For projects with fluid dependencies, call `renv::update()` to get the latest versions of the dependencies.
103
+ Once you've verified that the code still works (or made the changes needed to get it working), call `renv::snapshot()` to record the latest versions.
104
+
105
+ You can also take a more managed approach, that's somewhat in between the two extremes:
106
+
107
+ 1. Use `renv::restore()` to restore the project state as defined in the lockfile.
108
+
109
+ 2. Install and update packages deliberately with `renv::install()` and friends.
110
+
111
+ 3. Verify your code works, then call `renv::snapshot()` to update the new lockfile.
112
+
113
+ ## Why are package downloads failing?
114
+
115
+ Some issues ultimately boil down to a lack of connectivity between your machine and the R package repositories and remote sources you are trying to use.
116
+ If you are working in a corporate environment, it may be worth confirming whether you have a corporate proxy in place inhibiting internet access, or whether R and renv need to be configured in a way compatible with your working environment.
117
+ This is often true on Windows machines in enterprise environments, where the default "wininet" download method may work more reliably than others.
118
+ Learn more in `vignette("package-install")`.
119
+
120
+ In addition, note that renv places shims on the R search path that re-routes calls from `install.packages()` to `renv::install()`.
121
+ If you need to bypass these shims, you can use `utils::install.packages(<...>)`; that is, with the call to `install.packages()` explicitly qualified with the package `utils::`.
122
+ See `?renv::load` more details.
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/faq.html ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Frequently asked questions</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Frequently asked questions</h1>
341
+
342
+
343
+
344
+ <div id="why-isnt-my-package-being-snapshotted-into-the-lockfile" class="section level2">
345
+ <h2>Why isn’t my package being snapshotted into the lockfile?</h2>
346
+ <p>For a package to be recorded in the lockfile, it must be both:</p>
347
+ <ol style="list-style-type: decimal">
348
+ <li><p>Installed your project library, <em>and</em></p></li>
349
+ <li><p>Used by the project, as determined by
350
+ <code>renv::dependencies()</code>.</p></li>
351
+ </ol>
352
+ <p>This ensures that only the packages you truly require for your
353
+ project will enter the lockfile; development dependencies
354
+ (e.g. <code>devtools</code>) normally should not.</p>
355
+ <p>So if you find a package is not entering the lockfile, check the
356
+ output of <code>renv::dependencies()</code>. If an expected package is
357
+ not listed, it’s likely because <code>dependencies()</code> uses static
358
+ analysis and does not understand all of the different ways in which a
359
+ package might be used in a project. See the docs for more details.</p>
360
+ <div id="capturing-all-dependencies" class="section level3">
361
+ <h3>Capturing all dependencies</h3>
362
+ <p>If you’d instead prefer to capture <em>all</em> packages installed
363
+ into your project library (and eschew dependency discovery altogether),
364
+ you can do so with:</p>
365
+ <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a>renv<span class="sc">::</span>settings<span class="sc">$</span><span class="fu">snapshot.type</span>(<span class="st">&quot;all&quot;</span>)</span></code></pre></div>
366
+ <p>Packages can also be explicitly ignored through a project setting,
367
+ e.g. with:</p>
368
+ <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a>renv<span class="sc">::</span>settings<span class="sc">$</span><span class="fu">ignored.packages</span>(<span class="st">&quot;&lt;package&gt;&quot;</span>)</span></code></pre></div>
369
+ <p>You might also want to double-check the set of ignored packages
370
+ (<code>renv::settings$ignored.packages()</code>) and confirm that you
371
+ aren’t unintentionally ignoring a package you actually require.</p>
372
+ <p>See the documentation in <code>?snapshot</code> for more details.</p>
373
+ </div>
374
+ <div id="capturing-explicit-dependencies" class="section level3">
375
+ <h3>Capturing explicit dependencies</h3>
376
+ <p>If you’d like to explicitly declare which packages your project
377
+ depends on, you can do so by telling renv to form “explicit”
378
+ snapshots:</p>
379
+ <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a>renv<span class="sc">::</span>settings<span class="sc">$</span><span class="fu">snapshot.type</span>(<span class="st">&quot;explicit&quot;</span>)</span></code></pre></div>
380
+ <p>In this mode, renv will only include packages which are explicitly
381
+ listed in the project’s <code>DESCRIPTION</code> file as
382
+ dependencies.</p>
383
+ </div>
384
+ </div>
385
+ <div id="how-do-i-update-the-lockfile" class="section level2">
386
+ <h2>How do I update the lockfile?</h2>
387
+ <p>The most important thing to remember is that
388
+ <code>renv::snapshot()</code> captures the state of your project at the
389
+ point in time when <code>renv::snapshot()</code> was called. In that
390
+ sense, the “right” way to update the lockfile is to:</p>
391
+ <ol style="list-style-type: decimal">
392
+ <li>Load the renv project,</li>
393
+ <li>Make the changes you want; e.g. install packages; call
394
+ <code>options(repos = &lt;...&gt;)</code>; …</li>
395
+ <li>Call <code>renv::snapshot()</code> to update the lockfile.</li>
396
+ </ol>
397
+ <p>That said, you are also free to modify the <code>renv.lock</code>
398
+ lockfile by hand if necessary; e.g. if you want to manually add / change
399
+ repositories, change the version of a package used, and so on. The
400
+ <code>renv.lock</code> lockfile is a <a href="https://www.json.org/json-en.html">JSON</a> file. A <a href="https://json-schema.org/">JSON schema</a> is provided in the <a href="https://github.com/rstudio/renv/tree/main/inst/schema">renv
401
+ repository</a>.</p>
402
+ <p>The main downside to editing a package record in the lockfile
403
+ directly is that you won’t be able to provide a <code>Hash</code> for
404
+ that package, and so renv won’t be able to use its global package cache
405
+ when installing that package.</p>
406
+ </div>
407
+ <div id="how-should-i-handle-development-dependencies" class="section level2">
408
+ <h2>How should I handle development dependencies?</h2>
409
+ <p>This is related to the above question: by design,
410
+ <code>renv.lock</code> normally only captures build-time or deploy-time
411
+ dependencies; it may not capture the packages that you use in iterative
412
+ workflows (e.g. <code>devtools</code>). However, you may want some way
413
+ of still ensuring these development dependencies get installed when
414
+ trying to restore a project library.</p>
415
+ <p>For cases like these, we recommend tracking these packages in a
416
+ project DESCRIPTION file; typically, within the <code>Suggests:</code>
417
+ field. Then, you can execute:</p>
418
+ <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>()</span></code></pre></div>
419
+ <p>to request that renv install the packages as described in the
420
+ DESCRIPTION file. In addition, the <code>Remotes:</code> fields will be
421
+ parsed and used, to ensure packages are installed from their declared
422
+ remote source as appropriate.</p>
423
+ </div>
424
+ <div id="im-returning-to-an-older-renv-project.-what-do-i-do" class="section level2">
425
+ <h2>I’m returning to an older renv project. What do I do?</h2>
426
+ <p>Suppose you were using renv to manage an older project’s
427
+ dependencies. You have an older lockfile, capturing the dependencies in
428
+ use when you were last working with that project. You now need to resume
429
+ work on this project – what do you do?</p>
430
+ <p>The answer depends on how exactly you want to use the project. Do you
431
+ want to treat it as a “time capsule”, with dependencies frozen in time?
432
+ Or are the dependencies in this project fluid, and you are primarily
433
+ using renv just for isolation of project dependencies?</p>
434
+ <p>For time capsules, use <code>renv::restore()</code> to reinstall the
435
+ exact packages as declared in the project lockfile
436
+ <code>renv.lock</code>. You may also need to find and install the older
437
+ version of R used previously with that project, unless your intention is
438
+ to upgrade R.</p>
439
+ <p>For projects with fluid dependencies, call
440
+ <code>renv::update()</code> to get the latest versions of the
441
+ dependencies. Once you’ve verified that the code still works (or made
442
+ the changes needed to get it working), call
443
+ <code>renv::snapshot()</code> to record the latest versions.</p>
444
+ <p>You can also take a more managed approach, that’s somewhat in between
445
+ the two extremes:</p>
446
+ <ol style="list-style-type: decimal">
447
+ <li><p>Use <code>renv::restore()</code> to restore the project state as
448
+ defined in the lockfile.</p></li>
449
+ <li><p>Install and update packages deliberately with
450
+ <code>renv::install()</code> and friends.</p></li>
451
+ <li><p>Verify your code works, then call <code>renv::snapshot()</code>
452
+ to update the new lockfile.</p></li>
453
+ </ol>
454
+ </div>
455
+ <div id="why-are-package-downloads-failing" class="section level2">
456
+ <h2>Why are package downloads failing?</h2>
457
+ <p>Some issues ultimately boil down to a lack of connectivity between
458
+ your machine and the R package repositories and remote sources you are
459
+ trying to use. If you are working in a corporate environment, it may be
460
+ worth confirming whether you have a corporate proxy in place inhibiting
461
+ internet access, or whether R and renv need to be configured in a way
462
+ compatible with your working environment. This is often true on Windows
463
+ machines in enterprise environments, where the default “wininet”
464
+ download method may work more reliably than others. Learn more in
465
+ <code>vignette(&quot;package-install&quot;)</code>.</p>
466
+ <p>In addition, note that renv places shims on the R search path that
467
+ re-routes calls from <code>install.packages()</code> to
468
+ <code>renv::install()</code>. If you need to bypass these shims, you can
469
+ use <code>utils::install.packages(&lt;...&gt;)</code>; that is, with the
470
+ call to <code>install.packages()</code> explicitly qualified with the
471
+ package <code>utils::</code>. See <code>?renv::load</code> more
472
+ details.</p>
473
+ </div>
474
+
475
+
476
+
477
+ <!-- code folding -->
478
+
479
+
480
+ <!-- dynamically load mathjax for compatibility with self-contained -->
481
+ <script>
482
+ (function () {
483
+ var script = document.createElement("script");
484
+ script.type = "text/javascript";
485
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
486
+ document.getElementsByTagName("head")[0].appendChild(script);
487
+ })();
488
+ </script>
489
+
490
+ </body>
491
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/index.html ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head><title>R: Vignettes and other documentation</title>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
6
+ <link rel="stylesheet" type="text/css" href="/doc/html/R.css" />
7
+ </head><body><div class="container">
8
+ <h1> Vignettes and other documentation
9
+ <img class="toplogo" src="/doc/html/Rlogo.svg" alt="[R logo]" />
10
+ </h1>
11
+ <hr/>
12
+ <div style="text-align: center;">
13
+ <a href="/doc/html/index.html"><img class="arrow" src="/doc/html/up.jpg" alt="[Top]" /></a>
14
+ </div>
15
+ <h2>Vignettes from package 'renv'</h2>
16
+ <table style="width: 100%;">
17
+ <col style="width: 22%;" />
18
+ <col style="width: 2%;" />
19
+ <col style="width: 50%;" />
20
+ <col style="width: 8%;" />
21
+ <col style="width: 8%;" />
22
+ <col style="width: 8%;" />
23
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/ci.html">renv::ci</a></td>
24
+ <td></td><td style="vertical-align: top;">Using renv with continuous integration</td>
25
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/ci.html">HTML</a></td>
26
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/ci.Rmd">source</a></td>
27
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/ci.R">R code</a></td></tr>
28
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/docker.html">renv::docker</a></td>
29
+ <td></td><td style="vertical-align: top;">Using renv with Docker</td>
30
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/docker.html">HTML</a></td>
31
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/docker.Rmd">source</a></td>
32
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/docker.R">R code</a></td></tr>
33
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/faq.html">renv::faq</a></td>
34
+ <td></td><td style="vertical-align: top;">Frequently asked questions</td>
35
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/faq.html">HTML</a></td>
36
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/faq.Rmd">source</a></td>
37
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/faq.R">R code</a></td></tr>
38
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/package-install.html">renv::package-install</a></td>
39
+ <td></td><td style="vertical-align: top;">Installing packages</td>
40
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/package-install.html">HTML</a></td>
41
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/package-install.Rmd">source</a></td>
42
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/package-install.R">R code</a></td></tr>
43
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/package-sources.html">renv::package-sources</a></td>
44
+ <td></td><td style="vertical-align: top;">Package sources</td>
45
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/package-sources.html">HTML</a></td>
46
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/package-sources.Rmd">source</a></td>
47
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/package-sources.R">R code</a></td></tr>
48
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/packages.html">renv::packages</a></td>
49
+ <td></td><td style="vertical-align: top;">Package development</td>
50
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/packages.html">HTML</a></td>
51
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/packages.Rmd">source</a></td>
52
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/packages.R">R code</a></td></tr>
53
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/packrat.html">renv::packrat</a></td>
54
+ <td></td><td style="vertical-align: top;">packrat vs. renv</td>
55
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/packrat.html">HTML</a></td>
56
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/packrat.Rmd">source</a></td>
57
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/packrat.R">R code</a></td></tr>
58
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/profiles.html">renv::profiles</a></td>
59
+ <td></td><td style="vertical-align: top;">Project profiles</td>
60
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/profiles.html">HTML</a></td>
61
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/profiles.Rmd">source</a></td>
62
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/profiles.R">R code</a></td></tr>
63
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/python.html">renv::python</a></td>
64
+ <td></td><td style="vertical-align: top;">Using Python with renv</td>
65
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/python.html">HTML</a></td>
66
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/python.Rmd">source</a></td>
67
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/python.R">R code</a></td></tr>
68
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/renv.html">renv::renv</a></td>
69
+ <td></td><td style="vertical-align: top;">Introduction to renv</td>
70
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/renv.html">HTML</a></td>
71
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/renv.Rmd">source</a></td>
72
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/renv.R">R code</a></td></tr>
73
+ <tr><td style="text-align: right; vertical-align: top;"><a href="../../../library/renv/doc/rsconnect.html">renv::rsconnect</a></td>
74
+ <td></td><td style="vertical-align: top;">Using renv with Posit Connect</td>
75
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/rsconnect.html">HTML</a></td>
76
+ <td style="vertical-align: top;"><a href="../../../library/renv/doc/rsconnect.Rmd">source</a></td>
77
+ <td style="vertical-align: top; white-space: nowrap"><a href="../../../library/renv/doc/rsconnect.R">R code</a></td></tr>
78
+ </table>
79
+ </div></body></html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.R ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## -----------------------------------------------------------------------------
9
+ # # restore packages from the lockfile, bypassing the cache
10
+ # renv::restore(rebuild = TRUE)
11
+ #
12
+ # # re-install a package
13
+ # renv::install("<package>", rebuild = TRUE)
14
+ #
15
+ # # rebuild all packages in the project
16
+ # renv::rebuild()
17
+
18
+ ## -----------------------------------------------------------------------------
19
+ # # installation of RNetCDF may require us to set include paths for netcdf
20
+ # configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2")
21
+ # options(configure.args = configure.args)
22
+ # renv::install("RNetCDF")
23
+
24
+ ## -----------------------------------------------------------------------------
25
+ # options(
26
+ # configure.args.RNetCDF = "--with-netcdf-include=/usr/include/udunits2"
27
+ # )
28
+ # renv::install("RNetCDF")
29
+
30
+ ## -----------------------------------------------------------------------------
31
+ # # installation of R packages using the Windows Subsystem for Linux
32
+ # # may require the `--no-lock` flag to be set during install
33
+ # options(install.opts = "--no-lock")
34
+ # renv::install("xml2")
35
+ #
36
+ # # alternatively, you can set such options for specific packages with e.g.
37
+ # options(install.opts = list(xml2 = "--no-lock"))
38
+ # renv::install("xml2")
39
+
40
+ ## -----------------------------------------------------------------------------
41
+ # options(renv.download.override = utils::download.file)
42
+
43
+ ## -----------------------------------------------------------------------------
44
+ # # use Windows' internal download machinery
45
+ # Sys.setenv(RENV_DOWNLOAD_METHOD = "wininet")
46
+ #
47
+ # # use R's bundled libcurl implementation
48
+ # Sys.setenv(RENV_DOWNLOAD_METHOD = "libcurl")
49
+
50
+ ## -----------------------------------------------------------------------------
51
+ # getOption("download.file.method")
52
+
53
+ ## -----------------------------------------------------------------------------
54
+ # renv:::renv_download_method()
55
+
56
+ ## -----------------------------------------------------------------------------
57
+ # Sys.setenv(RENV_DOWNLOAD_METHOD = getOption("download.file.method"))
58
+
59
+ ## -----------------------------------------------------------------------------
60
+ # curl::ie_get_proxy_for_url()
61
+
62
+ ## -----------------------------------------------------------------------------
63
+ # # define a function providing authentication
64
+ # options(renv.auth = function(package, record) {
65
+ # if (package == "MyPackage")
66
+ # return(list(GITHUB_PAT = "<pat>"))
67
+ # })
68
+ #
69
+ # # use a named list directly
70
+ # options(renv.auth = list(
71
+ # MyPackage = list(GITHUB_PAT = "<pat>")
72
+ # ))
73
+ #
74
+ # # alternatively, set package-specific option
75
+ # # as a list
76
+ # options(renv.auth.MyPackage = list(GITHUB_PAT = "<pat>"))
77
+ # # as a function
78
+ # options(renv.auth.MyPackage = function(record) {
79
+ # list(GITHUB_PAT = "<pat>")
80
+ # })
81
+
82
+ ## -----------------------------------------------------------------------------
83
+ # renv::install("igraph=igraph/rigraph")
84
+
85
+ ## -----------------------------------------------------------------------------
86
+ # options(renv.download.headers = function(url) {
87
+ # if (grepl("^https://my/repository", url))
88
+ # return(c(Authorization = Sys.getenv("AUTH_HEADER")))
89
+ # })
90
+
91
+ ## -----------------------------------------------------------------------------
92
+ # options(renv.download.trace = TRUE)
93
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.Rmd ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Installing packages"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Installing packages}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ Package installation is an important part of renv.
19
+ This vignette gives you the details, starting with an overview of renv's cache, before going into various installation challenges around building from source and downloading with proxies or authentication.
20
+
21
+ ## Cache
22
+
23
+ One of renv's primary features is the global package cache, which shared across all projects.
24
+ The renv package cache provides two primary benefits:
25
+
26
+ 1. Installing and restoring packages is much faster, as renv can find and re-use previously installed packages from the cache.
27
+
28
+ 2. Projects take up less disk space, because each project doesn't need to contain it's own copy of every package.
29
+
30
+ When installing a package, renv installs into the global cache and then adds a symlink[^1] to that directory in the project library.
31
+ That way each renv project remains isolated from other projects on your system, but they can still re-use the same installed packages.
32
+
33
+ [^1]: Or junction points, on Windows.
34
+ Junction points are unfortunately not supported on Windows network shares; see [Hard links and junctions](https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions) for more details.
35
+
36
+ The process by which packages enter the cache is roughly as follows:
37
+
38
+ 1. Package installation is requested via e.g. `install.packages()`, or `renv::install()`, or as part of `renv::restore()`.
39
+
40
+ 2. If renv is able to find the requested version of the package in the cache, then that package is linked into the project library, and installation is complete.
41
+
42
+ 3. Otherwise, the package is downloaded and installed into the project library.
43
+
44
+ 4. After installation of the package has successfully completed, the package is then copied into the global package cache, and then symlinked into the project library.
45
+
46
+ In some cases, renv will be unable to directly link from the global package cache to your project library, e.g. if the package cache and your project library live on different disk volumes.
47
+ In such a case, renv will instead copy the package from the cache into the project library.
48
+ This is much slower, so is worth avoiding.
49
+
50
+ ### Cache location
51
+
52
+ You can find the location of the current cache with `renv::paths$cache()`.
53
+ By default, it will be in one of the following folders:
54
+
55
+ - Linux: `~/.cache/R/renv/cache`
56
+ - macOS: `~/Library/Caches/org.R-project.R/R/renv/cache`
57
+ - Windows: `%LOCALAPPDATA%/renv/cache`
58
+
59
+ If you'd like to share the package cache across multiple users, you can do so by setting the `RENV_PATHS_CACHE` environment variable to a shared path.
60
+ This variable should be set in an R startup file to make it apply to all R sessions.
61
+ While you can set it in a project-local `.Renviron`, or the user-level `~/.Renviron`, we generally recommend using the R installation's site-wide `Renviron.site` if you'd like to ensure the same cache path is visible to all users of R on a system.
62
+
63
+ You may also want to set `RENV_PATHS_CACHE` so that the global package cache can be stored on the same volume as the projects you normally work on.
64
+ This is especially important when working projects stored on a networked filesystem.
65
+
66
+ ### Multiple caches
67
+
68
+ It is also possible to configure renv to use multiple cache locations.
69
+ For example, you might want to make both a user-local package cache, as well as a global administrator-managed cache, visible within an renv project.
70
+ To do so, you can specify the paths to the cache separated with a `;` (or `:` on Unix if preferred).
71
+ For example:
72
+
73
+ ```sh
74
+ RENV_PATHS_CACHE=/path/to/local/cache;/path/to/global/cache
75
+ ```
76
+
77
+ In such a case, renv will iterate over the cache locations in order when trying to find a package, and newly-installed packages will enter the first writable cache path listed in `RENV_PATHS_CACHE`.
78
+
79
+ ### Shared cache locations
80
+
81
+ When the renv cache is enabled, if that cache is shared and visible to multiple users, then each of those users will have an opportunity to install packages into the renv cache.
82
+ However, some care must be taken to ensure that these packages can be used by different users in your environment:
83
+
84
+ 1. Packages copied into the cache may have [Access-control Lists](https://en.wikipedia.org/wiki/Access-control_list) (ACLs), which might prevent others from using packages that have been installed into the cache.
85
+ If this is the case, it's important that ACLs be set (or updated) on cache entries so that the cache is accessible to each user requiring access.
86
+ When deploying renv in an enterprise environment, the system administrator should take care to ensure ACLs (if any) allow users access to packages within the renv cache.
87
+
88
+ 2. By default, packages copied into the cache will remain "owned" by the user that requested installation of that package.
89
+ If you'd like renv to instead re-assign ownership of the cached package to a separate user account, you can set the `RENV_CACHE_USER` environment variable.
90
+ When set, renv will attempt to run `chown -R <package> <user>` to update cache ownership after the package has been copied into the cache.
91
+
92
+ ### Caveats
93
+
94
+ While we recommend enabling the cache by default, if you're having trouble with it, you can disable it by setting the project setting `renv::settings$use.cache(FALSE)`.
95
+ Doing this will ensure that packages are then installed into your project library directly, without attempting to link and use packages from the renv cache.
96
+
97
+ If you find a problematic package has entered the cache (for example, an installed package has become corrupted), that package can be removed with the `renv::purge()` function.
98
+ See the `?purge` documentation for caveats and things to be aware of when removing packages from the cache.
99
+
100
+ You can also force a package to be re-installed and re-cached with the following functions:
101
+
102
+ ```{r}
103
+ # restore packages from the lockfile, bypassing the cache
104
+ renv::restore(rebuild = TRUE)
105
+
106
+ # re-install a package
107
+ renv::install("<package>", rebuild = TRUE)
108
+
109
+ # rebuild all packages in the project
110
+ renv::rebuild()
111
+ ```
112
+
113
+ See each function's respective documentation for more details.
114
+
115
+ ## Building from source
116
+
117
+ Where possible, renv will install package binaries, but sometimes a binary is not available and you have to build from source.
118
+ Installation from source can be challenging for a few reasons:
119
+
120
+ 1. Your system will need to have a compatible compiler toolchain available.
121
+ In some cases, R packages may depend on C / C++ features that aren't available in an older system toolchain, especially in some older Linux enterprise environments.
122
+
123
+ 2. Your system will need requisite system libraries, as many R packages contain compiled C / C++ code that depend on and link to these packages.
124
+
125
+ <!-- TODO: renv::equip() for Linux + macOS; use sysreqsdb -->
126
+
127
+ ### Configure flags
128
+
129
+ Many `R` packages have a `configure` script that needs to be run to prepare the package for installation.
130
+ Arguments and environment variables can be passed through to those scripts in a manner similar to `install.packages()`.
131
+ In particular, the `R` options `configure.args` and `configure.vars` can be used to map package names to their appropriate configuration.
132
+ For example:
133
+
134
+ ```{r}
135
+ # installation of RNetCDF may require us to set include paths for netcdf
136
+ configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2")
137
+ options(configure.args = configure.args)
138
+ renv::install("RNetCDF")
139
+ ```
140
+
141
+ This could also be specified as, for example,
142
+
143
+ ```{r}
144
+ options(
145
+ configure.args.RNetCDF = "--with-netcdf-include=/usr/include/udunits2"
146
+ )
147
+ renv::install("RNetCDF")
148
+ ```
149
+
150
+ ### Install flags
151
+
152
+ Similarly, additional flags that should be passed to `R CMD INSTALL` can be set via the `install.opts` `R` option:
153
+
154
+ ```{r}
155
+ # installation of R packages using the Windows Subsystem for Linux
156
+ # may require the `--no-lock` flag to be set during install
157
+ options(install.opts = "--no-lock")
158
+ renv::install("xml2")
159
+
160
+ # alternatively, you can set such options for specific packages with e.g.
161
+ options(install.opts = list(xml2 = "--no-lock"))
162
+ renv::install("xml2")
163
+ ```
164
+
165
+ ### Vignettes
166
+
167
+ renv does not build vignettes when installing a package from source.
168
+ This is because vignettes often require suggested packages, and installing all suggested packages (particularly from source) can be arduous.
169
+
170
+ If you want to distribute vignettes for your own packages, we suggest creating your own repository of binaries, either with [R Universe](https://r-universe.dev/) (for publicly hosted packages on GitHub), with [Posit Package Manager](https://posit.co/products/enterprise/package-manager/), or with [drat](https://eddelbuettel.github.io/drat/).
171
+
172
+ ## Downloads
173
+
174
+ By default, renv uses [curl](https://curl.se/) for file downloads when available.
175
+ This allows renv to support a number of download features across multiple versions of R, including:
176
+
177
+ - Custom headers (used especially for authentication),
178
+ - Connection timeouts,
179
+ - Download retries on transient errors.
180
+
181
+ If `curl` is not available on your machine, it is highly recommended that you install it.
182
+ Newer versions of Windows 10 come with a bundled version of `curl.exe`; other users on Windows can use `renv::equip()` to download and install a recent copy of `curl`.
183
+ Newer versions of macOS come with a bundled version of `curl` that is adequate for usage with renv, and most Linux package managers have a modern version of `curl` available in their package repositories.
184
+ You can also configure which `curl` executable is used by setting the `RENV_CURL_EXECUTABLE` environment variable, if necessary.
185
+
186
+ `curl` downloads can be configured through renv's configuration settings -- see `?renv::config` for more details.
187
+
188
+ ### Alternative downloaders
189
+
190
+ If you've already configured R's downloader and would like to bypass renv's attempts to use `curl`, you can use the R option `renv.download.override`.
191
+ For example, executing:
192
+
193
+ ```{r}
194
+ options(renv.download.override = utils::download.file)
195
+ ```
196
+
197
+ would instruct renv to use R's own download machinery when attempting to download files from the internet (respecting the R options `download.file.method` and `download.file.extra` as appropriate).
198
+ Advanced users can also provide their own download function, provided its signature matches that of `utils::download.file()`.
199
+
200
+ You can also instruct renv to use a different download method by setting the `RENV_DOWNLOAD_METHOD` environment variable.
201
+ For example:
202
+
203
+ ```{r}
204
+ # use Windows' internal download machinery
205
+ Sys.setenv(RENV_DOWNLOAD_METHOD = "wininet")
206
+
207
+ # use R's bundled libcurl implementation
208
+ Sys.setenv(RENV_DOWNLOAD_METHOD = "libcurl")
209
+ ```
210
+
211
+ If you find that downloads work outside of renv projects, but not within renv projects, you may need to tell renv to use the same download file method that R has been configured to use.
212
+ You can check which download method R is currently configured to use with:
213
+
214
+ ```{r}
215
+ getOption("download.file.method")
216
+ ```
217
+
218
+ And the downloader currently used by renv can be queried with:
219
+
220
+ ```{r}
221
+ renv:::renv_download_method()
222
+ ```
223
+
224
+ You can force renv to use the same download method as R by setting:
225
+
226
+ ```{r}
227
+ Sys.setenv(RENV_DOWNLOAD_METHOD = getOption("download.file.method"))
228
+ ```
229
+
230
+ and, if necessary, you could also set this environment variable within e.g. your `~/.Renviron`, so that it is visible to all R sessions.
231
+ See `?Startup` for more details.
232
+
233
+ Note that other features (e.g. authentication) may not be supported when using an alternative download file method -- you will have to configure the downloader yourself if that is required.
234
+ See `?download.file` for more details.
235
+
236
+ ### Proxies
237
+
238
+ If your downloads need to go through a proxy server, then there are a variety of approaches you can take to make this work:
239
+
240
+ 1. Set the `http_proxy` and / or `https_proxy` environment variables.
241
+ These environment variables can contain the full URL to your proxy server, including a username + password if necessary.
242
+
243
+ 2. You can use a `.curlrc` (`_curlrc` on Windows) to provide information about the proxy server to be used.
244
+ This file should be placed in your home folder (see `Sys.getenv("HOME")`, or `Sys.getenv("R_USER")` on Windows); alternatively, you can set the `CURL_HOME` environment variable to point to a custom 'home' folder to be used by `curl` when resolving the runtime configuration file.
245
+ On Windows, you can also place your `_curlrc` in the same directory where the `curl.exe` binary is located.
246
+
247
+ See the curl documentation on [proxies](https://ec.haxx.se/usingcurl/proxies/) and [config files](https://ec.haxx.se/cmdline/configfile.html) for more details.
248
+
249
+ As an [example](https://github.com/rstudio/renv/issues/146), the following `_curlrc` works when using authentication with NTLM and SSPI on Windows:
250
+
251
+ ```sh
252
+ --proxy "your.proxy.dns:port"
253
+ --proxy-ntlm
254
+ --proxy-user ":"
255
+ --insecure
256
+ ```
257
+
258
+ The [curl](https://cran.r-project.org/package=curl) R package also has a helper:
259
+
260
+ ```{r}
261
+ curl::ie_get_proxy_for_url()
262
+ ```
263
+
264
+ which may be useful when attempting to discover this proxy address.
265
+
266
+ ### Authentication
267
+
268
+ Your project may make use of packages which are available from remote sources requiring some form of authentication to access -- for example, a GitHub enterprise server.
269
+ Usually, either a personal access token (PAT) or username + password combination is required for authentication.
270
+ renv is able to authenticate when downloading from such sources, using the same system as the [remotes](https://cran.r-project.org/package=remotes) package.
271
+ In particular, environment variables are used to record and transfer the required authentication information.
272
+
273
+ | **Remote Source** | **Authentication** |
274
+ |-------------------|-----------------------------------------|
275
+ | GitHub | `GITHUB_PAT` |
276
+ | GitLab | `GITLAB_PAT` |
277
+ | Bitbucket | `BITBUCKET_USER` + `BITBUCKET_PASSWORD` |
278
+ | Git Remotes | `GIT_PAT` / `GIT_USER` + `GIT_PASSWORD` |
279
+
280
+ These credentials can be stored in e.g. `.Renviron`, or can be set in your R session through other means as appropriate.
281
+
282
+ If you require custom authentication for different packages (for example, your project makes use of packages available on different GitHub enterprise servers), you can use the `renv.auth` R option to provide package-specific authentication settings.
283
+ `renv.auth` can either be a a named list associating package names with environment variables, or a function accepting a package name + record, and returning a list of environment variables.
284
+ For example:
285
+
286
+ ```{r}
287
+ # define a function providing authentication
288
+ options(renv.auth = function(package, record) {
289
+ if (package == "MyPackage")
290
+ return(list(GITHUB_PAT = "<pat>"))
291
+ })
292
+
293
+ # use a named list directly
294
+ options(renv.auth = list(
295
+ MyPackage = list(GITHUB_PAT = "<pat>")
296
+ ))
297
+
298
+ # alternatively, set package-specific option
299
+ # as a list
300
+ options(renv.auth.MyPackage = list(GITHUB_PAT = "<pat>"))
301
+ # as a function
302
+ options(renv.auth.MyPackage = function(record) {
303
+ list(GITHUB_PAT = "<pat>")
304
+ })
305
+ ```
306
+
307
+ For packages installed from Git remotes, renv will attempt to use `git` from the command line to download and restore the associated package.
308
+ Hence, it is recommended that authentication is done through SSH keys when possible.
309
+
310
+ Authentication may be required when resolving a package from a remote specification.
311
+ If the package name cannot be inferred directly from the remote, it can be supplied with a prefix of the form `<package>=`.
312
+ For example, the igraph package on GitHub at <https://github.com/igraph/rigraph> could be installed with:
313
+
314
+ ```{r}
315
+ renv::install("igraph=igraph/rigraph")
316
+ ```
317
+
318
+
319
+ #### Azure DevOps
320
+
321
+ Authentication with Azure DevOps may require credentials to be set in a slightly different way. In particular, you can use:
322
+
323
+ ```sh
324
+ GITHUB_USER = <username>
325
+ GITHUB_PASS = <password>
326
+ ```
327
+
328
+ replacing `<username>` and `<password>` as appropriate -- for example, your password may just be a PAT. See https://github.com/rstudio/renv/issues/1751 for more details.
329
+
330
+
331
+ #### Git and Personal Access Tokens
332
+
333
+ Rather than username + password, some remote Git repositories might require Personal Access Tokens (PATs) for authentication. Typically, such servers expect authentication credentials where:
334
+
335
+ - Your PAT is supplied as the username,
336
+ - Either an empty response, or the string `x-oauth-basic`, is provided as the password.
337
+
338
+ To help facilitate this, you can set:
339
+
340
+ ```sh
341
+ GIT_USER = <pat>
342
+ GIT_PASS = x-oauth-basic
343
+ ```
344
+
345
+ in an appropriate startup R file.
346
+
347
+
348
+ ### Custom headers
349
+
350
+ If you want to set arbitrary headers when downloading files using renv, you can do so using the `renv.download.headers` R option.
351
+ It should be a function that accepts a URL, and returns a named character vector indicating the headers which should be supplied when accessing that URL.
352
+
353
+ For example, suppose you have a package repository hosted at `https://my/repository`, and the credentials required to access that repository are stored in the `AUTH_HEADER` environment variable.
354
+ You could define `renv.download.headers` like so:
355
+
356
+ ```{r}
357
+ options(renv.download.headers = function(url) {
358
+ if (grepl("^https://my/repository", url))
359
+ return(c(Authorization = Sys.getenv("AUTH_HEADER")))
360
+ })
361
+ ```
362
+
363
+ With the above, renv will set the `Authorization` header whenever it attempts to download files from the repository at URL `https://my/repository`.
364
+
365
+ ### Debugging
366
+
367
+ If having problems with downloads, you can get more debugging information (including raw requests and responses) by setting:
368
+
369
+ ```{r}
370
+ options(renv.download.trace = TRUE)
371
+ ```
372
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-install.html ADDED
@@ -0,0 +1,782 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Installing packages</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Installing packages</h1>
341
+
342
+
343
+
344
+ <p>Package installation is an important part of renv. This vignette
345
+ gives you the details, starting with an overview of renv’s cache, before
346
+ going into various installation challenges around building from source
347
+ and downloading with proxies or authentication.</p>
348
+ <div id="cache" class="section level2">
349
+ <h2>Cache</h2>
350
+ <p>One of renv’s primary features is the global package cache, which
351
+ shared across all projects. The renv package cache provides two primary
352
+ benefits:</p>
353
+ <ol style="list-style-type: decimal">
354
+ <li><p>Installing and restoring packages is much faster, as renv can
355
+ find and re-use previously installed packages from the cache.</p></li>
356
+ <li><p>Projects take up less disk space, because each project doesn’t
357
+ need to contain it’s own copy of every package.</p></li>
358
+ </ol>
359
+ <p>When installing a package, renv installs into the global cache and
360
+ then adds a symlink<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> to that directory in the project library.
361
+ That way each renv project remains isolated from other projects on your
362
+ system, but they can still re-use the same installed packages.</p>
363
+ <p>The process by which packages enter the cache is roughly as
364
+ follows:</p>
365
+ <ol style="list-style-type: decimal">
366
+ <li><p>Package installation is requested via
367
+ e.g. <code>install.packages()</code>, or <code>renv::install()</code>,
368
+ or as part of <code>renv::restore()</code>.</p></li>
369
+ <li><p>If renv is able to find the requested version of the package in
370
+ the cache, then that package is linked into the project library, and
371
+ installation is complete.</p></li>
372
+ <li><p>Otherwise, the package is downloaded and installed into the
373
+ project library.</p></li>
374
+ <li><p>After installation of the package has successfully completed, the
375
+ package is then copied into the global package cache, and then symlinked
376
+ into the project library.</p></li>
377
+ </ol>
378
+ <p>In some cases, renv will be unable to directly link from the global
379
+ package cache to your project library, e.g. if the package cache and
380
+ your project library live on different disk volumes. In such a case,
381
+ renv will instead copy the package from the cache into the project
382
+ library. This is much slower, so is worth avoiding.</p>
383
+ <div id="cache-location" class="section level3">
384
+ <h3>Cache location</h3>
385
+ <p>You can find the location of the current cache with
386
+ <code>renv::paths$cache()</code>. By default, it will be in one of the
387
+ following folders:</p>
388
+ <ul>
389
+ <li>Linux: <code>~/.cache/R/renv/cache</code></li>
390
+ <li>macOS:
391
+ <code>~/Library/Caches/org.R-project.R/R/renv/cache</code></li>
392
+ <li>Windows: <code>%LOCALAPPDATA%/renv/cache</code></li>
393
+ </ul>
394
+ <p>If you’d like to share the package cache across multiple users, you
395
+ can do so by setting the <code>RENV_PATHS_CACHE</code> environment
396
+ variable to a shared path. This variable should be set in an R startup
397
+ file to make it apply to all R sessions. While you can set it in a
398
+ project-local <code>.Renviron</code>, or the user-level
399
+ <code>~/.Renviron</code>, we generally recommend using the R
400
+ installation’s site-wide <code>Renviron.site</code> if you’d like to
401
+ ensure the same cache path is visible to all users of R on a system.</p>
402
+ <p>You may also want to set <code>RENV_PATHS_CACHE</code> so that the
403
+ global package cache can be stored on the same volume as the projects
404
+ you normally work on. This is especially important when working projects
405
+ stored on a networked filesystem.</p>
406
+ </div>
407
+ <div id="multiple-caches" class="section level3">
408
+ <h3>Multiple caches</h3>
409
+ <p>It is also possible to configure renv to use multiple cache
410
+ locations. For example, you might want to make both a user-local package
411
+ cache, as well as a global administrator-managed cache, visible within
412
+ an renv project. To do so, you can specify the paths to the cache
413
+ separated with a <code>;</code> (or <code>:</code> on Unix if
414
+ preferred). For example:</p>
415
+ <div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="va">RENV_PATHS_CACHE</span><span class="op">=</span>/path/to/local/cache<span class="kw">;</span><span class="ex">/path/to/global/cache</span></span></code></pre></div>
416
+ <p>In such a case, renv will iterate over the cache locations in order
417
+ when trying to find a package, and newly-installed packages will enter
418
+ the first writable cache path listed in
419
+ <code>RENV_PATHS_CACHE</code>.</p>
420
+ </div>
421
+ <div id="shared-cache-locations" class="section level3">
422
+ <h3>Shared cache locations</h3>
423
+ <p>When the renv cache is enabled, if that cache is shared and visible
424
+ to multiple users, then each of those users will have an opportunity to
425
+ install packages into the renv cache. However, some care must be taken
426
+ to ensure that these packages can be used by different users in your
427
+ environment:</p>
428
+ <ol style="list-style-type: decimal">
429
+ <li><p>Packages copied into the cache may have <a href="https://en.wikipedia.org/wiki/Access-control_list">Access-control
430
+ Lists</a> (ACLs), which might prevent others from using packages that
431
+ have been installed into the cache. If this is the case, it’s important
432
+ that ACLs be set (or updated) on cache entries so that the cache is
433
+ accessible to each user requiring access. When deploying renv in an
434
+ enterprise environment, the system administrator should take care to
435
+ ensure ACLs (if any) allow users access to packages within the renv
436
+ cache.</p></li>
437
+ <li><p>By default, packages copied into the cache will remain “owned” by
438
+ the user that requested installation of that package. If you’d like renv
439
+ to instead re-assign ownership of the cached package to a separate user
440
+ account, you can set the <code>RENV_CACHE_USER</code> environment
441
+ variable. When set, renv will attempt to run
442
+ <code>chown -R &lt;package&gt; &lt;user&gt;</code> to update cache
443
+ ownership after the package has been copied into the cache.</p></li>
444
+ </ol>
445
+ </div>
446
+ <div id="caveats" class="section level3">
447
+ <h3>Caveats</h3>
448
+ <p>While we recommend enabling the cache by default, if you’re having
449
+ trouble with it, you can disable it by setting the project setting
450
+ <code>renv::settings$use.cache(FALSE)</code>. Doing this will ensure
451
+ that packages are then installed into your project library directly,
452
+ without attempting to link and use packages from the renv cache.</p>
453
+ <p>If you find a problematic package has entered the cache (for example,
454
+ an installed package has become corrupted), that package can be removed
455
+ with the <code>renv::purge()</code> function. See the
456
+ <code>?purge</code> documentation for caveats and things to be aware of
457
+ when removing packages from the cache.</p>
458
+ <p>You can also force a package to be re-installed and re-cached with
459
+ the following functions:</p>
460
+ <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># restore packages from the lockfile, bypassing the cache</span></span>
461
+ <span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">restore</span>(<span class="at">rebuild =</span> <span class="cn">TRUE</span>)</span>
462
+ <span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a></span>
463
+ <span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co"># re-install a package</span></span>
464
+ <span id="cb2-5"><a href="#cb2-5" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;&lt;package&gt;&quot;</span>, <span class="at">rebuild =</span> <span class="cn">TRUE</span>)</span>
465
+ <span id="cb2-6"><a href="#cb2-6" tabindex="-1"></a></span>
466
+ <span id="cb2-7"><a href="#cb2-7" tabindex="-1"></a><span class="co"># rebuild all packages in the project</span></span>
467
+ <span id="cb2-8"><a href="#cb2-8" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">rebuild</span>()</span></code></pre></div>
468
+ <p>See each function’s respective documentation for more details.</p>
469
+ </div>
470
+ </div>
471
+ <div id="building-from-source" class="section level2">
472
+ <h2>Building from source</h2>
473
+ <p>Where possible, renv will install package binaries, but sometimes a
474
+ binary is not available and you have to build from source. Installation
475
+ from source can be challenging for a few reasons:</p>
476
+ <ol style="list-style-type: decimal">
477
+ <li><p>Your system will need to have a compatible compiler toolchain
478
+ available. In some cases, R packages may depend on C / C++ features that
479
+ aren’t available in an older system toolchain, especially in some older
480
+ Linux enterprise environments.</p></li>
481
+ <li><p>Your system will need requisite system libraries, as many R
482
+ packages contain compiled C / C++ code that depend on and link to these
483
+ packages.</p></li>
484
+ </ol>
485
+ <!-- TODO: renv::equip() for Linux + macOS; use sysreqsdb -->
486
+ <div id="configure-flags" class="section level3">
487
+ <h3>Configure flags</h3>
488
+ <p>Many <code>R</code> packages have a <code>configure</code> script
489
+ that needs to be run to prepare the package for installation. Arguments
490
+ and environment variables can be passed through to those scripts in a
491
+ manner similar to <code>install.packages()</code>. In particular, the
492
+ <code>R</code> options <code>configure.args</code> and
493
+ <code>configure.vars</code> can be used to map package names to their
494
+ appropriate configuration. For example:</p>
495
+ <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="co"># installation of RNetCDF may require us to set include paths for netcdf</span></span>
496
+ <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a>configure.args <span class="ot">=</span> <span class="fu">c</span>(<span class="at">RNetCDF =</span> <span class="st">&quot;--with-netcdf-include=/usr/include/udunits2&quot;</span>)</span>
497
+ <span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a><span class="fu">options</span>(<span class="at">configure.args =</span> configure.args)</span>
498
+ <span id="cb3-4"><a href="#cb3-4" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;RNetCDF&quot;</span>)</span></code></pre></div>
499
+ <p>This could also be specified as, for example,</p>
500
+ <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="fu">options</span>(</span>
501
+ <span id="cb4-2"><a href="#cb4-2" tabindex="-1"></a> <span class="at">configure.args.RNetCDF =</span> <span class="st">&quot;--with-netcdf-include=/usr/include/udunits2&quot;</span></span>
502
+ <span id="cb4-3"><a href="#cb4-3" tabindex="-1"></a>)</span>
503
+ <span id="cb4-4"><a href="#cb4-4" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;RNetCDF&quot;</span>)</span></code></pre></div>
504
+ </div>
505
+ <div id="install-flags" class="section level3">
506
+ <h3>Install flags</h3>
507
+ <p>Similarly, additional flags that should be passed to
508
+ <code>R CMD INSTALL</code> can be set via the <code>install.opts</code>
509
+ <code>R</code> option:</p>
510
+ <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="co"># installation of R packages using the Windows Subsystem for Linux</span></span>
511
+ <span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a><span class="co"># may require the `--no-lock` flag to be set during install</span></span>
512
+ <span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a><span class="fu">options</span>(<span class="at">install.opts =</span> <span class="st">&quot;--no-lock&quot;</span>)</span>
513
+ <span id="cb5-4"><a href="#cb5-4" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;xml2&quot;</span>)</span>
514
+ <span id="cb5-5"><a href="#cb5-5" tabindex="-1"></a></span>
515
+ <span id="cb5-6"><a href="#cb5-6" tabindex="-1"></a><span class="co"># alternatively, you can set such options for specific packages with e.g.</span></span>
516
+ <span id="cb5-7"><a href="#cb5-7" tabindex="-1"></a><span class="fu">options</span>(<span class="at">install.opts =</span> <span class="fu">list</span>(<span class="at">xml2 =</span> <span class="st">&quot;--no-lock&quot;</span>))</span>
517
+ <span id="cb5-8"><a href="#cb5-8" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;xml2&quot;</span>)</span></code></pre></div>
518
+ </div>
519
+ <div id="vignettes" class="section level3">
520
+ <h3>Vignettes</h3>
521
+ <p>renv does not build vignettes when installing a package from source.
522
+ This is because vignettes often require suggested packages, and
523
+ installing all suggested packages (particularly from source) can be
524
+ arduous.</p>
525
+ <p>If you want to distribute vignettes for your own packages, we suggest
526
+ creating your own repository of binaries, either with <a href="https://r-universe.dev/">R Universe</a> (for publicly hosted
527
+ packages on GitHub), with <a href="https://posit.co/products/enterprise/package-manager/">Posit
528
+ Package Manager</a>, or with <a href="https://eddelbuettel.github.io/drat/">drat</a>.</p>
529
+ </div>
530
+ </div>
531
+ <div id="downloads" class="section level2">
532
+ <h2>Downloads</h2>
533
+ <p>By default, renv uses <a href="https://curl.se/">curl</a> for file
534
+ downloads when available. This allows renv to support a number of
535
+ download features across multiple versions of R, including:</p>
536
+ <ul>
537
+ <li>Custom headers (used especially for authentication),</li>
538
+ <li>Connection timeouts,</li>
539
+ <li>Download retries on transient errors.</li>
540
+ </ul>
541
+ <p>If <code>curl</code> is not available on your machine, it is highly
542
+ recommended that you install it. Newer versions of Windows 10 come with
543
+ a bundled version of <code>curl.exe</code>; other users on Windows can
544
+ use <code>renv::equip()</code> to download and install a recent copy of
545
+ <code>curl</code>. Newer versions of macOS come with a bundled version
546
+ of <code>curl</code> that is adequate for usage with renv, and most
547
+ Linux package managers have a modern version of <code>curl</code>
548
+ available in their package repositories. You can also configure which
549
+ <code>curl</code> executable is used by setting the
550
+ <code>RENV_CURL_EXECUTABLE</code> environment variable, if
551
+ necessary.</p>
552
+ <p><code>curl</code> downloads can be configured through renv’s
553
+ configuration settings – see <code>?renv::config</code> for more
554
+ details.</p>
555
+ <div id="alternative-downloaders" class="section level3">
556
+ <h3>Alternative downloaders</h3>
557
+ <p>If you’ve already configured R’s downloader and would like to bypass
558
+ renv’s attempts to use <code>curl</code>, you can use the R option
559
+ <code>renv.download.override</code>. For example, executing:</p>
560
+ <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.download.override =</span> utils<span class="sc">::</span>download.file)</span></code></pre></div>
561
+ <p>would instruct renv to use R’s own download machinery when attempting
562
+ to download files from the internet (respecting the R options
563
+ <code>download.file.method</code> and <code>download.file.extra</code>
564
+ as appropriate). Advanced users can also provide their own download
565
+ function, provided its signature matches that of
566
+ <code>utils::download.file()</code>.</p>
567
+ <p>You can also instruct renv to use a different download method by
568
+ setting the <code>RENV_DOWNLOAD_METHOD</code> environment variable. For
569
+ example:</p>
570
+ <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a><span class="co"># use Windows&#39; internal download machinery</span></span>
571
+ <span id="cb7-2"><a href="#cb7-2" tabindex="-1"></a><span class="fu">Sys.setenv</span>(<span class="at">RENV_DOWNLOAD_METHOD =</span> <span class="st">&quot;wininet&quot;</span>)</span>
572
+ <span id="cb7-3"><a href="#cb7-3" tabindex="-1"></a></span>
573
+ <span id="cb7-4"><a href="#cb7-4" tabindex="-1"></a><span class="co"># use R&#39;s bundled libcurl implementation</span></span>
574
+ <span id="cb7-5"><a href="#cb7-5" tabindex="-1"></a><span class="fu">Sys.setenv</span>(<span class="at">RENV_DOWNLOAD_METHOD =</span> <span class="st">&quot;libcurl&quot;</span>)</span></code></pre></div>
575
+ <p>If you find that downloads work outside of renv projects, but not
576
+ within renv projects, you may need to tell renv to use the same download
577
+ file method that R has been configured to use. You can check which
578
+ download method R is currently configured to use with:</p>
579
+ <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" tabindex="-1"></a><span class="fu">getOption</span>(<span class="st">&quot;download.file.method&quot;</span>)</span></code></pre></div>
580
+ <p>And the downloader currently used by renv can be queried with:</p>
581
+ <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" tabindex="-1"></a>renv<span class="sc">:::</span><span class="fu">renv_download_method</span>()</span></code></pre></div>
582
+ <p>You can force renv to use the same download method as R by
583
+ setting:</p>
584
+ <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" tabindex="-1"></a><span class="fu">Sys.setenv</span>(<span class="at">RENV_DOWNLOAD_METHOD =</span> <span class="fu">getOption</span>(<span class="st">&quot;download.file.method&quot;</span>))</span></code></pre></div>
585
+ <p>and, if necessary, you could also set this environment variable
586
+ within e.g. your <code>~/.Renviron</code>, so that it is visible to all
587
+ R sessions. See <code>?Startup</code> for more details.</p>
588
+ <p>Note that other features (e.g. authentication) may not be supported
589
+ when using an alternative download file method – you will have to
590
+ configure the downloader yourself if that is required. See
591
+ <code>?download.file</code> for more details.</p>
592
+ </div>
593
+ <div id="proxies" class="section level3">
594
+ <h3>Proxies</h3>
595
+ <p>If your downloads need to go through a proxy server, then there are a
596
+ variety of approaches you can take to make this work:</p>
597
+ <ol style="list-style-type: decimal">
598
+ <li><p>Set the <code>http_proxy</code> and / or <code>https_proxy</code>
599
+ environment variables. These environment variables can contain the full
600
+ URL to your proxy server, including a username + password if
601
+ necessary.</p></li>
602
+ <li><p>You can use a <code>.curlrc</code> (<code>_curlrc</code> on
603
+ Windows) to provide information about the proxy server to be used. This
604
+ file should be placed in your home folder (see
605
+ <code>Sys.getenv(&quot;HOME&quot;)</code>, or <code>Sys.getenv(&quot;R_USER&quot;)</code> on
606
+ Windows); alternatively, you can set the <code>CURL_HOME</code>
607
+ environment variable to point to a custom ‘home’ folder to be used by
608
+ <code>curl</code> when resolving the runtime configuration file. On
609
+ Windows, you can also place your <code>_curlrc</code> in the same
610
+ directory where the <code>curl.exe</code> binary is located.</p></li>
611
+ </ol>
612
+ <p>See the curl documentation on <a href="https://ec.haxx.se/usingcurl/proxies/">proxies</a> and <a href="https://ec.haxx.se/cmdline/configfile.html">config files</a> for
613
+ more details.</p>
614
+ <p>As an <a href="https://github.com/rstudio/renv/issues/146">example</a>, the
615
+ following <code>_curlrc</code> works when using authentication with NTLM
616
+ and SSPI on Windows:</p>
617
+ <div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" tabindex="-1"></a><span class="ex">--proxy</span> <span class="st">&quot;your.proxy.dns:port&quot;</span></span>
618
+ <span id="cb11-2"><a href="#cb11-2" tabindex="-1"></a><span class="ex">--proxy-ntlm</span></span>
619
+ <span id="cb11-3"><a href="#cb11-3" tabindex="-1"></a><span class="ex">--proxy-user</span> <span class="st">&quot;:&quot;</span></span>
620
+ <span id="cb11-4"><a href="#cb11-4" tabindex="-1"></a><span class="ex">--insecure</span></span></code></pre></div>
621
+ <p>The <a href="https://cran.r-project.org/package=curl">curl</a> R
622
+ package also has a helper:</p>
623
+ <div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" tabindex="-1"></a>curl<span class="sc">::</span><span class="fu">ie_get_proxy_for_url</span>()</span></code></pre></div>
624
+ <p>which may be useful when attempting to discover this proxy
625
+ address.</p>
626
+ </div>
627
+ <div id="authentication" class="section level3">
628
+ <h3>Authentication</h3>
629
+ <p>Your project may make use of packages which are available from remote
630
+ sources requiring some form of authentication to access – for example, a
631
+ GitHub enterprise server. Usually, either a personal access token (PAT)
632
+ or username + password combination is required for authentication. renv
633
+ is able to authenticate when downloading from such sources, using the
634
+ same system as the <a href="https://cran.r-project.org/package=remotes">remotes</a> package.
635
+ In particular, environment variables are used to record and transfer the
636
+ required authentication information.</p>
637
+ <table>
638
+ <thead>
639
+ <tr class="header">
640
+ <th><strong>Remote Source</strong></th>
641
+ <th><strong>Authentication</strong></th>
642
+ </tr>
643
+ </thead>
644
+ <tbody>
645
+ <tr class="odd">
646
+ <td>GitHub</td>
647
+ <td><code>GITHUB_PAT</code></td>
648
+ </tr>
649
+ <tr class="even">
650
+ <td>GitLab</td>
651
+ <td><code>GITLAB_PAT</code></td>
652
+ </tr>
653
+ <tr class="odd">
654
+ <td>Bitbucket</td>
655
+ <td><code>BITBUCKET_USER</code> + <code>BITBUCKET_PASSWORD</code></td>
656
+ </tr>
657
+ <tr class="even">
658
+ <td>Git Remotes</td>
659
+ <td><code>GIT_PAT</code> / <code>GIT_USER</code> +
660
+ <code>GIT_PASSWORD</code></td>
661
+ </tr>
662
+ </tbody>
663
+ </table>
664
+ <p>These credentials can be stored in e.g. <code>.Renviron</code>, or
665
+ can be set in your R session through other means as appropriate.</p>
666
+ <p>If you require custom authentication for different packages (for
667
+ example, your project makes use of packages available on different
668
+ GitHub enterprise servers), you can use the <code>renv.auth</code> R
669
+ option to provide package-specific authentication settings.
670
+ <code>renv.auth</code> can either be a a named list associating package
671
+ names with environment variables, or a function accepting a package name
672
+ + record, and returning a list of environment variables. For
673
+ example:</p>
674
+ <div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" tabindex="-1"></a><span class="co"># define a function providing authentication</span></span>
675
+ <span id="cb13-2"><a href="#cb13-2" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.auth =</span> <span class="cf">function</span>(package, record) {</span>
676
+ <span id="cb13-3"><a href="#cb13-3" tabindex="-1"></a> <span class="cf">if</span> (package <span class="sc">==</span> <span class="st">&quot;MyPackage&quot;</span>)</span>
677
+ <span id="cb13-4"><a href="#cb13-4" tabindex="-1"></a> <span class="fu">return</span>(<span class="fu">list</span>(<span class="at">GITHUB_PAT =</span> <span class="st">&quot;&lt;pat&gt;&quot;</span>))</span>
678
+ <span id="cb13-5"><a href="#cb13-5" tabindex="-1"></a>})</span>
679
+ <span id="cb13-6"><a href="#cb13-6" tabindex="-1"></a></span>
680
+ <span id="cb13-7"><a href="#cb13-7" tabindex="-1"></a><span class="co"># use a named list directly</span></span>
681
+ <span id="cb13-8"><a href="#cb13-8" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.auth =</span> <span class="fu">list</span>(</span>
682
+ <span id="cb13-9"><a href="#cb13-9" tabindex="-1"></a> <span class="at">MyPackage =</span> <span class="fu">list</span>(<span class="at">GITHUB_PAT =</span> <span class="st">&quot;&lt;pat&gt;&quot;</span>)</span>
683
+ <span id="cb13-10"><a href="#cb13-10" tabindex="-1"></a>))</span>
684
+ <span id="cb13-11"><a href="#cb13-11" tabindex="-1"></a></span>
685
+ <span id="cb13-12"><a href="#cb13-12" tabindex="-1"></a><span class="co"># alternatively, set package-specific option</span></span>
686
+ <span id="cb13-13"><a href="#cb13-13" tabindex="-1"></a><span class="co"># as a list</span></span>
687
+ <span id="cb13-14"><a href="#cb13-14" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.auth.MyPackage =</span> <span class="fu">list</span>(<span class="at">GITHUB_PAT =</span> <span class="st">&quot;&lt;pat&gt;&quot;</span>))</span>
688
+ <span id="cb13-15"><a href="#cb13-15" tabindex="-1"></a><span class="co"># as a function</span></span>
689
+ <span id="cb13-16"><a href="#cb13-16" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.auth.MyPackage =</span> <span class="cf">function</span>(record) {</span>
690
+ <span id="cb13-17"><a href="#cb13-17" tabindex="-1"></a> <span class="fu">list</span>(<span class="at">GITHUB_PAT =</span> <span class="st">&quot;&lt;pat&gt;&quot;</span>)</span>
691
+ <span id="cb13-18"><a href="#cb13-18" tabindex="-1"></a>})</span></code></pre></div>
692
+ <p>For packages installed from Git remotes, renv will attempt to use
693
+ <code>git</code> from the command line to download and restore the
694
+ associated package. Hence, it is recommended that authentication is done
695
+ through SSH keys when possible.</p>
696
+ <p>Authentication may be required when resolving a package from a remote
697
+ specification. If the package name cannot be inferred directly from the
698
+ remote, it can be supplied with a prefix of the form
699
+ <code>&lt;package&gt;=</code>. For example, the igraph package on GitHub
700
+ at <a href="https://github.com/igraph/rigraph" class="uri">https://github.com/igraph/rigraph</a> could be installed
701
+ with:</p>
702
+ <div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>(<span class="st">&quot;igraph=igraph/rigraph&quot;</span>)</span></code></pre></div>
703
+ <div id="azure-devops" class="section level4">
704
+ <h4>Azure DevOps</h4>
705
+ <p>Authentication with Azure DevOps may require credentials to be set in
706
+ a slightly different way. In particular, you can use:</p>
707
+ <div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" tabindex="-1"></a><span class="ex">GITHUB_USER</span> = <span class="op">&lt;</span>username<span class="op">&gt;</span></span>
708
+ <span id="cb15-2"><a href="#cb15-2" tabindex="-1"></a><span class="ex">GITHUB_PASS</span> = <span class="op">&lt;</span>password<span class="op">&gt;</span></span></code></pre></div>
709
+ <p>replacing <code>&lt;username&gt;</code> and
710
+ <code>&lt;password&gt;</code> as appropriate – for example, your
711
+ password may just be a PAT. See <a href="https://github.com/rstudio/renv/issues/1751" class="uri">https://github.com/rstudio/renv/issues/1751</a> for more
712
+ details.</p>
713
+ </div>
714
+ <div id="git-and-personal-access-tokens" class="section level4">
715
+ <h4>Git and Personal Access Tokens</h4>
716
+ <p>Rather than username + password, some remote Git repositories might
717
+ require Personal Access Tokens (PATs) for authentication. Typically,
718
+ such servers expect authentication credentials where:</p>
719
+ <ul>
720
+ <li>Your PAT is supplied as the username,</li>
721
+ <li>Either an empty response, or the string <code>x-oauth-basic</code>,
722
+ is provided as the password.</li>
723
+ </ul>
724
+ <p>To help facilitate this, you can set:</p>
725
+ <div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" tabindex="-1"></a><span class="ex">GIT_USER</span> = <span class="op">&lt;</span>pat<span class="op">&gt;</span></span>
726
+ <span id="cb16-2"><a href="#cb16-2" tabindex="-1"></a><span class="ex">GIT_PASS</span> = x-oauth-basic</span></code></pre></div>
727
+ <p>in an appropriate startup R file.</p>
728
+ </div>
729
+ </div>
730
+ <div id="custom-headers" class="section level3">
731
+ <h3>Custom headers</h3>
732
+ <p>If you want to set arbitrary headers when downloading files using
733
+ renv, you can do so using the <code>renv.download.headers</code> R
734
+ option. It should be a function that accepts a URL, and returns a named
735
+ character vector indicating the headers which should be supplied when
736
+ accessing that URL.</p>
737
+ <p>For example, suppose you have a package repository hosted at
738
+ <code>https://my/repository</code>, and the credentials required to
739
+ access that repository are stored in the <code>AUTH_HEADER</code>
740
+ environment variable. You could define
741
+ <code>renv.download.headers</code> like so:</p>
742
+ <div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.download.headers =</span> <span class="cf">function</span>(url) {</span>
743
+ <span id="cb17-2"><a href="#cb17-2" tabindex="-1"></a> <span class="cf">if</span> (<span class="fu">grepl</span>(<span class="st">&quot;^https://my/repository&quot;</span>, url))</span>
744
+ <span id="cb17-3"><a href="#cb17-3" tabindex="-1"></a> <span class="fu">return</span>(<span class="fu">c</span>(<span class="at">Authorization =</span> <span class="fu">Sys.getenv</span>(<span class="st">&quot;AUTH_HEADER&quot;</span>)))</span>
745
+ <span id="cb17-4"><a href="#cb17-4" tabindex="-1"></a>})</span></code></pre></div>
746
+ <p>With the above, renv will set the <code>Authorization</code> header
747
+ whenever it attempts to download files from the repository at URL
748
+ <code>https://my/repository</code>.</p>
749
+ </div>
750
+ <div id="debugging" class="section level3">
751
+ <h3>Debugging</h3>
752
+ <p>If having problems with downloads, you can get more debugging
753
+ information (including raw requests and responses) by setting:</p>
754
+ <div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.download.trace =</span> <span class="cn">TRUE</span>) </span></code></pre></div>
755
+ </div>
756
+ </div>
757
+ <div class="footnotes footnotes-end-of-document">
758
+ <hr />
759
+ <ol>
760
+ <li id="fn1"><p>Or junction points, on Windows. Junction points are
761
+ unfortunately not supported on Windows network shares; see <a href="https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions">Hard
762
+ links and junctions</a> for more details.<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
763
+ </ol>
764
+ </div>
765
+
766
+
767
+
768
+ <!-- code folding -->
769
+
770
+
771
+ <!-- dynamically load mathjax for compatibility with self-contained -->
772
+ <script>
773
+ (function () {
774
+ var script = document.createElement("script");
775
+ script.type = "text/javascript";
776
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
777
+ document.getElementsByTagName("head")[0].appendChild(script);
778
+ })();
779
+ </script>
780
+
781
+ </body>
782
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.R ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## ----setup--------------------------------------------------------------------
9
+ # library(renv)
10
+
11
+ ## -----------------------------------------------------------------------------
12
+ # repos <- c(CRAN = "https://cloud.r-project.org", WORK = "https://work.example.org")
13
+ # options(repos = repos)
14
+
15
+ ## -----------------------------------------------------------------------------
16
+ # # use the latest-available Bioconductor release
17
+ # renv::init(bioconductor = TRUE)
18
+ #
19
+ # # use a specific version of Bioconductor
20
+ # renv::init(bioconductor = "3.14")
21
+
22
+ ## -----------------------------------------------------------------------------
23
+ # renv::settings$bioconductor.version("3.14")
24
+
25
+ ## -----------------------------------------------------------------------------
26
+ # options(renv.bioconductor.repos = c(...))
27
+
28
+ ## -----------------------------------------------------------------------------
29
+ # renv:::renv_paths_cellar()
30
+
31
+ ## -----------------------------------------------------------------------------
32
+ # # please don't do this!
33
+ # `%>%` <- magrittr::`%>%`
34
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.Rmd ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Package sources"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Package sources}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ ```{r setup}
19
+ library(renv)
20
+ ```
21
+
22
+
23
+ # Package sources
24
+
25
+ renv uses an installed package's `DESCRIPTION` file to infer its source. For
26
+ example, packages installed from the CRAN repositories typically have the field:
27
+
28
+ ```sh
29
+ Repository: CRAN
30
+ ```
31
+
32
+ set, and renv takes this as a signal that the package was retrieved from CRAN.
33
+
34
+ ## Inferring package sources
35
+
36
+ The following fields are checked, in order, when inferring a package's source:
37
+
38
+ 1. The `RemoteType` field; typically written for packages installed by the
39
+ devtools, remotes and pak packages,
40
+
41
+ 1. The `Repository` field; for example, packages retrieved from CRAN will
42
+ typically have the `Repository: CRAN` field,
43
+
44
+ 1. The `biocViews` field; typically present for packages installed from the
45
+ Bioconductor repositories,
46
+
47
+ As a fallback, if renv is unable to determine a package's source from the
48
+ `DESCRIPTION` file directly, but a package of the same name is available in the
49
+ active R repositories (as specified in `getOption("repos")`), then the package
50
+ will be treated as though it was installed from an R package repository.
51
+
52
+ If all of the above methods fail, renv will finally check for a package
53
+ available from the _cellar_. The package cellar is typically used as an escape
54
+ hatch, for packages which do not have a well-defined remote source, or for
55
+ packages which might not be remotely accessible from your machine.
56
+
57
+
58
+ ## Unknown sources
59
+
60
+ If renv is unable to infer a package's source, it will inform you during
61
+ `renv::snapshot()` -- for example, if we attempted to snapshot a package
62
+ called `skeleton` with no known source:
63
+
64
+ ```r
65
+ > renv::snapshot()
66
+ The following package(s) were installed from an unknown source:
67
+
68
+ skeleton
69
+
70
+ renv may be unable to restore these packages in the future.
71
+ Consider reinstalling these packages from a known source (e.g. CRAN).
72
+
73
+ Do you want to proceed? [y/N]:
74
+ ```
75
+
76
+ While you can still create a lockfile with such packages, `restore()` will
77
+ likely fail unless you can ensure this package is installed through some
78
+ other mechanism.
79
+
80
+
81
+ ## Custom R package repositories
82
+
83
+ Custom and local R package repositories are supported as well. The only
84
+ requirement is that these repositories are set as part of the `repos` R
85
+ option, and that these repositories are named. For example, you might use:
86
+
87
+ ```{r}
88
+ repos <- c(CRAN = "https://cloud.r-project.org", WORK = "https://work.example.org")
89
+ options(repos = repos)
90
+ ```
91
+
92
+ to tell renv to work with both the official CRAN package repository, as well
93
+ as a package repository you have hosted and set up in your work environment.
94
+
95
+ ## Bioconductor
96
+
97
+
98
+ renv has been designed to work together as seamlessly as possible with
99
+ the [Bioconductor](https://bioconductor.org/) project. This vignette outlines
100
+ some of the extra steps that may be required when using renv with packages
101
+ obtained from Bioconductor.
102
+
103
+
104
+ ## Initializing a project
105
+
106
+ To initialize renv in a project using Bioconductor, you can pass the
107
+ `bioconductor` argument to `renv::init()`:
108
+
109
+ ```{r}
110
+ # use the latest-available Bioconductor release
111
+ renv::init(bioconductor = TRUE)
112
+
113
+ # use a specific version of Bioconductor
114
+ renv::init(bioconductor = "3.14")
115
+ ```
116
+
117
+ This will tell renv to activate the appropriate Bioconductor repositories,
118
+ and to use those repositories when attempting to restore packages.
119
+
120
+ ### Bioconductor releases
121
+
122
+ Bioconductor prepares different versions of its package repositories, for use
123
+ with different versions of R. The version of Bioconductor used within a
124
+ particular renv project is stored both as a project setting, and also within
125
+ the project lockfile. This allows you to "lock" a particular project to a
126
+ particular Bioconductor release, even as new Bioconductor releases are made
127
+ available for newer versions of R.
128
+
129
+ To set the version of Bioconductor used in a project, you can use:
130
+
131
+ ```{r}
132
+ renv::settings$bioconductor.version("3.14")
133
+ ```
134
+
135
+ If you later choose to upgrade R, you may need to upgrade the version
136
+ of Bioconductor used as well.
137
+
138
+ If you want to override the Bioconductor repositories used by renv, you can
139
+ also explicitly set the following option:
140
+
141
+ ```{r}
142
+ options(renv.bioconductor.repos = c(...))
143
+ ```
144
+
145
+
146
+ ## The package cellar
147
+
148
+ In some cases, your project may depend on R packages which are not available
149
+ from any external source, or that external source may not be accessible from the
150
+ machine calling `renv::restore()`. To help accommodate these scenarios, renv
151
+ allows you to prepare a package "cellar", to be used as an ad-hoc repository of
152
+ packages during restore. This allows you to provide package tarballs that can be
153
+ used to restore packages which cannot be retrieved from any other source.
154
+
155
+ The environment variable `RENV_PATHS_CELLAR` can be used to customize the
156
+ package cellar location. It should point to a directory containing package
157
+ binaries and sources, with a structure of the form:
158
+
159
+ - `${RENV_PATHS_CELLAR}/<package>_<version>.tar.gz`; or
160
+ - `${RENV_PATHS_CELLAR}/<package>/<package>_<version>.tar.gz`
161
+
162
+ Alternatively, you can also use a project-local cellar by placing your
163
+ packages within a folder located at `<project>/renv/cellar`. Note that this
164
+ folder does not exist by default; you must create it to opt-in.
165
+
166
+ - `<project>/renv/cellar/<package>_<version>.tar.gz`; or
167
+ - `<project>/renv/cellar/<package>/<package>_<version>.tar.gz`
168
+
169
+ As an example, if your project depended on a package `skeleton 1.0.0`, you could
170
+ place a tarball for this package in one of the following locations:
171
+
172
+ - `${RENV_PATHS_CELLAR}/skeleton_1.0.0.tar.gz`
173
+ - `${RENV_PATHS_CELLAR}/skeleton/skeleton_1.0.0.tar.gz`
174
+ - `<project>/renv/cellar/skeleton_1.0.0.tar.gz`; or
175
+ - `<project>/renv/cellar/skeleton/skeleton_1.0.0.tar.gz`
176
+
177
+ Once this is done, renv will consult these directories during future attempts
178
+ to restore your packages.
179
+
180
+ You can install a package from the cellar like any other package, i.e. `renv::install("skeleton")`.
181
+
182
+ During restore, if a compatible package is located within the cellar, that copy
183
+ of the package will be preferred even if that package might otherwise be
184
+ accessible from its associated remote source. For example, if `skeleton 1.0.0`
185
+ was also available on CRAN, `renv::restore()` would still use the tarball
186
+ available in the cellar rather than the version available from CRAN.
187
+
188
+ If you want to see what paths renv is using for the cellar, you can use:
189
+
190
+ ```{r}
191
+ renv:::renv_paths_cellar()
192
+ ```
193
+
194
+ See `?paths` for more details.
195
+
196
+ ### Explicit sources
197
+
198
+ You can also provide explicit source paths in the lockfile if desired. This is
199
+ most useful if you are building an renv lockfile "by hand", or need to tweak
200
+ an existing lockfile to point at a separate package for installation. For
201
+ example, you could have a package record in `renv.lock` of the form:
202
+
203
+ ```json
204
+ {
205
+ "Package": "skeleton",
206
+ "Version": "1.0.1",
207
+ "Source": "/mnt/r/pkg/skeleton_1.0.1.tar.gz"
208
+ }
209
+ ```
210
+
211
+ Packages should have the following extensions, depending on whether the archive
212
+ contains a binary copy of the package or the package sources:
213
+
214
+ | **Platform** | **Binary** | **Sources** |
215
+ | ------------ | ---------- | ----------- |
216
+ | Windows | `.zip` | `.tar.gz` |
217
+ | macOS | `.tgz` | `.tar.gz` |
218
+ | Linux | `.tar.gz` | `.tar.gz` |
219
+
220
+ Note that on Linux, both binaries and sources should have the `.tar.gz`
221
+ extension, but R and renv will handle this as appropriate during installation.
222
+
223
+
224
+ ## ABI compatibility
225
+
226
+ ABI compatibility issues can arise if different packages were built against
227
+ different versions of a shared dependency. For example, one package may have
228
+ been built against Rcpp 1.0.6, and another package might have been built against
229
+ Rcpp 1.0.7. However, because only one version of the Rcpp package can be loaded
230
+ at a time within an R session, mixing of these two packages might cause issues
231
+ either on load or at runtime depending on the version of Rcpp available.
232
+
233
+ It's worth emphasizing that this is not Rcpp's fault; a package built against
234
+ Rcpp 1.0.7 would reasonably expect newer APIs made available by that version of
235
+ the package would be available at runtime, and that contract would be violated
236
+ if an older version of Rcpp were installed in the project library. The challenge
237
+ for renv is that this build-time dependency is not clearly communicated to
238
+ renv; in general, it is not possible to know what packages (and their
239
+ versions) a particular package was built against.
240
+
241
+
242
+ ## Build-time dependencies
243
+
244
+ R packages might occasionally (and unintentionally) take a build-time
245
+ dependency on another R package -- for example, a package with the code:
246
+
247
+ ```{r}
248
+ # please don't do this!
249
+ `%>%` <- magrittr::`%>%`
250
+ ```
251
+
252
+ would take the version of `%>%` that was available from the version of magrittr
253
+ that was available at _build_ time, not the one available at _run_ time. This
254
+ could be problematic if, for example, an update to the magrittr package
255
+ changed in a way that made old definitions of `%>%` incompatible with newer
256
+ internal functions.
257
+
258
+ In general, it is a mistake for packages to take a build-time dependency on
259
+ exported objects from another package; rather, such objects should be imported
260
+ at runtime (using e.g. `importFrom()` in the package `NAMESPACE` file).
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/package-sources.html ADDED
@@ -0,0 +1,597 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Package sources</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Package sources</h1>
341
+
342
+
343
+
344
+ <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">library</span>(renv)</span></code></pre></div>
345
+ <div id="package-sources" class="section level1">
346
+ <h1>Package sources</h1>
347
+ <p>renv uses an installed package’s <code>DESCRIPTION</code> file to
348
+ infer its source. For example, packages installed from the CRAN
349
+ repositories typically have the field:</p>
350
+ <div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="ex">Repository:</span> CRAN</span></code></pre></div>
351
+ <p>set, and renv takes this as a signal that the package was retrieved
352
+ from CRAN.</p>
353
+ <div id="inferring-package-sources" class="section level2">
354
+ <h2>Inferring package sources</h2>
355
+ <p>The following fields are checked, in order, when inferring a
356
+ package’s source:</p>
357
+ <ol style="list-style-type: decimal">
358
+ <li><p>The <code>RemoteType</code> field; typically written for packages
359
+ installed by the devtools, remotes and pak packages,</p></li>
360
+ <li><p>The <code>Repository</code> field; for example, packages
361
+ retrieved from CRAN will typically have the
362
+ <code>Repository: CRAN</code> field,</p></li>
363
+ <li><p>The <code>biocViews</code> field; typically present for packages
364
+ installed from the Bioconductor repositories,</p></li>
365
+ </ol>
366
+ <p>As a fallback, if renv is unable to determine a package’s source from
367
+ the <code>DESCRIPTION</code> file directly, but a package of the same
368
+ name is available in the active R repositories (as specified in
369
+ <code>getOption(&quot;repos&quot;)</code>), then the package will be treated as
370
+ though it was installed from an R package repository.</p>
371
+ <p>If all of the above methods fail, renv will finally check for a
372
+ package available from the <em>cellar</em>. The package cellar is
373
+ typically used as an escape hatch, for packages which do not have a
374
+ well-defined remote source, or for packages which might not be remotely
375
+ accessible from your machine.</p>
376
+ </div>
377
+ <div id="unknown-sources" class="section level2">
378
+ <h2>Unknown sources</h2>
379
+ <p>If renv is unable to infer a package’s source, it will inform you
380
+ during <code>renv::snapshot()</code> – for example, if we attempted to
381
+ snapshot a package called <code>skeleton</code> with no known
382
+ source:</p>
383
+ <div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="sc">&gt;</span> renv<span class="sc">::</span><span class="fu">snapshot</span>()</span>
384
+ <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a>The following <span class="fu">package</span>(s) were installed from an unknown source<span class="sc">:</span></span>
385
+ <span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a></span>
386
+ <span id="cb3-4"><a href="#cb3-4" tabindex="-1"></a> skeleton</span>
387
+ <span id="cb3-5"><a href="#cb3-5" tabindex="-1"></a></span>
388
+ <span id="cb3-6"><a href="#cb3-6" tabindex="-1"></a>renv may be unable to restore these packages <span class="cf">in</span> the future.</span>
389
+ <span id="cb3-7"><a href="#cb3-7" tabindex="-1"></a>Consider reinstalling these packages from a known <span class="fu">source</span> (e.g. CRAN).</span>
390
+ <span id="cb3-8"><a href="#cb3-8" tabindex="-1"></a></span>
391
+ <span id="cb3-9"><a href="#cb3-9" tabindex="-1"></a>Do you want to proceed? [y<span class="sc">/</span>N]<span class="sc">:</span></span></code></pre></div>
392
+ <p>While you can still create a lockfile with such packages,
393
+ <code>restore()</code> will likely fail unless you can ensure this
394
+ package is installed through some other mechanism.</p>
395
+ </div>
396
+ <div id="custom-r-package-repositories" class="section level2">
397
+ <h2>Custom R package repositories</h2>
398
+ <p>Custom and local R package repositories are supported as well. The
399
+ only requirement is that these repositories are set as part of the
400
+ <code>repos</code> R option, and that these repositories are named. For
401
+ example, you might use:</p>
402
+ <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a>repos <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="at">CRAN =</span> <span class="st">&quot;https://cloud.r-project.org&quot;</span>, <span class="at">WORK =</span> <span class="st">&quot;https://work.example.org&quot;</span>)</span>
403
+ <span id="cb4-2"><a href="#cb4-2" tabindex="-1"></a><span class="fu">options</span>(<span class="at">repos =</span> repos)</span></code></pre></div>
404
+ <p>to tell renv to work with both the official CRAN package repository,
405
+ as well as a package repository you have hosted and set up in your work
406
+ environment.</p>
407
+ </div>
408
+ <div id="bioconductor" class="section level2">
409
+ <h2>Bioconductor</h2>
410
+ <p>renv has been designed to work together as seamlessly as possible
411
+ with the <a href="https://bioconductor.org/">Bioconductor</a> project.
412
+ This vignette outlines some of the extra steps that may be required when
413
+ using renv with packages obtained from Bioconductor.</p>
414
+ </div>
415
+ <div id="initializing-a-project" class="section level2">
416
+ <h2>Initializing a project</h2>
417
+ <p>To initialize renv in a project using Bioconductor, you can pass the
418
+ <code>bioconductor</code> argument to <code>renv::init()</code>:</p>
419
+ <div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="co"># use the latest-available Bioconductor release</span></span>
420
+ <span id="cb5-2"><a href="#cb5-2" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">init</span>(<span class="at">bioconductor =</span> <span class="cn">TRUE</span>)</span>
421
+ <span id="cb5-3"><a href="#cb5-3" tabindex="-1"></a></span>
422
+ <span id="cb5-4"><a href="#cb5-4" tabindex="-1"></a><span class="co"># use a specific version of Bioconductor</span></span>
423
+ <span id="cb5-5"><a href="#cb5-5" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">init</span>(<span class="at">bioconductor =</span> <span class="st">&quot;3.14&quot;</span>)</span></code></pre></div>
424
+ <p>This will tell renv to activate the appropriate Bioconductor
425
+ repositories, and to use those repositories when attempting to restore
426
+ packages.</p>
427
+ <div id="bioconductor-releases" class="section level3">
428
+ <h3>Bioconductor releases</h3>
429
+ <p>Bioconductor prepares different versions of its package repositories,
430
+ for use with different versions of R. The version of Bioconductor used
431
+ within a particular renv project is stored both as a project setting,
432
+ and also within the project lockfile. This allows you to “lock” a
433
+ particular project to a particular Bioconductor release, even as new
434
+ Bioconductor releases are made available for newer versions of R.</p>
435
+ <p>To set the version of Bioconductor used in a project, you can
436
+ use:</p>
437
+ <div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a>renv<span class="sc">::</span>settings<span class="sc">$</span><span class="fu">bioconductor.version</span>(<span class="st">&quot;3.14&quot;</span>)</span></code></pre></div>
438
+ <p>If you later choose to upgrade R, you may need to upgrade the version
439
+ of Bioconductor used as well.</p>
440
+ <p>If you want to override the Bioconductor repositories used by renv,
441
+ you can also explicitly set the following option:</p>
442
+ <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a><span class="fu">options</span>(<span class="at">renv.bioconductor.repos =</span> <span class="fu">c</span>(...))</span></code></pre></div>
443
+ </div>
444
+ </div>
445
+ <div id="the-package-cellar" class="section level2">
446
+ <h2>The package cellar</h2>
447
+ <p>In some cases, your project may depend on R packages which are not
448
+ available from any external source, or that external source may not be
449
+ accessible from the machine calling <code>renv::restore()</code>. To
450
+ help accommodate these scenarios, renv allows you to prepare a package
451
+ “cellar”, to be used as an ad-hoc repository of packages during restore.
452
+ This allows you to provide package tarballs that can be used to restore
453
+ packages which cannot be retrieved from any other source.</p>
454
+ <p>The environment variable <code>RENV_PATHS_CELLAR</code> can be used
455
+ to customize the package cellar location. It should point to a directory
456
+ containing package binaries and sources, with a structure of the
457
+ form:</p>
458
+ <ul>
459
+ <li><code>${RENV_PATHS_CELLAR}/&lt;package&gt;_&lt;version&gt;.tar.gz</code>;
460
+ or</li>
461
+ <li><code>${RENV_PATHS_CELLAR}/&lt;package&gt;/&lt;package&gt;_&lt;version&gt;.tar.gz</code></li>
462
+ </ul>
463
+ <p>Alternatively, you can also use a project-local cellar by placing
464
+ your packages within a folder located at
465
+ <code>&lt;project&gt;/renv/cellar</code>. Note that this folder does not
466
+ exist by default; you must create it to opt-in.</p>
467
+ <ul>
468
+ <li><code>&lt;project&gt;/renv/cellar/&lt;package&gt;_&lt;version&gt;.tar.gz</code>;
469
+ or</li>
470
+ <li><code>&lt;project&gt;/renv/cellar/&lt;package&gt;/&lt;package&gt;_&lt;version&gt;.tar.gz</code></li>
471
+ </ul>
472
+ <p>As an example, if your project depended on a package
473
+ <code>skeleton 1.0.0</code>, you could place a tarball for this package
474
+ in one of the following locations:</p>
475
+ <ul>
476
+ <li><code>${RENV_PATHS_CELLAR}/skeleton_1.0.0.tar.gz</code></li>
477
+ <li><code>${RENV_PATHS_CELLAR}/skeleton/skeleton_1.0.0.tar.gz</code></li>
478
+ <li><code>&lt;project&gt;/renv/cellar/skeleton_1.0.0.tar.gz</code>;
479
+ or</li>
480
+ <li><code>&lt;project&gt;/renv/cellar/skeleton/skeleton_1.0.0.tar.gz</code></li>
481
+ </ul>
482
+ <p>Once this is done, renv will consult these directories during future
483
+ attempts to restore your packages.</p>
484
+ <p>You can install a package from the cellar like any other package,
485
+ i.e. <code>renv::install(&quot;skeleton&quot;)</code>.</p>
486
+ <p>During restore, if a compatible package is located within the cellar,
487
+ that copy of the package will be preferred even if that package might
488
+ otherwise be accessible from its associated remote source. For example,
489
+ if <code>skeleton 1.0.0</code> was also available on CRAN,
490
+ <code>renv::restore()</code> would still use the tarball available in
491
+ the cellar rather than the version available from CRAN.</p>
492
+ <p>If you want to see what paths renv is using for the cellar, you can
493
+ use:</p>
494
+ <div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" tabindex="-1"></a>renv<span class="sc">:::</span><span class="fu">renv_paths_cellar</span>()</span></code></pre></div>
495
+ <p>See <code>?paths</code> for more details.</p>
496
+ <div id="explicit-sources" class="section level3">
497
+ <h3>Explicit sources</h3>
498
+ <p>You can also provide explicit source paths in the lockfile if
499
+ desired. This is most useful if you are building an renv lockfile “by
500
+ hand”, or need to tweak an existing lockfile to point at a separate
501
+ package for installation. For example, you could have a package record
502
+ in <code>renv.lock</code> of the form:</p>
503
+ <div class="sourceCode" id="cb9"><pre class="sourceCode json"><code class="sourceCode json"><span id="cb9-1"><a href="#cb9-1" tabindex="-1"></a><span class="fu">{</span></span>
504
+ <span id="cb9-2"><a href="#cb9-2" tabindex="-1"></a> <span class="dt">&quot;Package&quot;</span><span class="fu">:</span> <span class="st">&quot;skeleton&quot;</span><span class="fu">,</span></span>
505
+ <span id="cb9-3"><a href="#cb9-3" tabindex="-1"></a> <span class="dt">&quot;Version&quot;</span><span class="fu">:</span> <span class="st">&quot;1.0.1&quot;</span><span class="fu">,</span></span>
506
+ <span id="cb9-4"><a href="#cb9-4" tabindex="-1"></a> <span class="dt">&quot;Source&quot;</span><span class="fu">:</span> <span class="st">&quot;/mnt/r/pkg/skeleton_1.0.1.tar.gz&quot;</span></span>
507
+ <span id="cb9-5"><a href="#cb9-5" tabindex="-1"></a><span class="fu">}</span></span></code></pre></div>
508
+ <p>Packages should have the following extensions, depending on whether
509
+ the archive contains a binary copy of the package or the package
510
+ sources:</p>
511
+ <table>
512
+ <thead>
513
+ <tr class="header">
514
+ <th><strong>Platform</strong></th>
515
+ <th><strong>Binary</strong></th>
516
+ <th><strong>Sources</strong></th>
517
+ </tr>
518
+ </thead>
519
+ <tbody>
520
+ <tr class="odd">
521
+ <td>Windows</td>
522
+ <td><code>.zip</code></td>
523
+ <td><code>.tar.gz</code></td>
524
+ </tr>
525
+ <tr class="even">
526
+ <td>macOS</td>
527
+ <td><code>.tgz</code></td>
528
+ <td><code>.tar.gz</code></td>
529
+ </tr>
530
+ <tr class="odd">
531
+ <td>Linux</td>
532
+ <td><code>.tar.gz</code></td>
533
+ <td><code>.tar.gz</code></td>
534
+ </tr>
535
+ </tbody>
536
+ </table>
537
+ <p>Note that on Linux, both binaries and sources should have the
538
+ <code>.tar.gz</code> extension, but R and renv will handle this as
539
+ appropriate during installation.</p>
540
+ </div>
541
+ </div>
542
+ <div id="abi-compatibility" class="section level2">
543
+ <h2>ABI compatibility</h2>
544
+ <p>ABI compatibility issues can arise if different packages were built
545
+ against different versions of a shared dependency. For example, one
546
+ package may have been built against Rcpp 1.0.6, and another package
547
+ might have been built against Rcpp 1.0.7. However, because only one
548
+ version of the Rcpp package can be loaded at a time within an R session,
549
+ mixing of these two packages might cause issues either on load or at
550
+ runtime depending on the version of Rcpp available.</p>
551
+ <p>It’s worth emphasizing that this is not Rcpp’s fault; a package built
552
+ against Rcpp 1.0.7 would reasonably expect newer APIs made available by
553
+ that version of the package would be available at runtime, and that
554
+ contract would be violated if an older version of Rcpp were installed in
555
+ the project library. The challenge for renv is that this build-time
556
+ dependency is not clearly communicated to renv; in general, it is not
557
+ possible to know what packages (and their versions) a particular package
558
+ was built against.</p>
559
+ </div>
560
+ <div id="build-time-dependencies" class="section level2">
561
+ <h2>Build-time dependencies</h2>
562
+ <p>R packages might occasionally (and unintentionally) take a build-time
563
+ dependency on another R package – for example, a package with the
564
+ code:</p>
565
+ <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" tabindex="-1"></a><span class="co"># please don&#39;t do this!</span></span>
566
+ <span id="cb10-2"><a href="#cb10-2" tabindex="-1"></a><span class="st">`</span><span class="at">%&gt;%</span><span class="st">`</span> <span class="ot">&lt;-</span> magrittr<span class="sc">::</span><span class="st">`</span><span class="at">%&gt;%</span><span class="st">`</span></span></code></pre></div>
567
+ <p>would take the version of <code>%&gt;%</code> that was available from
568
+ the version of magrittr that was available at <em>build</em> time, not
569
+ the one available at <em>run</em> time. This could be problematic if,
570
+ for example, an update to the magrittr package changed in a way that
571
+ made old definitions of <code>%&gt;%</code> incompatible with newer
572
+ internal functions.</p>
573
+ <p>In general, it is a mistake for packages to take a build-time
574
+ dependency on exported objects from another package; rather, such
575
+ objects should be imported at runtime (using
576
+ e.g. <code>importFrom()</code> in the package <code>NAMESPACE</code>
577
+ file).</p>
578
+ </div>
579
+ </div>
580
+
581
+
582
+
583
+ <!-- code folding -->
584
+
585
+
586
+ <!-- dynamically load mathjax for compatibility with self-contained -->
587
+ <script>
588
+ (function () {
589
+ var script = document.createElement("script");
590
+ script.type = "text/javascript";
591
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
592
+ document.getElementsByTagName("head")[0].appendChild(script);
593
+ })();
594
+ </script>
595
+
596
+ </body>
597
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.R ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## -----------------------------------------------------------------------------
9
+ # renv::install()
10
+
11
+ ## -----------------------------------------------------------------------------
12
+ # renv::update()
13
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.Rmd ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Package development"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Package development}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+
19
+ ## Development
20
+
21
+ Often, R packages will have other R packages as dependencies. For this, one must
22
+ declare their R package dependencies within the package `DESCRIPTION` file. If
23
+ you want to prepare your environment for package development, you can use:
24
+
25
+ ```{r}
26
+ renv::install()
27
+ ```
28
+
29
+ to install the packages as declared in the package's `DESCRIPTION` file. This
30
+ action is roughly analogous to `remotes::install_deps()`.
31
+
32
+ If you're developing a package that you intend to release to CRAN, then you
33
+ likely want to build and test your package against the latest versions of your
34
+ dependencies as available on CRAN. For this, you should consider using:
35
+
36
+ ```{r}
37
+ renv::update()
38
+ ```
39
+
40
+ to ensure your package dependencies are up-to-date, as appropriate.
41
+
42
+
43
+ ## Isolation
44
+
45
+ Normally, a package under development should be tested against the
46
+ latest-available versions of its dependencies on CRAN. However, in some cases,
47
+ you may need to ensure your package is compatible with other packages also
48
+ currently under development.
49
+
50
+ In these cases, the renv project library can be useful -- you can install the
51
+ development version(s) of your dependencies into the project library, without
52
+ worrying about clobbering any packages already installed in your system library.
53
+
54
+ In these cases, you can declare your development dependencies using the
55
+ `Remotes` field of the `DESCRIPTION` file; e.g.
56
+
57
+ ```sh
58
+ Remotes:
59
+ r-lib/ggplot2
60
+ ```
61
+
62
+ and `renv::install()` will parse that remotes declaration and retrieve the
63
+ requested package. See the remotes vignette,
64
+ [Dependency resolution for R package development][dependencies],
65
+ for more details.
66
+
67
+
68
+ ## Library Paths
69
+
70
+ For package projects using renv, a library path outside of the project
71
+ directory will be used instead. As an example, on macOS, this might look like:
72
+
73
+ ```r
74
+ > .libPaths()
75
+ [1] "/Users/kevin/Library/Caches/org.R-project.R/R/renv/library/example-552f6e80/R-4.3/aarch64-apple-darwin20"
76
+ [2] "/Users/kevin/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.3/aarch64-apple-darwin20/ac5c2659"
77
+ ```
78
+
79
+ This is done to avoid issues with `R CMD build`, which can become very slow if
80
+ your project contains a large number of files -- as can happen if the project
81
+ library is located in `renv/library` (the typical location). Note that even
82
+ though the library is located outside of the project, the library path
83
+ generated will still be unique to that project, and so the project is still
84
+ effectively isolated in the same way as other renv projects normally are.
85
+
86
+ If you want to customize the location where `renv` places project libraries in
87
+ this scenario, you can use the `RENV_PATHS_LIBRARY_ROOT` environment variable.
88
+ For example:
89
+
90
+ ```sh
91
+ RENV_PATHS_LIBRARY_ROOT = ~/.renv/library
92
+ ```
93
+
94
+ If you'd still prefer to keep your project library within the project directory,
95
+ you can set:
96
+
97
+ ```sh
98
+ RENV_PATHS_LIBRARY = renv/library
99
+ ```
100
+
101
+ within an appropriate `.Renviron` start-up profile -- but please be aware of
102
+ the caveats to doing this, as the performance of `R CMD build` will be affected.
103
+
104
+
105
+ ## Testing
106
+
107
+ While developing your package, you may want to use a continuous integration
108
+ service (such as [Travis CI](https://www.travis-ci.com)) to build and test
109
+ your package remotely. You can use renv to help facilitate this testing --
110
+ see the [Continuous Integration](ci.html) vignette for more information. In
111
+ particular, clever use of the renv cache can help save time that might
112
+ normally be spent on package installation. See
113
+ <https://github.com/rstudio/renv/blob/main/.github/workflows/R-CMD-check.yaml>
114
+ for an example of how renv uses itself for package management in its own
115
+ CI tests.
116
+
117
+
118
+ ## Submitting to CRAN
119
+
120
+ Note that packages submitted to CRAN should be designed to work with the other R
121
+ packages currently available on CRAN. For that reason, when preparing your package
122
+ for submission, you'll need to ensure your source package tarball does not
123
+ include any `renv` infrastructure. `renv` makes this easy by automatically
124
+ including
125
+
126
+ ```sh
127
+ ^renv$
128
+ ^renv\.lock$
129
+ ```
130
+
131
+ in your package's `.Rbuildignore` file. This instructs `R CMD build` to not
132
+ include these files and folders in the generated package tarball. Through this,
133
+ even if `renv` is used during package development, it's still easy to build and
134
+ publish your package to CRAN as you would when developing packages without `renv`.
135
+
136
+
137
+ [dependencies]: https://remotes.r-lib.org/articles/dependencies.html
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packages.html ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Package development</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Package development</h1>
341
+
342
+
343
+
344
+ <div id="development" class="section level2">
345
+ <h2>Development</h2>
346
+ <p>Often, R packages will have other R packages as dependencies. For
347
+ this, one must declare their R package dependencies within the package
348
+ <code>DESCRIPTION</code> file. If you want to prepare your environment
349
+ for package development, you can use:</p>
350
+ <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">install</span>()</span></code></pre></div>
351
+ <p>to install the packages as declared in the package’s
352
+ <code>DESCRIPTION</code> file. This action is roughly analogous to
353
+ <code>remotes::install_deps()</code>.</p>
354
+ <p>If you’re developing a package that you intend to release to CRAN,
355
+ then you likely want to build and test your package against the latest
356
+ versions of your dependencies as available on CRAN. For this, you should
357
+ consider using:</p>
358
+ <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">update</span>()</span></code></pre></div>
359
+ <p>to ensure your package dependencies are up-to-date, as
360
+ appropriate.</p>
361
+ </div>
362
+ <div id="isolation" class="section level2">
363
+ <h2>Isolation</h2>
364
+ <p>Normally, a package under development should be tested against the
365
+ latest-available versions of its dependencies on CRAN. However, in some
366
+ cases, you may need to ensure your package is compatible with other
367
+ packages also currently under development.</p>
368
+ <p>In these cases, the renv project library can be useful – you can
369
+ install the development version(s) of your dependencies into the project
370
+ library, without worrying about clobbering any packages already
371
+ installed in your system library.</p>
372
+ <p>In these cases, you can declare your development dependencies using
373
+ the <code>Remotes</code> field of the <code>DESCRIPTION</code> file;
374
+ e.g.</p>
375
+ <div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="ex">Remotes:</span></span>
376
+ <span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a> <span class="ex">r-lib/ggplot2</span></span></code></pre></div>
377
+ <p>and <code>renv::install()</code> will parse that remotes declaration
378
+ and retrieve the requested package. See the remotes vignette, <a href="https://remotes.r-lib.org/articles/dependencies.html">Dependency
379
+ resolution for R package development</a>, for more details.</p>
380
+ </div>
381
+ <div id="library-paths" class="section level2">
382
+ <h2>Library Paths</h2>
383
+ <p>For package projects using renv, a library path outside of the
384
+ project directory will be used instead. As an example, on macOS, this
385
+ might look like:</p>
386
+ <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="sc">&gt;</span> <span class="fu">.libPaths</span>()</span>
387
+ <span id="cb4-2"><a href="#cb4-2" tabindex="-1"></a>[<span class="dv">1</span>] <span class="st">&quot;/Users/kevin/Library/Caches/org.R-project.R/R/renv/library/example-552f6e80/R-4.3/aarch64-apple-darwin20&quot;</span></span>
388
+ <span id="cb4-3"><a href="#cb4-3" tabindex="-1"></a>[<span class="dv">2</span>] <span class="st">&quot;/Users/kevin/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.3/aarch64-apple-darwin20/ac5c2659&quot;</span></span></code></pre></div>
389
+ <p>This is done to avoid issues with <code>R CMD build</code>, which can
390
+ become very slow if your project contains a large number of files – as
391
+ can happen if the project library is located in
392
+ <code>renv/library</code> (the typical location). Note that even though
393
+ the library is located outside of the project, the library path
394
+ generated will still be unique to that project, and so the project is
395
+ still effectively isolated in the same way as other renv projects
396
+ normally are.</p>
397
+ <p>If you want to customize the location where <code>renv</code> places
398
+ project libraries in this scenario, you can use the
399
+ <code>RENV_PATHS_LIBRARY_ROOT</code> environment variable. For
400
+ example:</p>
401
+ <div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="ex">RENV_PATHS_LIBRARY_ROOT</span> = ~/.renv/library</span></code></pre></div>
402
+ <p>If you’d still prefer to keep your project library within the project
403
+ directory, you can set:</p>
404
+ <div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a><span class="ex">RENV_PATHS_LIBRARY</span> = renv/library</span></code></pre></div>
405
+ <p>within an appropriate <code>.Renviron</code> start-up profile – but
406
+ please be aware of the caveats to doing this, as the performance of
407
+ <code>R CMD build</code> will be affected.</p>
408
+ </div>
409
+ <div id="testing" class="section level2">
410
+ <h2>Testing</h2>
411
+ <p>While developing your package, you may want to use a continuous
412
+ integration service (such as <a href="https://www.travis-ci.com">Travis
413
+ CI</a>) to build and test your package remotely. You can use renv to
414
+ help facilitate this testing – see the <a href="ci.html">Continuous
415
+ Integration</a> vignette for more information. In particular, clever use
416
+ of the renv cache can help save time that might normally be spent on
417
+ package installation. See <a href="https://github.com/rstudio/renv/blob/main/.github/workflows/R-CMD-check.yaml" class="uri">https://github.com/rstudio/renv/blob/main/.github/workflows/R-CMD-check.yaml</a>
418
+ for an example of how renv uses itself for package management in its own
419
+ CI tests.</p>
420
+ </div>
421
+ <div id="submitting-to-cran" class="section level2">
422
+ <h2>Submitting to CRAN</h2>
423
+ <p>Note that packages submitted to CRAN should be designed to work with
424
+ the other R packages currently available on CRAN. For that reason, when
425
+ preparing your package for submission, you’ll need to ensure your source
426
+ package tarball does not include any <code>renv</code> infrastructure.
427
+ <code>renv</code> makes this easy by automatically including</p>
428
+ <div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a><span class="ex">^renv$</span></span>
429
+ <span id="cb7-2"><a href="#cb7-2" tabindex="-1"></a><span class="ex">^renv\.lock$</span></span></code></pre></div>
430
+ <p>in your package’s <code>.Rbuildignore</code> file. This instructs
431
+ <code>R CMD build</code> to not include these files and folders in the
432
+ generated package tarball. Through this, even if <code>renv</code> is
433
+ used during package development, it’s still easy to build and publish
434
+ your package to CRAN as you would when developing packages without
435
+ <code>renv</code>.</p>
436
+ </div>
437
+
438
+
439
+
440
+ <!-- code folding -->
441
+
442
+
443
+ <!-- dynamically load mathjax for compatibility with self-contained -->
444
+ <script>
445
+ (function () {
446
+ var script = document.createElement("script");
447
+ script.type = "text/javascript";
448
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
449
+ document.getElementsByTagName("head")[0].appendChild(script);
450
+ })();
451
+ </script>
452
+
453
+ </body>
454
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.R ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## ----setup--------------------------------------------------------------------
9
+ # library(renv)
10
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.Rmd ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "packrat vs. renv"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{packrat vs. renv}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ ```{r setup}
19
+ library(renv)
20
+ ```
21
+
22
+ Our first attempt at solving the problem of reproducible environments was [packrat](https://rstudio.github.io/packrat/).
23
+ While we learned a lot from packrat, it ultimately proved challenging to use in ways that were difficult to fix.
24
+ This led us to create renv, a system with fewer surprises and better defaults.
25
+ If you're an existing packrat user, you can call `renv::migrate()` to switch renv, then read on to learn about the main differences:
26
+
27
+ 1. The renv lockfile `renv.lock` is formatted as [JSON](https://www.json.org/).
28
+ This should make the lockfile easier to use and consume with other tools.
29
+
30
+ 2. renv no longer attempts to explicitly download and track R package source tarballs within your project.
31
+ This was a frustrating default that operated under the assumption that you might later want to be able to restore a project's private library without access to a CRAN repository.
32
+ In practice, this is almost never the case, and the time spent downloading + storing the package sources seemed to outweigh the potential reproducibility benefits.
33
+
34
+ 3. Packrat tried to maintain the distinction between so-called *stale* packages; that is, R packages which were installed by Packrat but were not recorded in the lockfile for some reason.
35
+ This distinction was (1) overall not useful, and (2) confusing.
36
+ renv no longer makes this distinction: `snapshot()` saves the state of your project library to `renv.lock`, `restore()` loads the state of your project library from `renv.lock`, and that's all.
37
+
38
+ 4. In renv, the global package cache is enabled by default.
39
+ This should reduce overall disk-space usage as packages can effectively be shared across each project using renv.
40
+
41
+ 5. renv's dependency discovery machinery is more configurable.
42
+ The function `renv::dependencies()` is exported, and users can create `.renvignore` files to instruct renv to ignore specific files and folders in their projects.
43
+ (See `?renv::dependencies` for more information.)
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/packrat.html ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>packrat vs. renv</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">packrat vs. renv</h1>
341
+
342
+
343
+
344
+ <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">library</span>(renv)</span></code></pre></div>
345
+ <p>Our first attempt at solving the problem of reproducible environments
346
+ was <a href="https://rstudio.github.io/packrat/">packrat</a>. While we
347
+ learned a lot from packrat, it ultimately proved challenging to use in
348
+ ways that were difficult to fix. This led us to create renv, a system
349
+ with fewer surprises and better defaults. If you’re an existing packrat
350
+ user, you can call <code>renv::migrate()</code> to switch renv, then
351
+ read on to learn about the main differences:</p>
352
+ <ol style="list-style-type: decimal">
353
+ <li><p>The renv lockfile <code>renv.lock</code> is formatted as <a href="https://www.json.org/">JSON</a>. This should make the lockfile
354
+ easier to use and consume with other tools.</p></li>
355
+ <li><p>renv no longer attempts to explicitly download and track R
356
+ package source tarballs within your project. This was a frustrating
357
+ default that operated under the assumption that you might later want to
358
+ be able to restore a project’s private library without access to a CRAN
359
+ repository. In practice, this is almost never the case, and the time
360
+ spent downloading + storing the package sources seemed to outweigh the
361
+ potential reproducibility benefits.</p></li>
362
+ <li><p>Packrat tried to maintain the distinction between so-called
363
+ <em>stale</em> packages; that is, R packages which were installed by
364
+ Packrat but were not recorded in the lockfile for some reason. This
365
+ distinction was (1) overall not useful, and (2) confusing. renv no
366
+ longer makes this distinction: <code>snapshot()</code> saves the state
367
+ of your project library to <code>renv.lock</code>,
368
+ <code>restore()</code> loads the state of your project library from
369
+ <code>renv.lock</code>, and that’s all.</p></li>
370
+ <li><p>In renv, the global package cache is enabled by default. This
371
+ should reduce overall disk-space usage as packages can effectively be
372
+ shared across each project using renv.</p></li>
373
+ <li><p>renv’s dependency discovery machinery is more configurable. The
374
+ function <code>renv::dependencies()</code> is exported, and users can
375
+ create <code>.renvignore</code> files to instruct renv to ignore
376
+ specific files and folders in their projects. (See
377
+ <code>?renv::dependencies</code> for more information.)</p></li>
378
+ </ol>
379
+
380
+
381
+
382
+ <!-- code folding -->
383
+
384
+
385
+ <!-- dynamically load mathjax for compatibility with self-contained -->
386
+ <script>
387
+ (function () {
388
+ var script = document.createElement("script");
389
+ script.type = "text/javascript";
390
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
391
+ document.getElementsByTagName("head")[0].appendChild(script);
392
+ })();
393
+ </script>
394
+
395
+ </body>
396
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.R ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
8
+ ## -----------------------------------------------------------------------------
9
+ # renv::activate(profile = "dev")
10
+
11
+ ## -----------------------------------------------------------------------------
12
+ # Sys.setenv(RENV_PROFILE = "dev")
13
+
14
+ ## -----------------------------------------------------------------------------
15
+ # renv::activate(profile = "default")
16
+
17
+ ## -----------------------------------------------------------------------------
18
+ # renv::settings$snapshot.type("explicit")
19
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.Rmd ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Project profiles"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Project profiles}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+
19
+ ## Introduction
20
+
21
+ Starting with `renv 0.13.0`, it is possible to activate and switch between
22
+ different profiles associated with a project. A profile can be thought of as
23
+ a different mode in which a project is used. For example:
24
+
25
+ - A "development" profile might be used when developing and testing a project,
26
+ - A "production" profile might be used for production deployments,
27
+ - A "shiny" profile might be used when running the Shiny application.
28
+
29
+ At its heart, activating or using a particular profile implies using a different
30
+ set of paths for the project library and lockfile. With this, it is possible
31
+ to associate different packages, and different dependencies, with different
32
+ workflows in a single project using renv.
33
+
34
+
35
+ ## Usage
36
+
37
+ By default, renv projects use the "default" profile, which implies that
38
+ library and lockfile paths are set in the typical way. To activate a particular
39
+ profile, use:
40
+
41
+ ```{r}
42
+ renv::activate(profile = "dev")
43
+ ```
44
+
45
+ This creates a profile called `"dev"`, and sets it as the default for the
46
+ project, so that newly-launched R sessions will operate using the `"dev"`
47
+ profile. After setting this and re-launching R, you should see that the
48
+ project library and lockfile paths are resolved within the `renv/profiles/dev`
49
+ folder from the project root.
50
+
51
+ Alternatively, if you want to activate a particular profile for an R session
52
+ without setting it as the default for new R sessions, you can use:
53
+
54
+ ```{r}
55
+ Sys.setenv(RENV_PROFILE = "dev")
56
+ ```
57
+
58
+ and renv will automatically use that profile as appropriate when computing
59
+ library and lockfile paths. Similarly, from the command line, you might
60
+ enforce the use of a particular profile in an renv project with:
61
+
62
+ ```{sh}
63
+ export RENV_PROFILE=dev
64
+ ```
65
+
66
+ With that set, renv would default to using the `"dev"` profile for any
67
+ newly-launched R sessions within renv projects.
68
+
69
+ To activate the "default" profile used by a project, use:
70
+
71
+ ```{r}
72
+ renv::activate(profile = "default")
73
+ ```
74
+
75
+
76
+ ## Managing profile-specific dependencies
77
+
78
+ Profile-specific package dependencies can be declared within the project's
79
+ top-level `DESCRIPTION` file. For example, to declare that the shiny
80
+ profile depends on the [shiny] and [tidyverse] packages:
81
+
82
+ ```{sh}
83
+ Config/renv/profiles/shiny/dependencies: shiny, tidyverse
84
+ ```
85
+
86
+ If you'd like to also declare that these packages should be installed from
87
+ a custom remote (analogous to the `Remotes` field for the default profile),
88
+ you can define those remotes with a separate field:
89
+
90
+ ```{sh}
91
+ Config/renv/profiles/shiny/remotes: rstudio/shiny, tidyverse/tidyverse
92
+ ```
93
+
94
+ These remotes will then be respected in calls to `renv::install()`.
95
+
96
+ The packages and remotes must be specified separately, as renv cannot
97
+ determine the package name associated with a particular remote without
98
+ explicitly resolving that remote. Remote resolution normally requires a web
99
+ request, which renv tries to avoid in "regular" dependency discovery.
100
+
101
+ If you'd prefer that only the packages enumerated in this field are used, you
102
+ can opt-in to using `"explicit"` snapshots, and leave the `Imports`, `Depends`
103
+ and `Suggests` fields blank:
104
+
105
+ ```{r}
106
+ renv::settings$snapshot.type("explicit")
107
+ ```
108
+
109
+ When set, only the dependencies listed in the project `DESCRIPTION` file will
110
+ be used when the lockfile is generated. See `?renv::snapshot` for more details.
111
+
112
+
113
+
114
+ [shiny]: https://shiny.posit.co/
115
+ [tidyverse]: https://www.tidyverse.org/
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/profiles.html ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Project profiles</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+ <style type="text/css">
43
+ code {
44
+ white-space: pre;
45
+ }
46
+ .sourceCode {
47
+ overflow: visible;
48
+ }
49
+ </style>
50
+ <style type="text/css" data-origin="pandoc">
51
+ html { -webkit-text-size-adjust: 100%; }
52
+ pre > code.sourceCode { white-space: pre; position: relative; }
53
+ pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
54
+ pre > code.sourceCode > span:empty { height: 1.2em; }
55
+ .sourceCode { overflow: visible; }
56
+ code.sourceCode > span { color: inherit; text-decoration: inherit; }
57
+ div.sourceCode { margin: 1em 0; }
58
+ pre.sourceCode { margin: 0; }
59
+ @media screen {
60
+ div.sourceCode { overflow: auto; }
61
+ }
62
+ @media print {
63
+ pre > code.sourceCode { white-space: pre-wrap; }
64
+ pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
65
+ }
66
+ pre.numberSource code
67
+ { counter-reset: source-line 0; }
68
+ pre.numberSource code > span
69
+ { position: relative; left: -4em; counter-increment: source-line; }
70
+ pre.numberSource code > span > a:first-child::before
71
+ { content: counter(source-line);
72
+ position: relative; left: -1em; text-align: right; vertical-align: baseline;
73
+ border: none; display: inline-block;
74
+ -webkit-touch-callout: none; -webkit-user-select: none;
75
+ -khtml-user-select: none; -moz-user-select: none;
76
+ -ms-user-select: none; user-select: none;
77
+ padding: 0 4px; width: 4em;
78
+ color: #aaaaaa;
79
+ }
80
+ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
81
+ div.sourceCode
82
+ { }
83
+ @media screen {
84
+ pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
85
+ }
86
+ code span.al { color: #ff0000; font-weight: bold; }
87
+ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
88
+ code span.at { color: #7d9029; }
89
+ code span.bn { color: #40a070; }
90
+ code span.bu { color: #008000; }
91
+ code span.cf { color: #007020; font-weight: bold; }
92
+ code span.ch { color: #4070a0; }
93
+ code span.cn { color: #880000; }
94
+ code span.co { color: #60a0b0; font-style: italic; }
95
+ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
96
+ code span.do { color: #ba2121; font-style: italic; }
97
+ code span.dt { color: #902000; }
98
+ code span.dv { color: #40a070; }
99
+ code span.er { color: #ff0000; font-weight: bold; }
100
+ code span.ex { }
101
+ code span.fl { color: #40a070; }
102
+ code span.fu { color: #06287e; }
103
+ code span.im { color: #008000; font-weight: bold; }
104
+ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
105
+ code span.kw { color: #007020; font-weight: bold; }
106
+ code span.op { color: #666666; }
107
+ code span.ot { color: #007020; }
108
+ code span.pp { color: #bc7a00; }
109
+ code span.sc { color: #4070a0; }
110
+ code span.ss { color: #bb6688; }
111
+ code span.st { color: #4070a0; }
112
+ code span.va { color: #19177c; }
113
+ code span.vs { color: #4070a0; }
114
+ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
115
+ </style>
116
+ <script>
117
+ // apply pandoc div.sourceCode style to pre.sourceCode instead
118
+ (function() {
119
+ var sheets = document.styleSheets;
120
+ for (var i = 0; i < sheets.length; i++) {
121
+ if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
122
+ try { var rules = sheets[i].cssRules; } catch (e) { continue; }
123
+ var j = 0;
124
+ while (j < rules.length) {
125
+ var rule = rules[j];
126
+ // check if there is a div.sourceCode rule
127
+ if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
128
+ j++;
129
+ continue;
130
+ }
131
+ var style = rule.style.cssText;
132
+ // check if color or background-color is set
133
+ if (rule.style.color === '' && rule.style.backgroundColor === '') {
134
+ j++;
135
+ continue;
136
+ }
137
+ // replace div.sourceCode by a pre.sourceCode rule
138
+ sheets[i].deleteRule(j);
139
+ sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
140
+ }
141
+ }
142
+ })();
143
+ </script>
144
+
145
+
146
+
147
+
148
+ <style type="text/css">body {
149
+ background-color: #fff;
150
+ margin: 1em auto;
151
+ max-width: 700px;
152
+ overflow: visible;
153
+ padding-left: 2em;
154
+ padding-right: 2em;
155
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
156
+ font-size: 14px;
157
+ line-height: 1.35;
158
+ }
159
+ #TOC {
160
+ clear: both;
161
+ margin: 0 0 10px 10px;
162
+ padding: 4px;
163
+ width: 400px;
164
+ border: 1px solid #CCCCCC;
165
+ border-radius: 5px;
166
+ background-color: #f6f6f6;
167
+ font-size: 13px;
168
+ line-height: 1.3;
169
+ }
170
+ #TOC .toctitle {
171
+ font-weight: bold;
172
+ font-size: 15px;
173
+ margin-left: 5px;
174
+ }
175
+ #TOC ul {
176
+ padding-left: 40px;
177
+ margin-left: -1.5em;
178
+ margin-top: 5px;
179
+ margin-bottom: 5px;
180
+ }
181
+ #TOC ul ul {
182
+ margin-left: -2em;
183
+ }
184
+ #TOC li {
185
+ line-height: 16px;
186
+ }
187
+ table {
188
+ margin: 1em auto;
189
+ border-width: 1px;
190
+ border-color: #DDDDDD;
191
+ border-style: outset;
192
+ border-collapse: collapse;
193
+ }
194
+ table th {
195
+ border-width: 2px;
196
+ padding: 5px;
197
+ border-style: inset;
198
+ }
199
+ table td {
200
+ border-width: 1px;
201
+ border-style: inset;
202
+ line-height: 18px;
203
+ padding: 5px 5px;
204
+ }
205
+ table, table th, table td {
206
+ border-left-style: none;
207
+ border-right-style: none;
208
+ }
209
+ table thead, table tr.even {
210
+ background-color: #f7f7f7;
211
+ }
212
+ p {
213
+ margin: 0.5em 0;
214
+ }
215
+ blockquote {
216
+ background-color: #f6f6f6;
217
+ padding: 0.25em 0.75em;
218
+ }
219
+ hr {
220
+ border-style: solid;
221
+ border: none;
222
+ border-top: 1px solid #777;
223
+ margin: 28px 0;
224
+ }
225
+ dl {
226
+ margin-left: 0;
227
+ }
228
+ dl dd {
229
+ margin-bottom: 13px;
230
+ margin-left: 13px;
231
+ }
232
+ dl dt {
233
+ font-weight: bold;
234
+ }
235
+ ul {
236
+ margin-top: 0;
237
+ }
238
+ ul li {
239
+ list-style: circle outside;
240
+ }
241
+ ul ul {
242
+ margin-bottom: 0;
243
+ }
244
+ pre, code {
245
+ background-color: #f7f7f7;
246
+ border-radius: 3px;
247
+ color: #333;
248
+ white-space: pre-wrap;
249
+ }
250
+ pre {
251
+ border-radius: 3px;
252
+ margin: 5px 0px 10px 0px;
253
+ padding: 10px;
254
+ }
255
+ pre:not([class]) {
256
+ background-color: #f7f7f7;
257
+ }
258
+ code {
259
+ font-family: Consolas, Monaco, 'Courier New', monospace;
260
+ font-size: 85%;
261
+ }
262
+ p > code, li > code {
263
+ padding: 2px 0px;
264
+ }
265
+ div.figure {
266
+ text-align: center;
267
+ }
268
+ img {
269
+ background-color: #FFFFFF;
270
+ padding: 2px;
271
+ border: 1px solid #DDDDDD;
272
+ border-radius: 3px;
273
+ border: 1px solid #CCCCCC;
274
+ margin: 0 5px;
275
+ }
276
+ h1 {
277
+ margin-top: 0;
278
+ font-size: 35px;
279
+ line-height: 40px;
280
+ }
281
+ h2 {
282
+ border-bottom: 4px solid #f7f7f7;
283
+ padding-top: 10px;
284
+ padding-bottom: 2px;
285
+ font-size: 145%;
286
+ }
287
+ h3 {
288
+ border-bottom: 2px solid #f7f7f7;
289
+ padding-top: 10px;
290
+ font-size: 120%;
291
+ }
292
+ h4 {
293
+ border-bottom: 1px solid #f7f7f7;
294
+ margin-left: 8px;
295
+ font-size: 105%;
296
+ }
297
+ h5, h6 {
298
+ border-bottom: 1px solid #ccc;
299
+ font-size: 105%;
300
+ }
301
+ a {
302
+ color: #0033dd;
303
+ text-decoration: none;
304
+ }
305
+ a:hover {
306
+ color: #6666ff; }
307
+ a:visited {
308
+ color: #800080; }
309
+ a:visited:hover {
310
+ color: #BB00BB; }
311
+ a[href^="http:"] {
312
+ text-decoration: underline; }
313
+ a[href^="https:"] {
314
+ text-decoration: underline; }
315
+
316
+ code > span.kw { color: #555; font-weight: bold; }
317
+ code > span.dt { color: #902000; }
318
+ code > span.dv { color: #40a070; }
319
+ code > span.bn { color: #d14; }
320
+ code > span.fl { color: #d14; }
321
+ code > span.ch { color: #d14; }
322
+ code > span.st { color: #d14; }
323
+ code > span.co { color: #888888; font-style: italic; }
324
+ code > span.ot { color: #007020; }
325
+ code > span.al { color: #ff0000; font-weight: bold; }
326
+ code > span.fu { color: #900; font-weight: bold; }
327
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
328
+ </style>
329
+
330
+
331
+
332
+
333
+ </head>
334
+
335
+ <body>
336
+
337
+
338
+
339
+
340
+ <h1 class="title toc-ignore">Project profiles</h1>
341
+
342
+
343
+
344
+ <div id="introduction" class="section level2">
345
+ <h2>Introduction</h2>
346
+ <p>Starting with <code>renv 0.13.0</code>, it is possible to activate
347
+ and switch between different profiles associated with a project. A
348
+ profile can be thought of as a different mode in which a project is
349
+ used. For example:</p>
350
+ <ul>
351
+ <li>A “development” profile might be used when developing and testing a
352
+ project,</li>
353
+ <li>A “production” profile might be used for production
354
+ deployments,</li>
355
+ <li>A “shiny” profile might be used when running the Shiny
356
+ application.</li>
357
+ </ul>
358
+ <p>At its heart, activating or using a particular profile implies using
359
+ a different set of paths for the project library and lockfile. With
360
+ this, it is possible to associate different packages, and different
361
+ dependencies, with different workflows in a single project using
362
+ renv.</p>
363
+ </div>
364
+ <div id="usage" class="section level2">
365
+ <h2>Usage</h2>
366
+ <p>By default, renv projects use the “default” profile, which implies
367
+ that library and lockfile paths are set in the typical way. To activate
368
+ a particular profile, use:</p>
369
+ <div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">activate</span>(<span class="at">profile =</span> <span class="st">&quot;dev&quot;</span>)</span></code></pre></div>
370
+ <p>This creates a profile called <code>&quot;dev&quot;</code>, and sets it as the
371
+ default for the project, so that newly-launched R sessions will operate
372
+ using the <code>&quot;dev&quot;</code> profile. After setting this and
373
+ re-launching R, you should see that the project library and lockfile
374
+ paths are resolved within the <code>renv/profiles/dev</code> folder from
375
+ the project root.</p>
376
+ <p>Alternatively, if you want to activate a particular profile for an R
377
+ session without setting it as the default for new R sessions, you can
378
+ use:</p>
379
+ <div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="fu">Sys.setenv</span>(<span class="at">RENV_PROFILE =</span> <span class="st">&quot;dev&quot;</span>)</span></code></pre></div>
380
+ <p>and renv will automatically use that profile as appropriate when
381
+ computing library and lockfile paths. Similarly, from the command line,
382
+ you might enforce the use of a particular profile in an renv project
383
+ with:</p>
384
+ <div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="bu">export</span> <span class="va">RENV_PROFILE</span><span class="op">=</span>dev</span></code></pre></div>
385
+ <p>With that set, renv would default to using the <code>&quot;dev&quot;</code>
386
+ profile for any newly-launched R sessions within renv projects.</p>
387
+ <p>To activate the “default” profile used by a project, use:</p>
388
+ <div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a>renv<span class="sc">::</span><span class="fu">activate</span>(<span class="at">profile =</span> <span class="st">&quot;default&quot;</span>)</span></code></pre></div>
389
+ </div>
390
+ <div id="managing-profile-specific-dependencies" class="section level2">
391
+ <h2>Managing profile-specific dependencies</h2>
392
+ <p>Profile-specific package dependencies can be declared within the
393
+ project’s top-level <code>DESCRIPTION</code> file. For example, to
394
+ declare that the shiny profile depends on the <a href="https://shiny.posit.co/">shiny</a> and <a href="https://www.tidyverse.org/">tidyverse</a> packages:</p>
395
+ <div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a><span class="ex">Config/renv/profiles/shiny/dependencies:</span> shiny, tidyverse</span></code></pre></div>
396
+ <p>If you’d like to also declare that these packages should be installed
397
+ from a custom remote (analogous to the <code>Remotes</code> field for
398
+ the default profile), you can define those remotes with a separate
399
+ field:</p>
400
+ <div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" tabindex="-1"></a><span class="ex">Config/renv/profiles/shiny/remotes:</span> rstudio/shiny, tidyverse/tidyverse</span></code></pre></div>
401
+ <p>These remotes will then be respected in calls to
402
+ <code>renv::install()</code>.</p>
403
+ <p>The packages and remotes must be specified separately, as renv cannot
404
+ determine the package name associated with a particular remote without
405
+ explicitly resolving that remote. Remote resolution normally requires a
406
+ web request, which renv tries to avoid in “regular” dependency
407
+ discovery.</p>
408
+ <p>If you’d prefer that only the packages enumerated in this field are
409
+ used, you can opt-in to using <code>&quot;explicit&quot;</code> snapshots, and
410
+ leave the <code>Imports</code>, <code>Depends</code> and
411
+ <code>Suggests</code> fields blank:</p>
412
+ <div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" tabindex="-1"></a>renv<span class="sc">::</span>settings<span class="sc">$</span><span class="fu">snapshot.type</span>(<span class="st">&quot;explicit&quot;</span>)</span></code></pre></div>
413
+ <p>When set, only the dependencies listed in the project
414
+ <code>DESCRIPTION</code> file will be used when the lockfile is
415
+ generated. See <code>?renv::snapshot</code> for more details.</p>
416
+ </div>
417
+
418
+
419
+
420
+ <!-- code folding -->
421
+
422
+
423
+ <!-- dynamically load mathjax for compatibility with self-contained -->
424
+ <script>
425
+ (function () {
426
+ var script = document.createElement("script");
427
+ script.type = "text/javascript";
428
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
429
+ document.getElementsByTagName("head")[0].appendChild(script);
430
+ })();
431
+ </script>
432
+
433
+ </body>
434
+ </html>
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.R ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ## ----include=FALSE------------------------------------------------------------
2
+ knitr::opts_chunk$set(
3
+ collapse = TRUE,
4
+ comment = "#>",
5
+ eval = FALSE
6
+ )
7
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.Rmd ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: "Using Python with renv"
3
+ output: rmarkdown::html_vignette
4
+ vignette: >
5
+ %\VignetteIndexEntry{Using Python with renv}
6
+ %\VignetteEngine{knitr::rmarkdown}
7
+ %\VignetteEncoding{UTF-8}
8
+ ---
9
+
10
+ ```{r, include=FALSE}
11
+ knitr::opts_chunk$set(
12
+ collapse = TRUE,
13
+ comment = "#>",
14
+ eval = FALSE
15
+ )
16
+ ```
17
+
18
+ If you're using renv with an R project that also depends on some Python
19
+ packages (say, through the [reticulate](https://rstudio.github.io/reticulate/)
20
+ package), then you may find renv's Python integration useful.
21
+
22
+
23
+ ## Activating Python integration
24
+
25
+ Python integration can be activated on a project-by-project basis. Use
26
+ `renv::use_python()` to tell renv to create and use a project-local Python
27
+ environment with your project. If the reticulate package is installed and
28
+ active, then renv will use the same version of Python that reticulate
29
+ normally would when generating the virtual environment. Alternatively, you can
30
+ set the `RETICULATE_PYTHON` environment variable to instruct renv to use a
31
+ different version of Python.
32
+
33
+ If you'd rather tell renv to use an existing Python virtual environment, you
34
+ can do so by passing the path of that virtual environment instead -- use
35
+ `renv::use_python(python = "/path/to/python")` and renv will record and
36
+ use that Python interpreter with your project. This can also be used with
37
+ pre-existing virtual environments and Conda environments.
38
+
39
+
40
+ ## Understanding Python integration
41
+
42
+ Once Python integration is active, renv will attempt to manage the state of
43
+ your Python virtual environment when `snapshot()` / `restore()` is called. With
44
+ this, projects that use renv and Python can ensure that Python dependencies
45
+ are tracked in addition to R package dependencies. Note that future restores
46
+ will require both `renv.lock` (for R package dependencies) and
47
+ `requirements.txt` (for Python package dependencies).
48
+
49
+
50
+ ### Virtual environments
51
+
52
+ When using virtual environments, the following extensions are provided:
53
+
54
+ - `renv::snapshot()` calls `pip freeze > requirements.txt` to save the
55
+ set of installed Python packages;
56
+
57
+ - `renv::restore()` calls `pip install -r requirements.txt` to install
58
+ the previously-recorded set of Python packages.
59
+
60
+
61
+ ### Conda environments
62
+
63
+ When using Conda environments, the following extensions are provided:
64
+
65
+ - `renv::snapshot()` calls `conda env export > environment.yml` to save the
66
+ set of installed Python packages;
67
+
68
+ - `renv::restore()` calls `conda env [create/update] --file environment.yml` to
69
+ install the previously-recorded set of Python packages.
70
+
renv/library/windows/R-4.5/x86_64-w64-mingw32/renv/doc/python.html ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+
5
+ <head>
6
+
7
+ <meta charset="utf-8" />
8
+ <meta name="generator" content="pandoc" />
9
+ <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
+
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+
13
+
14
+
15
+ <title>Using Python with renv</title>
16
+
17
+ <script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
18
+ // be compatible with the behavior of Pandoc < 2.8).
19
+ document.addEventListener('DOMContentLoaded', function(e) {
20
+ var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
21
+ var i, h, a;
22
+ for (i = 0; i < hs.length; i++) {
23
+ h = hs[i];
24
+ if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
25
+ a = h.attributes;
26
+ while (a.length > 0) h.removeAttribute(a[0].name);
27
+ }
28
+ });
29
+ </script>
30
+
31
+ <style type="text/css">
32
+ code{white-space: pre-wrap;}
33
+ span.smallcaps{font-variant: small-caps;}
34
+ span.underline{text-decoration: underline;}
35
+ div.column{display: inline-block; vertical-align: top; width: 50%;}
36
+ div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
37
+ ul.task-list{list-style: none;}
38
+ </style>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <style type="text/css">body {
47
+ background-color: #fff;
48
+ margin: 1em auto;
49
+ max-width: 700px;
50
+ overflow: visible;
51
+ padding-left: 2em;
52
+ padding-right: 2em;
53
+ font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
54
+ font-size: 14px;
55
+ line-height: 1.35;
56
+ }
57
+ #TOC {
58
+ clear: both;
59
+ margin: 0 0 10px 10px;
60
+ padding: 4px;
61
+ width: 400px;
62
+ border: 1px solid #CCCCCC;
63
+ border-radius: 5px;
64
+ background-color: #f6f6f6;
65
+ font-size: 13px;
66
+ line-height: 1.3;
67
+ }
68
+ #TOC .toctitle {
69
+ font-weight: bold;
70
+ font-size: 15px;
71
+ margin-left: 5px;
72
+ }
73
+ #TOC ul {
74
+ padding-left: 40px;
75
+ margin-left: -1.5em;
76
+ margin-top: 5px;
77
+ margin-bottom: 5px;
78
+ }
79
+ #TOC ul ul {
80
+ margin-left: -2em;
81
+ }
82
+ #TOC li {
83
+ line-height: 16px;
84
+ }
85
+ table {
86
+ margin: 1em auto;
87
+ border-width: 1px;
88
+ border-color: #DDDDDD;
89
+ border-style: outset;
90
+ border-collapse: collapse;
91
+ }
92
+ table th {
93
+ border-width: 2px;
94
+ padding: 5px;
95
+ border-style: inset;
96
+ }
97
+ table td {
98
+ border-width: 1px;
99
+ border-style: inset;
100
+ line-height: 18px;
101
+ padding: 5px 5px;
102
+ }
103
+ table, table th, table td {
104
+ border-left-style: none;
105
+ border-right-style: none;
106
+ }
107
+ table thead, table tr.even {
108
+ background-color: #f7f7f7;
109
+ }
110
+ p {
111
+ margin: 0.5em 0;
112
+ }
113
+ blockquote {
114
+ background-color: #f6f6f6;
115
+ padding: 0.25em 0.75em;
116
+ }
117
+ hr {
118
+ border-style: solid;
119
+ border: none;
120
+ border-top: 1px solid #777;
121
+ margin: 28px 0;
122
+ }
123
+ dl {
124
+ margin-left: 0;
125
+ }
126
+ dl dd {
127
+ margin-bottom: 13px;
128
+ margin-left: 13px;
129
+ }
130
+ dl dt {
131
+ font-weight: bold;
132
+ }
133
+ ul {
134
+ margin-top: 0;
135
+ }
136
+ ul li {
137
+ list-style: circle outside;
138
+ }
139
+ ul ul {
140
+ margin-bottom: 0;
141
+ }
142
+ pre, code {
143
+ background-color: #f7f7f7;
144
+ border-radius: 3px;
145
+ color: #333;
146
+ white-space: pre-wrap;
147
+ }
148
+ pre {
149
+ border-radius: 3px;
150
+ margin: 5px 0px 10px 0px;
151
+ padding: 10px;
152
+ }
153
+ pre:not([class]) {
154
+ background-color: #f7f7f7;
155
+ }
156
+ code {
157
+ font-family: Consolas, Monaco, 'Courier New', monospace;
158
+ font-size: 85%;
159
+ }
160
+ p > code, li > code {
161
+ padding: 2px 0px;
162
+ }
163
+ div.figure {
164
+ text-align: center;
165
+ }
166
+ img {
167
+ background-color: #FFFFFF;
168
+ padding: 2px;
169
+ border: 1px solid #DDDDDD;
170
+ border-radius: 3px;
171
+ border: 1px solid #CCCCCC;
172
+ margin: 0 5px;
173
+ }
174
+ h1 {
175
+ margin-top: 0;
176
+ font-size: 35px;
177
+ line-height: 40px;
178
+ }
179
+ h2 {
180
+ border-bottom: 4px solid #f7f7f7;
181
+ padding-top: 10px;
182
+ padding-bottom: 2px;
183
+ font-size: 145%;
184
+ }
185
+ h3 {
186
+ border-bottom: 2px solid #f7f7f7;
187
+ padding-top: 10px;
188
+ font-size: 120%;
189
+ }
190
+ h4 {
191
+ border-bottom: 1px solid #f7f7f7;
192
+ margin-left: 8px;
193
+ font-size: 105%;
194
+ }
195
+ h5, h6 {
196
+ border-bottom: 1px solid #ccc;
197
+ font-size: 105%;
198
+ }
199
+ a {
200
+ color: #0033dd;
201
+ text-decoration: none;
202
+ }
203
+ a:hover {
204
+ color: #6666ff; }
205
+ a:visited {
206
+ color: #800080; }
207
+ a:visited:hover {
208
+ color: #BB00BB; }
209
+ a[href^="http:"] {
210
+ text-decoration: underline; }
211
+ a[href^="https:"] {
212
+ text-decoration: underline; }
213
+
214
+ code > span.kw { color: #555; font-weight: bold; }
215
+ code > span.dt { color: #902000; }
216
+ code > span.dv { color: #40a070; }
217
+ code > span.bn { color: #d14; }
218
+ code > span.fl { color: #d14; }
219
+ code > span.ch { color: #d14; }
220
+ code > span.st { color: #d14; }
221
+ code > span.co { color: #888888; font-style: italic; }
222
+ code > span.ot { color: #007020; }
223
+ code > span.al { color: #ff0000; font-weight: bold; }
224
+ code > span.fu { color: #900; font-weight: bold; }
225
+ code > span.er { color: #a61717; background-color: #e3d2d2; }
226
+ </style>
227
+
228
+
229
+
230
+
231
+ </head>
232
+
233
+ <body>
234
+
235
+
236
+
237
+
238
+ <h1 class="title toc-ignore">Using Python with renv</h1>
239
+
240
+
241
+
242
+ <p>If you’re using renv with an R project that also depends on some
243
+ Python packages (say, through the <a href="https://rstudio.github.io/reticulate/">reticulate</a> package),
244
+ then you may find renv’s Python integration useful.</p>
245
+ <div id="activating-python-integration" class="section level2">
246
+ <h2>Activating Python integration</h2>
247
+ <p>Python integration can be activated on a project-by-project basis.
248
+ Use <code>renv::use_python()</code> to tell renv to create and use a
249
+ project-local Python environment with your project. If the reticulate
250
+ package is installed and active, then renv will use the same version of
251
+ Python that reticulate normally would when generating the virtual
252
+ environment. Alternatively, you can set the
253
+ <code>RETICULATE_PYTHON</code> environment variable to instruct renv to
254
+ use a different version of Python.</p>
255
+ <p>If you’d rather tell renv to use an existing Python virtual
256
+ environment, you can do so by passing the path of that virtual
257
+ environment instead – use
258
+ <code>renv::use_python(python = &quot;/path/to/python&quot;)</code> and renv will
259
+ record and use that Python interpreter with your project. This can also
260
+ be used with pre-existing virtual environments and Conda
261
+ environments.</p>
262
+ </div>
263
+ <div id="understanding-python-integration" class="section level2">
264
+ <h2>Understanding Python integration</h2>
265
+ <p>Once Python integration is active, renv will attempt to manage the
266
+ state of your Python virtual environment when <code>snapshot()</code> /
267
+ <code>restore()</code> is called. With this, projects that use renv and
268
+ Python can ensure that Python dependencies are tracked in addition to R
269
+ package dependencies. Note that future restores will require both
270
+ <code>renv.lock</code> (for R package dependencies) and
271
+ <code>requirements.txt</code> (for Python package dependencies).</p>
272
+ <div id="virtual-environments" class="section level3">
273
+ <h3>Virtual environments</h3>
274
+ <p>When using virtual environments, the following extensions are
275
+ provided:</p>
276
+ <ul>
277
+ <li><p><code>renv::snapshot()</code> calls
278
+ <code>pip freeze &gt; requirements.txt</code> to save the set of
279
+ installed Python packages;</p></li>
280
+ <li><p><code>renv::restore()</code> calls
281
+ <code>pip install -r requirements.txt</code> to install the
282
+ previously-recorded set of Python packages.</p></li>
283
+ </ul>
284
+ </div>
285
+ <div id="conda-environments" class="section level3">
286
+ <h3>Conda environments</h3>
287
+ <p>When using Conda environments, the following extensions are
288
+ provided:</p>
289
+ <ul>
290
+ <li><p><code>renv::snapshot()</code> calls
291
+ <code>conda env export &gt; environment.yml</code> to save the set of
292
+ installed Python packages;</p></li>
293
+ <li><p><code>renv::restore()</code> calls
294
+ <code>conda env [create/update] --file environment.yml</code> to install
295
+ the previously-recorded set of Python packages.</p></li>
296
+ </ul>
297
+ </div>
298
+ </div>
299
+
300
+
301
+
302
+ <!-- code folding -->
303
+
304
+
305
+ <!-- dynamically load mathjax for compatibility with self-contained -->
306
+ <script>
307
+ (function () {
308
+ var script = document.createElement("script");
309
+ script.type = "text/javascript";
310
+ script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
311
+ document.getElementsByTagName("head")[0].appendChild(script);
312
+ })();
313
+ </script>
314
+
315
+ </body>
316
+ </html>