From 3a22785d78b4d5fec354970e09c9c3c3c1798411 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Tue, 3 Sep 2024 14:31:05 -0400 Subject: [PATCH 1/3] Support `RETICULATE_VIRTUALENV_ROOT` env var as requested by CRAN via email --- R/virtualenv.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/virtualenv.R b/R/virtualenv.R index f50065f2a..4cbfe61be 100644 --- a/R/virtualenv.R +++ b/R/virtualenv.R @@ -333,6 +333,10 @@ virtualenv_list <- function() { #' @rdname virtualenv-tools #' @export virtualenv_root <- function() { + root <- Sys.getenv("RETICULATE_VIRTUALENV_ROOT", NA_character_) + if (!is.na(root)) + return(root) + Sys.getenv("WORKON_HOME", unset = "~/.virtualenvs") } From 481fdd1dc345f3f5c4b27081b112fcb09e82cdf5 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Tue, 3 Sep 2024 16:48:24 -0400 Subject: [PATCH 2/3] add NEWS --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 301686c57..16753cc80 100644 --- a/NEWS.md +++ b/NEWS.md @@ -35,6 +35,9 @@ - New `as.character()` method for `python.builtin.str` with support for handling embedded NULs in strings. (#1653) + +- Reticulate will now use the `RETICULATE_VIRTUALENV_ROOT` environment variable + when determining where to resolve virtual environments. (#1657) # reticulate 1.38.0 From 3db261b7c17597a731117fa367de90f840503bd4 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Tue, 3 Sep 2024 16:50:25 -0400 Subject: [PATCH 3/3] update docs. --- R/virtualenv.R | 2 +- man/virtualenv-tools.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/virtualenv.R b/R/virtualenv.R index 4cbfe61be..fca56b89c 100644 --- a/R/virtualenv.R +++ b/R/virtualenv.R @@ -5,7 +5,7 @@ #' #' Virtual environments are by default located at `~/.virtualenvs` (accessed #' with the `virtualenv_root()` function). You can change the default location -#' by defining the `WORKON_HOME` environment variable. +#' by defining the `RETICULATE_VIRTUALENV_ROOT` or `WORKON_HOME` environment variables. #' #' Virtual environments are created from another "starter" or "seed" Python #' already installed on the system. Suitable Pythons installed on the system are diff --git a/man/virtualenv-tools.Rd b/man/virtualenv-tools.Rd index c1fede5be..2f8eac209 100644 --- a/man/virtualenv-tools.Rd +++ b/man/virtualenv-tools.Rd @@ -128,7 +128,7 @@ R functions for managing Python \href{https://virtualenv.pypa.io/en/stable/}{vir \details{ Virtual environments are by default located at \verb{~/.virtualenvs} (accessed with the \code{virtualenv_root()} function). You can change the default location -by defining the \code{WORKON_HOME} environment variable. +by defining the \code{RETICULATE_VIRTUALENV_ROOT} or \code{WORKON_HOME} environment variables. Virtual environments are created from another "starter" or "seed" Python already installed on the system. Suitable Pythons installed on the system are