From c428e51f0dabe6ef2a83467d2035b768c60340b3 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Fri, 20 Mar 2026 15:16:10 +0000 Subject: [PATCH 1/3] deprecate `check_metrics()` --- NEWS.md | 2 ++ R/checks.R | 6 +++++- man/empty_ellipses.Rd | 4 +++- tests/testthat/_snaps/checks.md | 9 +++++++++ tests/testthat/test-checks.R | 8 ++++++++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 59532237c..9c4944eed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # tune (development version) +* `check_metrics()` is deprecated in favor of `check_metrics_arg()` (#1160). + * 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/checks.R b/R/checks.R index b3e19700a..c55774d8d 100644 --- a/R/checks.R +++ b/R/checks.R @@ -384,8 +384,12 @@ check_extra_tune_parameters <- function(x) { #' @export #' @keywords internal #' @rdname empty_ellipses -#' @param object A `workflow` object. +#' @param object +#' `r lifecycle::badge("deprecated")` +#' +#' A `workflow` object. check_metrics <- function(x, object) { + lifecycle::deprecate_warn("2.1.0", "check_metrics()", "check_metrics_arg()") mode <- extract_spec_parsnip(object)$mode if (is.null(x)) { diff --git a/man/empty_ellipses.Rd b/man/empty_ellipses.Rd index a48166786..58850f301 100644 --- a/man/empty_ellipses.Rd +++ b/man/empty_ellipses.Rd @@ -116,7 +116,9 @@ is_workflow(x) \item{check_dials}{A logical for check for a NULL parameter object.} -\item{object}{A \code{workflow} object.} +\item{object}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +A \code{workflow} object.} \item{resamples}{An \code{rset} object.} diff --git a/tests/testthat/_snaps/checks.md b/tests/testthat/_snaps/checks.md index cf341564f..549540f76 100644 --- a/tests/testthat/_snaps/checks.md +++ b/tests/testthat/_snaps/checks.md @@ -150,6 +150,15 @@ Error in `tune:::check_metrics()`: ! The parsnip model has `mode = 'classification'`, but `metrics` is a metric set for a different model mode. +# check_metrics() is deprecated + + Code + metric <- check_metrics(NULL, wflow) + Condition + Warning: + `check_metrics()` was deprecated in tune 2.1.0. + i Please use `check_metrics_arg()` instead. + # grid control objects Code diff --git a/tests/testthat/test-checks.R b/tests/testthat/test-checks.R index 179caec46..45bef48db 100644 --- a/tests/testthat/test-checks.R +++ b/tests/testthat/test-checks.R @@ -286,6 +286,7 @@ test_that("workflow objects (will not tune, tidymodels/tune#548)", { test_that("yardstick objects", { skip_if_not_installed("splines2") + withr::local_options(lifecycle_verbosity = "quiet") spline_rec <- recipes::recipe(ridership ~ ., data = head(Chicago)) |> @@ -326,6 +327,7 @@ test_that("yardstick objects", { }) test_that("metrics must match the parsnip engine", { + withr::local_options(lifecycle_verbosity = "quiet") metric_set1 <- yardstick::metric_set(yardstick::accuracy) metric_set2 <- yardstick::metric_set(yardstick::rmse) @@ -344,6 +346,12 @@ test_that("metrics must match the parsnip engine", { }) }) +test_that("check_metrics() is deprecated", { + mod <- parsnip::rand_forest(mode = "regression") + wflow <- add_model(workflow(), mod) + expect_snapshot(metric <- check_metrics(NULL, wflow)) +}) + # ------------------------------------------------------------------------------ test_that("grid control objects", { From 5daa9f832808816285deed662deed768d1716520 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Fri, 20 Mar 2026 15:38:33 +0000 Subject: [PATCH 2/3] add lifecycle to Imports --- 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 c3e9c4c8bdb528dcc8f15ad9350005d52bdde3e2 Mon Sep 17 00:00:00 2001 From: Hannah Frick Date: Fri, 20 Mar 2026 15:38:59 +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,