Title: | Package environment support for PIAM |
---|---|
Description: | Enables easier management of package environments, based on renv and conda. |
Authors: | Pascal Sauer [aut, cre], Tonn Rüter [aut] |
Maintainer: | Pascal Sauer <[email protected]> |
License: | LGPL-3 |
Version: | 0.7.1 |
Built: | 2025-03-25 16:20:19 UTC |
Source: | https://github.com/pik-piam/piamenv |
Enables easier management of package environments, based on renv and conda.
Maintainer: Pascal Sauer [email protected]
Authors:
Tonn Rüter [email protected]
Useful links:
Writes a new <timestamp>_renv.lock based on the current package environment into renv::project()/renv/archive.
archiveRenv()
archiveRenv()
Invisibly, the absolute path to the created lockfile.
Pascal Sauer
Check if package requirements specified in the given DESCRIPTION are met.
checkDeps( descriptionFile = ".", dependencyTypes = c("Depends", "Imports", "LinkingTo"), action = "stop" )
checkDeps( descriptionFile = ".", dependencyTypes = c("Depends", "Imports", "LinkingTo"), action = "stop" )
descriptionFile |
Path to a DESCRIPTION file or a path that belongs to a
source package project. If |
dependencyTypes |
The types of dependencies to check. Must be a
subset of |
action |
Action to take on unmet dependencies:
|
Invisibly, a named list of strings indicating whether each package
requirement is met ("TRUE"
) or not, in which case the reason is stated.
Pascal Sauer, Michaja Pehl
checkDeps(system.file("DESCRIPTION", package = "piamenv"))
checkDeps(system.file("DESCRIPTION", package = "piamenv"))
Determine initialization commands to make conda available
condaInit(how = "", log = NULL, verbose = 0)
condaInit(how = "", log = NULL, verbose = 0)
how |
Method to activate conda if not found (e.g., "pik-cluster") |
log |
Path to log file or NULL to use stdout |
verbose |
Verbosity level (0 for silent, higher for more verbose) |
List containing 'setup' and 'teardown' commands, and environment variables ('env').
Run a command in a specified conda environment with given environment variables.
condaRun( cmd, path, env = c(), init = list(setup = "", teardown = ""), log = NULL, verbose = 0 )
condaRun( cmd, path, env = c(), init = list(setup = "", teardown = ""), log = NULL, verbose = 0 )
cmd |
Command to run in the conda environment |
path |
Path to the conda environment |
env |
Named vector of environment variables to set, i.e., c("VAR0" = "value0", "VAR1" = "value1") |
init |
List containing 'setup' and 'teardown' commands to run before and after the command |
log |
Path to log file or NULL to use stdout |
verbose |
Verbosity level (0 for silent, higher for more verbose). |
Invisible NULL
Automatically install package versions as suggested by piamenv::checkDeps into an renv.
fixDeps( ask = FALSE, requirementMet = checkDeps(action = if (ask) "note" else "pass") )
fixDeps( ask = FALSE, requirementMet = checkDeps(action = if (ask) "note" else "pass") )
ask |
Whether to ask before fixing dependencies. |
requirementMet |
The output of piamenv::checkDeps. |
Invisibly, the return value of renv::install.
Pascal Sauer
Install dependencies, identified by renv::dependencies for a given path, into the current renv.
installDeps(path)
installDeps(path)
path |
The path to scan for dependencies. |
Pascal Sauer
Restores the current renv to the state described in the given lockfile. If multiple lockfiles are given, ask the user which one to restore.
restoreRenv( lockfile = Sys.glob(c("output/*/*renv.lock", "renv/archive/*renv.lock")) )
restoreRenv( lockfile = Sys.glob(c("output/*/*renv.lock", "renv/archive/*renv.lock")) )
lockfile |
One or more paths to lockfiles. The default value assumes an output folder with run folders containing renv.lock files, and/or an renv/archive folder with renv.lock files. |
Invisibly, the return value of renv::restore.
Pascal Sauer
All PIK-PIAM packages in the current renv that are development versions, i.e.
that have a non-zero fourth version number component (e.g. 0.4.3.9001
), are
reverted to the highest version lower than the development versions (e.g.
0.4.3
).
revertDevelopmentVersions()
revertDevelopmentVersions()
Invisibly the return value of renv::install()
.
Print available updates of the given packages.
showUpdates(packages = piamPackages())
showUpdates(packages = piamPackages())
packages |
A character vector of package names. |
Invisibly, a data.frame as returned by utils::old.packages
Throw an error if any of the given packages is loaded.
stopIfLoaded(updatedPackage)
stopIfLoaded(updatedPackage)
updatedPackage |
One or more names of packages that were just updated. |
This is useful after updating packages. If any of the updated packages was loaded before the update R might crash when trying to lazy load a function from the updated package.
Pascal Sauer
## Not run: updates <- piamenv::fixDeps() piamenv::stopIfLoaded(names(updates)) updates <- piamenv::updateRenv() piamenv::stopIfLoaded(names(updates)) ## End(Not run)
## Not run: updates <- piamenv::fixDeps() piamenv::stopIfLoaded(names(updates)) updates <- piamenv::updateRenv() piamenv::stopIfLoaded(names(updates)) ## End(Not run)
Update all PIK-PIAM packages in the current renv, write renv.lock into archive.
updateRenv(exclude = NULL)
updateRenv(exclude = NULL)
exclude |
vector of packages not to be updated |
Invisibly, the return value of renv::update.
Pascal Sauer