configureEnvironments: Create environments with system installs

View source: R/configureEnvironment.R

configureEnvironmentsR Documentation

Create environments with system installs

Description

Create conda environments during installation of the R package, typically by calling this function in a package's configure file.

Usage

configureEnvironments(src)

Arguments

src

String containing the local path to an R source file that defines the environments to be created.

Details

Sometimes, the lazy creation of new environments is not desirable. For example, administrators of multi-user R instances would not want to create a separate environment in each user's cache. Similarly, users of Docker images would not want to recreate the environment inside every new container.

In these cases, an alternative is to use a “system install”, where the environments are created during R package installation. Each environment is directly created in the package's installation directory and is immediately available when createEnvironment is called. Administrators can enable this mode by setting the BIOCCMAKE_USE_SYSTEM_INSTALL environment variable to 1. Note that this setting takes effect during R package installation so should be set before (re-)installation of basilisk.utils and its dependencies.

Developers can support system installs by adding configure(.win) scripts to the root of their package. These scripts should call configureEnvironments to trigger creation of the conda environments during R package installation. Details of the environments to be created are taken from the src file, which should be executable as a standalone R file (i.e., it can be sourced). Each conda environment is defined as a list with a name ending in _args, where the list contains arguments to createEnvironment.

Packages that support system installs should also set StagedInstall: no in their DESCRIPTION files. This ensures that the conda environments are created with the correct hard-coded paths in the package installation directory.

Value

NULL is invisibly returned. Conda environments are created in the R package installation directory if system installs are enabled. Otherwise, no action is performed.

Author(s)

Aaron Lun

Examples

# If we have a package with an 'R/environments.R' file,
# we could put the following in our 'configure' file.
## Not run: configureEnvironments('R/environments.R')


LTLA/basilisk.utils documentation built on June 11, 2025, 8:56 a.m.