Skip to content

Commit ef83a86

Browse files
committed
fix: deprecated configure_python_environment
1 parent e253ad0 commit ef83a86

10 files changed

+38
-30
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Imports:
2828
fs,
2929
purrr,
3030
readxl,
31-
reticulate (>= 1.41),
31+
reticulate (>= 1.41.0),
3232
stringr,
3333
tidyr,
3434
utils,

R/utils.R

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ split_at <- function(x, pos) unname(split(x, cumsum(seq_along(x) %in% pos)))
351351
#' Configure python environment
352352
#'
353353
#' Configures reticulate environment for parsers that have python dependencies.
354+
#' Deprecated as this should no longer be necessary as of reticulate \code{v. 1.41.0}.
354355
#'
355356
#' @name configure_python_environment
356357
#' @param parser Either \code{aston}, \code{rainbow}, or \code{olefile} (for
@@ -366,30 +367,36 @@ split_at <- function(x, pos) unname(split(x, cumsum(seq_along(x) %in% pos)))
366367
#' @export
367368

368369
configure_python_environment <- function(parser = "all", return_boolean = FALSE){
369-
parser <- match.arg(tolower(parser), c("all", "aston", "olefile", "rainbow"))
370-
install <- FALSE
371-
if (!dir.exists(reticulate::miniconda_path())){
372-
install <- readline(sprintf("It is recommended to install miniconda in your R library to use %s parsers. Install miniconda now? (y/n)",
373-
ifelse(parser == "all", "python-based", parser)))
374-
if (install %in% c('y', "Y", "YES", "yes", "Yes")){
375-
reticulate::install_miniconda()
370+
warning("This function is deprecated as of chromConverter v0.7.4 as
371+
miniconda should no longer be necessary to load python dependencies. Continue anyway...? (y/n)",
372+
immediate. = TRUE)
373+
continue <- readline()
374+
if (continue %in% c('y', "Y", "YES", "yes", "Yes")){
375+
parser <- match.arg(tolower(parser), c("all", "aston", "olefile", "rainbow"))
376+
install <- FALSE
377+
if (!dir.exists(reticulate::miniconda_path())){
378+
install <- readline(sprintf("It is recommended to install miniconda in your R library to use %s parsers. Install miniconda now? (y/n)",
379+
ifelse(parser == "all", "python-based", parser)))
380+
if (install %in% c('y', "Y", "YES", "yes", "Yes")){
381+
reticulate::install_miniconda()
382+
}
376383
}
377-
}
378-
env <- reticulate::configure_environment("chromConverter")
379-
if (!env){
380-
reqs <- get_parser_reqs(parser)
381-
reqs_available <- sapply(reqs, reticulate::py_module_available)
382-
if (!all(reqs_available)){
383-
reticulate::conda_install(envname = "chromConverter",
384-
reqs[which(!reqs_available)], pip = TRUE)
384+
env <- reticulate::configure_environment("chromConverter")
385+
if (!env){
386+
reqs <- get_parser_reqs(parser)
387+
reqs_available <- sapply(reqs, reticulate::py_module_available)
388+
if (!all(reqs_available)){
389+
reticulate::conda_install(envname = "chromConverter",
390+
reqs[which(!reqs_available)], pip = TRUE)
391+
}
392+
}
393+
assign_fn <- switch(parser, aston = assign_trace_file(),
394+
rainbow = assign_rb_read(),
395+
function(){})
396+
assign_fn()
397+
if (return_boolean){
398+
env
385399
}
386-
}
387-
assign_fn <- switch(parser, aston = assign_trace_file(),
388-
rainbow = assign_rb_read(),
389-
function(){})
390-
assign_fn()
391-
if (return_boolean){
392-
env
393400
}
394401
}
395402

man/configure_python_environment.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_agilent_d.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_chemstation_ch.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_chemstation_csv.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_chemstation_uv.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_chroms.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_peaklist.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_shimadzu.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)