From 1025fdbb55b0452c98ed55e7fa6399e2c99d72c0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 7 Apr 2024 15:01:35 +0200 Subject: Improve reticulate startup code --- R/chent.R | 1 - R/zzz.R | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'R') diff --git a/R/chent.R b/R/chent.R index 6d18277..4375305 100644 --- a/R/chent.R +++ b/R/chent.R @@ -24,7 +24,6 @@ #' if (!is.null(caffeine$Picture)) { #' plot(caffeine) #' } - chent <- R6Class("chent", public = list( #' @field identifier (`character(1)`)\cr diff --git a/R/zzz.R b/R/zzz.R index 248f830..f18e559 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,11 +1,9 @@ .onLoad = function(libname, pkgname) { - rdkit_available <- FALSE + conf <- reticulate::py_discover_config("rdkit") + rdkit_available <- conf$available rdkit_module <- try( - reticulate::import("rdkit", delay_load = TRUE), + reticulate::import("rdkit"), silent = TRUE) - if (!inherits(rdkit_module, "try-error")) { - rdkit_available <- TRUE - } assign('rdkit_available', rdkit_available, envir = topenv()) assign('rdkit_module', rdkit_module, envir = topenv()) } -- cgit v1.2.1