Skip to content

Commit

Permalink
docs: use lifecycle for deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Aug 23, 2024
1 parent 0411c4d commit 7d7a4bb
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 3 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Depends: R (>= 4.1.0)
Imports:
dplyr,
glue,
lifecycle,
polars (>= 0.18.0),
rlang,
tidyr,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,6 @@ import(dplyr)
import(polars)
import(rlang)
import(tidyr)
importFrom(lifecycle,deprecated)
importFrom(polars,as_polars_df)
importFrom(polars,as_polars_lf)
8 changes: 7 additions & 1 deletion R/describe.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#' @param .data A Polars DataFrame.
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' This function is deprecated as of tidypolars 0.10.0, it will be removed in
#' a future update. Use `summary()` with the same arguments instead.
#'
Expand All @@ -12,7 +14,11 @@ describe <- function(.data, percentiles = c(0.25, 0.75)) {
if (!inherits(.data, "RPolarsDataFrame")) {
rlang::abort("`describe()` can only be used on a DataFrame.")
}
rlang::warn("`describe()` is deprecated as of tidypolars 0.10.0 and will be removed in a future update.\nUse `summary()` with the same arguments instead.")
lifecycle::deprecate_warn(
when = "0.10.0",
what = "describe()",
details = "Please use `summary()` with the same arguments instead."
)
summary(object = .data, percentiles = percentiles)
}

14 changes: 12 additions & 2 deletions R/plan.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' @inherit explain.RPolarsLazyFrame title
#'
#' @description
#' `r lifecycle::badge("deprecated")`
#'
#' Those functions are deprecated as of tidypolars 0.10.0, they will be removed
#' in a future update. Use `explain()` with `optimized = FALSE` to recover the
#' output of `describe_plan()`, and with `optimized = TRUE` (the default) to
Expand All @@ -14,7 +16,11 @@ describe_plan <- function(.data) {
if (!inherits(.data, "RPolarsLazyFrame")) {
rlang::abort("`describe_plan()` only works on a LazyFrame.")
}
rlang::warn("`describe_plan()` is deprecated as of tidypolars 0.10.0 and will be removed in a future update.\nUse `explain()` with `optimized = FALSE` instead.")
lifecycle::deprecate_warn(
when = "0.10.0",
what = "describe_plan()",
details = "Please use `explain(optimized = FALSE)` instead."
)
.data$describe_plan()
}

Expand All @@ -25,7 +31,11 @@ describe_optimized_plan <- function(.data) {
if (!inherits(.data, "RPolarsLazyFrame")) {
rlang::abort("`describe_optimized_plan()` only works on a LazyFrame.")
}
rlang::warn("`describe_optimized_plan()` is deprecated as of tidypolars 0.10.0 and will be removed in a future update.\nUse `explain()` with `optimized = TRUE` instead.")
lifecycle::deprecate_warn(
when = "0.10.0",
what = "describe_optimized_plan()",
details = "Please use `explain()` instead."
)
.data$describe_optimized_plan()
}
# nocov end
7 changes: 7 additions & 0 deletions R/tidypolars-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
#' @importFrom lifecycle deprecated
## usethis namespace: end
NULL
2 changes: 2 additions & 0 deletions man/describe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/describe_plan.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/figures/lifecycle-deprecated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-experimental.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions man/figures/lifecycle-stable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions man/figures/lifecycle-superseded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions man/tidypolars-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d7a4bb

Please sign in to comment.