createLocalBasiliskEnv: Create a local conda environment manually

View source: R/createLocalBasiliskEnv.R

createLocalBasiliskEnvR Documentation

Create a local conda environment manually

Description

Manually create a local conda environment with versioning and thread safety. This is intended for use in analysis workflows rather than package development.

Usage

createLocalBasiliskEnv(dir, ...)

Arguments

dir

String containing the path to a directory in which the local environment is to be stored.

...

Further arguments to pass to setupBasiliskEnv.

Details

This function is intended for end users who wish to use the basilisk machinery for coordinating one or more Python environments in their analysis workflows. It can be inserted into, e.g., Rmarkdown reports to automatically provision and cache an environment on first compilation, which will be automatically re-used in later compilations. Some care is taken to ensure that the cached environment is refreshed when basilisk is updated, and that concurrent access to the environment is done safely.

Value

String containing a path to the newly created environment, or to an existing environment if one was previously created. This can be used in basiliskRun.

Author(s)

Aaron Lun

Examples

if (.Platform$OS.type != "windows") {
 tmploc <- file.path(tempdir(), "my_package_C")
 tmp <- createLocalBasiliskEnv(tmploc, packages="pandas==1.4.3")
 basiliskRun(env=tmp, fun=function() { 
     X <- reticulate::import("pandas"); X$`__version__` 
 }, testload="pandas")
}


LTLA/jormungandR documentation built on Nov. 3, 2024, 3:06 p.m.