devtools::install_local does not play well with renv in this version of install_local we intercept installation of locally developed packages when we are in a renv managed project and installing a local dependency, it builds a source project into renv cellar and installs it from there. This allows a copy of a locally developed package to be deployed with the renv managed analysis project without specifically being deployed to CRAN or r-universe.

install_local(
  path = ".",
  ...,
  force = TRUE,
  upgrade = "never",
  quiet = TRUE,
  wd = here::here()
)

Arguments

path

path to local directory, or compressed file (tar, zip, tar.gz tar.bz2, tgz2 or tbz)

...

Other arguments passed on to utils::install.packages().

force

Force installation, even if the remote state has not changed since the previous install.

upgrade

Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default" respects the value of the R_REMOTES_UPGRADE environment variable if set, and falls back to "ask" if unset. "ask" prompts the user for which out of date packages to upgrade. For non-interactive sessions "ask" is equivalent to "always". TRUE and FALSE are also accepted and correspond to "always" and "never" respectively.

quiet

If TRUE, suppress output.

wd

the project root directory of the current project (defaults to here::here())

Details

If installed locally for a non-renv project (e.g. a package development) the usual behaviour applies to version management. Installation of new versions of the project will happen when the package is released and then installed from the release location (e.g. github, cran, r-universe).

If a locally developed package is deployed to an renv project once it is released onto a valid distribution platform e.g. CRAN, r-universe or github, we will want to use that version in our renv. This we can do using the rebuild = TRUE option of renv::install, e.g.: renv::install(...pkg name/github..., repo = ...r-universe?..., rebuild = TRUE) followed by a renv::snapshot() to update the lock file. The locally built package version will remain in the <projroot>/renv/local cellar until removed by hand.

Examples

if (FALSE) {
dir <- tempfile()
dir.create(dir)
pkg <- download.packages("testthat", dir, type = "source")
install_local(pkg[, 2])
}