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.
Usage
install_local(
path = ".",
...,
force = TRUE,
upgrade = "never",
quiet = TRUE,
wd = here::here()
)Arguments
- path
the package (defaults to
.)- ...
Named arguments passed on to
remotes::install_localsubdirsubdirectory within url bundle that contains the R package.
dependenciesWhich dependencies do you want to check? Can be a character vector (selecting from "Depends", "Imports", "LinkingTo", "Suggests", or "Enhances"), or a logical vector.
TRUEis shorthand for "Depends", "Imports", "LinkingTo" and "Suggests".NAis shorthand for "Depends", "Imports" and "LinkingTo" and is the default.FALSEis shorthand for no dependencies (i.e. just check this package, not its dependencies).The value "soft" means the same as
TRUE, "hard" means the same asNA.You can also specify dependencies from one or more additional fields, common ones include:
Config/Needs/website - for dependencies used in building the pkgdown site.
Config/Needs/coverage for dependencies used in calculating test coverage.
buildIf
TRUEbuild the package before installing.build_optsOptions to pass to
R CMD build, only used whenbuildisTRUE.build_manualIf
FALSE, don't build PDF manual ('–no-manual').build_vignettesIf
FALSE, don't build package vignettes ('–no-build-vignettes').reposA character vector giving repositories to use.
typeType of package to
update....Other arguments passed on to
utils::install.packages().
- force
do the install regardless of versions
- upgrade
upgrade out of data CRAN packages
- quiet
do it quietly
- 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(...pkgname/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.
See also
Other package installation:
install_bioc(),
install_bitbucket(),
install_cran(),
install_dev(),
install_github(),
install_gitlab(),
install_git(),
install_svn(),
install_url(),
install_version()
Examples
if (FALSE) { # \dontrun{
dir <- tempfile()
dir.create(dir)
pkg <- download.packages("testthat", dir, type = "source")
install_local(pkg[, 2])
} # }