From 32cb3b0b004e9ac40b7bfc61efafcdc2a84d44c5 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Wed, 18 Mar 2026 14:41:59 +0000 Subject: [PATCH 1/3] deprecate `finalize_workflow_preprocessor()` --- NEWS.md | 2 ++ R/grid_helpers.R | 6 ++++++ man/tune-internal-functions.Rd | 4 ++++ tests/testthat/_snaps/grid.md | 8 ++++++++ tests/testthat/test-grid.R | 9 +++++++++ 5 files changed, 29 insertions(+) diff --git a/NEWS.md b/NEWS.md index 88281ac93..de8c10cc5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # tune (development version) +* `finalize_workflow_preprocessor()` is deprecated (#1157). + * Model tuning has been enabled for quantile regression models. (#1125) * In `tune_grid()`, a bug was fixed that caused inefficiency where preprocessing steps were applied to data being predicted several times (redundantly). We now execute that operation once. (#1101) diff --git a/R/grid_helpers.R b/R/grid_helpers.R index c64747fa5..32c593b77 100644 --- a/R/grid_helpers.R +++ b/R/grid_helpers.R @@ -114,7 +114,13 @@ has_metrics_by <- function(metrics_by) { #' @export #' @rdname tune-internal-functions +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `finalize_workflow_preprocessor()` is deprecated. finalize_workflow_preprocessor <- function(workflow, grid_preprocessor) { + lifecycle::deprecate_warn("2.1.0", "finalize_workflow_preprocessor()") + # Already finalized, nothing to tune if (ncol(grid_preprocessor) == 0L) { return(workflow) diff --git a/man/tune-internal-functions.Rd b/man/tune-internal-functions.Rd index 7107176c9..01ee44a51 100644 --- a/man/tune-internal-functions.Rd +++ b/man/tune-internal-functions.Rd @@ -67,6 +67,10 @@ always unique and do not represent a tuning "issue" can bypass the cataloger by setting \code{catalog = FALSE}.} } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{finalize_workflow_preprocessor()} is deprecated. + These are not to be meant to be invoked directly by users. } \keyword{internal} diff --git a/tests/testthat/_snaps/grid.md b/tests/testthat/_snaps/grid.md index 4479b56bc..1920e7582 100644 --- a/tests/testthat/_snaps/grid.md +++ b/tests/testthat/_snaps/grid.md @@ -65,3 +65,11 @@ 9 Fold09 10 Fold10 +# finalize_workflow_preprocessor() is deprecated + + Code + wflow <- finalize_workflow_preprocessor(wflow, grid) + Condition + Warning: + `finalize_workflow_preprocessor()` was deprecated in tune 2.1.0. + diff --git a/tests/testthat/test-grid.R b/tests/testthat/test-grid.R index 19f64495b..5618b2dc1 100644 --- a/tests/testthat/test-grid.R +++ b/tests/testthat/test-grid.R @@ -787,3 +787,12 @@ test_that("retain extra attributes", { expect_null(attr(res, "workflow")) expect_true(inherits(attr(res2, "workflow"), "workflow")) }) + +test_that("finalize_workflow_preprocessor() is deprecated", { + helper_objects <- helper_objects_tune() + wflow <- workflow() |> + add_recipe(helper_objects$rec_tune_1) |> + add_model(helper_objects$lm_mod) + grid <- tibble::tibble(num_comp = 1L) + expect_snapshot(wflow <- finalize_workflow_preprocessor(wflow, grid)) +}) From 3c00297a59c751e75aaabab375f0859ff664e7b0 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Wed, 18 Mar 2026 15:12:22 +0000 Subject: [PATCH 2/3] add lifecycle --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 7ceff712f..c39b65a9a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,6 +26,7 @@ Imports: glue (>= 1.6.2), GauPro (>= 0.2.15), hardhat (>= 1.4.2), + lifecycle, parallel, parsnip (>= 1.4.1.9002), purrr (>= 1.0.0), From 89459180ab51d648919ad7486e3d53be3f250e1c Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Wed, 18 Mar 2026 15:12:57 +0000 Subject: [PATCH 3/3] `use_tidy_description()` --- DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c39b65a9a..f018bcc86 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,8 +10,8 @@ Authors@R: c( Description: The ability to tune models is important. 'tune' contains functions and classes to be used in conjunction with other 'tidymodels' packages for finding reasonable values of - hyper-parameters in models, preprocessing methods, and - post-processing steps. + hyper-parameters in models, preprocessing methods, and post-processing + steps. License: MIT + file LICENSE URL: https://tune.tidymodels.org/, https://github.com/tidymodels/tune BugReports: https://github.com/tidymodels/tune/issues @@ -21,10 +21,10 @@ Imports: cli (>= 3.3.0), dials (>= 1.3.0.9000), dplyr (>= 1.1.0), + GauPro (>= 0.2.15), generics (>= 0.1.2), ggplot2, glue (>= 1.6.2), - GauPro (>= 0.2.15), hardhat (>= 1.4.2), lifecycle, parallel,