diff --git a/NEWS.md b/NEWS.md index c51afb0e7..e194b317a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,8 @@ * New `extract_fit_time()` method has been added that returns the time it took to train the model (#853). +* Ensure that `knit_engine_docs()` has the required packages installed (#1156). + # parsnip 1.2.1 diff --git a/R/engine_docs.R b/R/engine_docs.R index 4806f2754..9355edd3a 100644 --- a/R/engine_docs.R +++ b/R/engine_docs.R @@ -4,9 +4,16 @@ #' @return A tibble with column `file` for the file name and `result` (a #' character vector that echos the output file name or, when there is #' a failure, the error message). +#' @details +#' This function will check whether the known parsnip extension packages, +#' engine specific packages, and a few other ancillary packages are installed. +#' Users will be prompted to install anything required to create the engine +#' documentation. +#' #' @keywords internal #' @export knit_engine_docs <- function(pattern = NULL) { + install_engine_packages() old_cli_opt <- options()$cli.unicode on.exit(options(cli.unicode = old_cli_opt)) options(cli.unicode = FALSE) diff --git a/R/install_packages.R b/R/install_packages.R index 81885bb2f..fdd682634 100644 --- a/R/install_packages.R +++ b/R/install_packages.R @@ -1,3 +1,4 @@ +# Installs packages needed to run `knit_engine_docs()`. install_engine_packages <- function(extension = TRUE, extras = TRUE, ignore_pkgs = c("stats", "liquidSVM", "parsnip")) { @@ -5,12 +6,7 @@ install_engine_packages <- function(extension = TRUE, extras = TRUE, if (extension) { extensions_packages <- extensions() - repositories <- glue::glue("tidymodels/{extensions_packages}") - - remotes::install_github(repositories) - - extensions_packages <- extensions() - purrr::walk(extensions_packages, library, character.only = TRUE) + rlang::check_installed(extensions_packages) bio_pkgs <- c(bio_pkgs, "mixOmics") } @@ -35,7 +31,6 @@ install_engine_packages <- function(extension = TRUE, extras = TRUE, engine_packages <- unique(c(engine_packages, rmd_pkgs)) } - remotes::install_cran(engine_packages) - - remotes::install_bioc(bio_pkgs) + rlang::check_installed(engine_packages) + rlang::check_installed(bio_pkgs) } diff --git a/man/knit_engine_docs.Rd b/man/knit_engine_docs.Rd index 3315d0eb2..5340c0d31 100644 --- a/man/knit_engine_docs.Rd +++ b/man/knit_engine_docs.Rd @@ -18,4 +18,10 @@ a failure, the error message). \description{ Knit engine-specific documentation } +\details{ +This function will check whether the known parsnip extension packages, +engine specific packages, and a few other ancillary packages are installed. +Users will be prompted to install anything required to create the engine +documentation. +} \keyword{internal}