Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow delay_load list to list multiple environments #1559

Merged
merged 1 commit into from Mar 26, 2024

Conversation

t-kalinowski
Copy link
Member

@t-kalinowski t-kalinowski commented Mar 26, 2024

This is an internal change allowing usage like this in tensorflow, where length(environment) > 1:

tf <- NULL
.onLoad <- function(libname, pkgname) {
   ...
   tf <<- import("tensorflow", delay_load = list(
     priority = 5, # keras sets priority = 10
     environment = c("r-tensorflow", "r-keras"),
     ...

No doc changes because this mechanism for expressing soft import preferences is overly complex because of legacy support for both conda and virtual envs, (and the priority mechanism is not exposed intentionally).

Most package authors looking to accomplish something similar would be better served by multiple calls to use_python(,required = FALSE), e.g.

tf <- NULL
.onLoad <- function(libname, pkgname) {
   ...
   use_virtualenv("r-tensorflow", required = FALSE)
   use_virtualenv("r-keras", required = FALSE)
   use_condaenv("r-tensorflow", required = FALSE)
   use_condaenv("r-keras", required = FALSE)

   tf <<- import("tensorflow", delay_load = TRUE)
   ...

@t-kalinowski t-kalinowski merged commit e2c1751 into main Mar 26, 2024
14 checks passed
@t-kalinowski t-kalinowski deleted the register-multiple-delay-load-environments branch March 26, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant