Giter VIP home page Giter VIP logo

lifecycle's Introduction

lifecycle

R-CMD-check

lifecycle provides a set of tools and conventions to manage the life cycle of your exported functions.

  • For a general motivation and introduction to the key concepts, watch Hadley's rstudio::global(2021) keynote "Maintaining the house that the tidyverse built".

  • Read vignette("stages") to learn what it means for a function to be experimental, stable, deprecated, or superseded.

  • Read vignette("manage") to learn how to manage lifecycle changes in functions that you use.

  • Read vignette("communicate") to learn how to communicate lifecycle changes in the functions you write.

Installation

# Install release version from CRAN
install.packages("lifecycle")

# Install development version from GitHub
pak::pak("r-lib/lifecycle")

Code of Conduct

Please note that the lifecycle project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

lifecycle's People

Contributors

batpigandme avatar bisaloo avatar davidchall avatar davisvaughan avatar dpprdan avatar hadley avatar hfrick avatar jarauh avatar jimhester avatar krlmlr avatar lionel- avatar maelle avatar njtierney avatar salim-b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lifecycle's Issues

Awkward to deprecate a function in favour of a different function called with a specific argument

I want to soft deprecate usethis::use_pkgdown_travis() and strongly encourage people to call use_github_action("pkgdown") instead.

It was pretty fiddly to figure out how to express that without getting an Internal error. But even once I did, it feels like this message is sort of weird? I was forced to say use_github_action(name = "pkgdown") and now it feels like the big change is to specify the name argument, but the main point is to call an entirely different function. (ignore Error: Package doesn't use pkgdown -- totally separate thing)

> use_pkgdown_travis()
Error: Package doesn't use pkgdown.
Do you need to call `use_pkgdown()`?
In addition: Warning message:
`use_pkgdown_travis()` is deprecated as of lifecycle 2.0.0.
Please use the `name` argument of `use_github_action()` instead.

Produced by this code:

lifecycle::deprecate_soft(
    when = "2.0.0",
    what = "use_pkgdown_travis()",
    with = 'use_github_action(name = "pkgdown")'
  )

"retired" is not documented

https://lifecycle.r-lib.org/reference/badge.html says the argument of badge() can be

one of: "experimental", "maturing", "stable", "questioning", "archived", "soft-deprecated", "deprecated", "defunct".

But, I found "retired" is used in https://dplyr.tidyverse.org/dev/reference/top_n.html.

As a side question, what's the relationship between the stages lifecycle package provides and the ones on https://www.tidyverse.org/lifecycle/? I know the former is for functions and arguments while the latter is for packages, so they can be different. But, I also don't feel these are two different things.

(Sorry if this is not the right place to ask here...)

lifecycle and testthat when run via revdepcheck makes "lifecycle" suggestion toward the wrong package

Not sure where this should be reported, but I suspect it's related to the lifecycle packaage due to the following "lifecycle" suggestions, so I figured I report it here.

Below is the testthat output produced for SpaDES.core when running revdepcheck::revdep_check() on my future package. The output makes suggestions toward my future package and not toward SpaDES.core. That doesn't look right.

$ cat revdep/checks/SpaDES.core/new/SpaDES.core.Rcheck/tests/test-all.Rout
...
> library(testthat)
> test_check("SpaDES.core")
Loading required package: SpaDES.core
Loading required package: quickPlot
Loading required package: reproducibleSetting active project to '/wynton/home/cbi/hb/repositories/future'Copy and paste the following lines into '/wynton/home/cbi/hb/repositories/future/R/future-package.R':
  ## usethis namespace: start
  #' @importFrom lifecycle deprecate_soft
  ## usethis namespace: end
  NULLCopied SVG badges to 'man/figures/'Add badges in documentation topics by inserting one of:
  - \lifecycle{experimental}
  - \lifecycle{maturing}
  - \lifecycle{stable}
  - \lifecycle{superseded}
  - \lifecycle{questioning}
  - \lifecycle{soft-deprecated}
  - \lifecycle{deprecated}
  - \lifecycle{defunct}
  - \lifecycle{archived}

Attaching package: 'SpaDES.core'

This is with:

> packageVersion("lifecycle")
[1] ‘0.2.0> packageVersion("testthat")                                                                                                        
[1] ‘2.3.2> packageVersion("revdepcheck")
[1] ‘1.0.0.9001

"questioning" is a non-intuitive stage name.

"questioning" is a non-intuitive stage name that genuinely confused me (native English speaker). All the other stage names for both functions and packages modify the software itself, whereas "questioning" is an action of the developer (an exception to parallel structure). Just as "retired" was recently replaced with "superseded", I suggest replacing "questioning" with "questioned" or some equivalent adjective.

Function badges don't play nice with RStudio Comment Reflow

When I write up roxygen documentation, I like to use the RStudio "Reflow Comment" shortcut to word wrap comments at the default ruler position. I also put lifecycle badges at the top of the description section. What happens when I use both, is that the description text gets placed on the same line as the badge which doesn't render properly downstream.

Roxygen pre-reflow

#' Some title
#'
#' \lifecycle{maturing}
#' This is the function description

Roxygen after reflow

#' Some title
#'
#' \lifecycle{maturing} This is the function description

Can we drop warning advice from last_warnings()?

Instead of:

message: `data_frame()` is deprecated as of tibble 1.1.0.
Please use `tibble()` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
backtrace:

Could we show:

<deprecated>
message: `data_frame()` is deprecated as of tibble 1.1.0.
Please use `tibble()` instead.
backtrace:

?

(Also note that backtrace should get a capital letter and should be bolded to match last_trace())

Support more than one alternative?

lifecycle::deprecate_soft("1.0.0", "as_tibble()", with = c("as_tibble_row()", "tibble()"))
#> Error in lifecycle_build_message(when, what, with, details, "deprecate_soft"): is_null(with) || is_string(with) is not TRUE

Created on 2020-03-24 by the reprex package (v0.3.0)

Simplify options

options(lifecycle_verbosity = c("quiet", "default", "warning", "error"))

expect_deprecated() doesn't throw error

Hi there,

I'm expecting this line to fail in a test however it passes:

expect_deprecated(as.numeric("a"))

I suspect that it is because expect_deprecated checks for the presence of warnings instead of for deprecation

Example demonstrating how to deprecate 2 arguments in the same function?

I find the example for the functions deprecated and is_present helpful for learning how to use these functions. However, I have been struggling to apply them in a succinct way when deprecating multiple arguments in the same function. Is there an example of deprecating 2 or more arguments in the same function, using a for loop or apply statement to avoid writing multiple if statements and calls to deprecate_warn in the function?

Please let me know if it would be helpful to provide a more specific example!

tools::checkTnF() shows unknown macro warning

tools::checkTnF(dir = ".") shows the following warnings when used on a package repository, {lifecyle} in this case:

> tools::checkTnF(dir = ".")
Warning messages:
1: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:47: unknown macro '\lifecycle'
2: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:48: unknown macro '\lifecycle'
3: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:49: unknown macro '\lifecycle'
4: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:50: unknown macro '\lifecycle'
5: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:51: unknown macro '\lifecycle'
6: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:52: unknown macro '\lifecycle'
7: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:53: unknown macro '\lifecycle'
8: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:54: unknown macro '\lifecycle'
9: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/badge.Rd:55: unknown macro '\lifecycle'
10: In parse_Rd("C:/Users/dpprdan/Documents/R/github/lifecycle/man/signal_experimental.Rd",  :
  C:/Users/dpprdan/Documents/R/github/lifecycle/man/signal_experimental.Rd:26: unknown macro '\lifecycle'

This is comparable to #19, ropensci/spelling#42, ropensci/spelling#44, but since tools is a base package, it is not as easily fixed (plus checkTnF() does not allow passing on custom macros, as e.g. parse_Rd()).

Can this be fixed on the {lifecyle} side? Or would this require changes in checksTnF()?

I stumbled upon this while using goodpractice::gp() where tools::checkTnF(dir = ".") is one of the checks run.

Reset warnings?

Should we provide a function to reset the seen status of all warnings? Then we could say:

`data_frame()` is deprecated as of tibble 1.1.0.
Please use `tibble()` instead.
This warning is displayed once every 8 hours. Use `lifecycle::reset()` to see again.
Call `lifecycle::last_warnings()` to see where this warning was generated. 

Use inline R code for badges

Would you help me understand why usethis::use_lifecycle() adds lifecycle to Imports rather than Suggests?

> library(usethis)
> use_lifecycle()
✔ Setting active project to '/home/landau/projects/drake'Adding 'lifecycle' to Imports field in DESCRIPTION
...

I am new to lifecycle, and I am happy to see that tidyverse lifecycle badges have become more widely available.

Minor: parse_Rd() does not find \lifecycle macro in spell check

git2r::clone( # Downloaded 445f7f69871917344d8e53a3c0064e177ab7c7dc
  url = "https://github.com/r-lib/lifecycle",
  local_path = "lifecycle"
)
#> cloning into 'lifecycle'...
#> Receiving objects:   1% (9/880),   14 kb
#> Receiving objects:  11% (97/880),   30 kb
#> Receiving objects:  21% (185/880),   94 kb
#> Receiving objects:  31% (273/880),  110 kb
#> Receiving objects:  41% (361/880),  135 kb
#> Receiving objects:  51% (449/880),  151 kb
#> Receiving objects:  61% (537/880),  167 kb
#> Receiving objects:  71% (625/880),  167 kb
#> Receiving objects:  81% (713/880),  182 kb
#> Receiving objects:  91% (801/880),  190 kb
#> Receiving objects: 100% (880/880),  240 kb, done.
#> Local:    master /tmp/Rtmps7O5k7/reprex42c4379faa10/lifecycle
#> Remote:   master @ origin (https://github.com/r-lib/lifecycle)
#> Head:     [445f7f6] 2019-08-09: Add `is_present()` (#15)
spelling::spell_check_package("lifecycle")
#> DESCRIPTION does not contain 'Language' field. Defaulting to 'en-US'.
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:47: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:48: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:49: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:50: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:51: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:52: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:53: unknown macro
#> '\lifecycle'
#> Warning in parse_Rd(ifile, encoding = encoding, macros = macros): /tmp/
#> Rtmps7O5k7/reprex42c4379faa10/lifecycle/man/badge.Rd:54: unknown macro
#> '\lifecycle'
#>   WORD               FOUND IN
#> backtrace          last_warnings.Rd:14,22,23
#>                    NEWS.md:13
#> backtraces         NEWS.md:13
#>                    lifecycle.Rmd:155,198
#> behaviour          deprecate_soft.Rd:68
#>                    lifecycle.Rmd:38,40,42
#> Codecov            README.md:6
#> conjuction         lifecycle.Rmd:198
#> invokation         lifecycle.Rmd:85
#> programmatically   deprecate_soft.Rd:38
#> questining         README.md:27
#>                    lifecycle.Rmd:23
#> rlang's            NEWS.md:30
#> signalled          lifecycle-package.Rd:16
#>                    description:8
#> signaller          NEWS.md:18,24
#> summarised         lifecycle.Rmd:32
#> testthat           deprecate_soft.Rd:43
#>                    verbosity.Rd:11
#>                    lifecycle.Rmd:83
#> ther               lifecycle.Rmd:83

Created on 2019-08-12 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.0 (2019-04-26)
#>  os       Ubuntu 18.04.2 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2019-08-12                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                        
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                
#>  backports     1.1.4      2019-04-10 [1] CRAN (R 3.6.0)                
#>  callr         3.3.1      2019-07-18 [1] CRAN (R 3.6.0)                
#>  cli           1.1.0      2019-03-19 [1] CRAN (R 3.6.0)                
#>  commonmark    1.7        2018-12-01 [1] CRAN (R 3.6.0)                
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                
#>  desc          1.2.0      2018-05-01 [1] CRAN (R 3.6.0)                
#>  devtools      2.1.0      2019-07-06 [1] CRAN (R 3.6.0)                
#>  digest        0.6.20     2019-07-04 [1] CRAN (R 3.6.0)                
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                
#>  git2r         0.26.1     2019-06-29 [1] CRAN (R 3.6.0)                
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                
#>  htmltools     0.3.6      2017-04-28 [1] CRAN (R 3.6.0)                
#>  hunspell      3.0        2018-12-15 [1] CRAN (R 3.6.0)                
#>  knitr         1.24       2019-08-08 [1] CRAN (R 3.6.0)                
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.0)                
#>  pkgbuild      1.0.4      2019-08-05 [1] CRAN (R 3.6.0)                
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.0)                
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.6.0)                
#>  processx      3.4.1      2019-07-18 [1] CRAN (R 3.6.0)                
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                
#>  R6            2.4.0      2019-02-14 [1] CRAN (R 3.6.0)                
#>  Rcpp          1.0.2      2019-07-25 [1] CRAN (R 3.6.0)                
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.0)                
#>  rlang         0.4.0      2019-06-25 [1] CRAN (R 3.6.0)                
#>  rmarkdown     1.14       2019-07-12 [1] CRAN (R 3.6.0)                
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                
#>  spelling      2.1        2019-03-11 [1] CRAN (R 3.6.0)                
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                
#>  testthat      2.2.1      2019-07-25 [1] CRAN (R 3.6.0)                
#>  usethis       1.5.1.9000 2019-08-11 [1] Github (r-lib/usethis@b241420)
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                
#>  xfun          0.8        2019-06-25 [1] CRAN (R 3.6.0)                
#>  xml2          1.2.2      2019-08-09 [1] CRAN (R 3.6.0)                
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                
#> 
#> [1] /home/landau/R/R-3.6.0/library

Lifecycle API

Deprecating functions

Deprecation without replacement:

warn_deprecated("0.3.0", "foo")
#> `foo()` is deprecated as of rlang 0.3.0

Deprecation with replacement

warn_deprecated("0.3.0", "foo", "bar")
#> `foo()` is deprecated as of rlang 0.3.0.
#> Please use `bar()` instead.

Just specify the namespace when replacement is in another package:

warn_deprecated("0.3.0", "foo", "otherpackage::bar")
#> `foo()` is deprecated as of rlang 0.3.0.
#> Please use `otherpackage::bar()` instead.

The package of the deprecated function is inferred from the caller env, but could also be specified manually if needed:

warn_deprecated("0.3.0", "otherpackage::foo")
#> `foo()` is deprecated as of otherpackage 0.3.0.

It is encouraged to provide details about the replacement:

details <- "

  # Before:
  foo()

  # After:
  bar()
"

warn_deprecated("0.3.0", "foo", "bar", details)
#> `foo()` is deprecated as of rlang 0.3.0.
#> Please use `bar()` instead.
#>
#>   # Before:
#>   foo()
#>
#>   # After:
#>   bar()

Deprecating arguments

Specify an argument:

warn_deprecated("0.3.0", "foo@bar")
#> The argument `bar` of `foo()` is deprecated as of rlang 0.3.0

The replacement can be a function:

warn_deprecated("0.3.0", "foo@bar", "quux")
#> The argument `bar` of `foo()` is deprecated as of rlang 0.3.0.
#> Please use `quux()` instead.

Or an argument:

warn_deprecated("0.3.0", "foo@bar", "otherpackage::quux@baz")
#> The argument `bar` of `foo()` is deprecated as of rlang 0.3.0.
#> Please use the argument `baz` of `otherpackage::quux()` instead.

R CMD check note: not imported from `lifecycle`

Hi, thanks for this fantastic package!

I've ran usethis::use_lifecycle() and use the \lifecycle{...} badges in my function docs.
I'm getting a NOTE from R CMD check:

N  checking dependencies in R code (401ms)
   Namespace in Imports field not imported from: ‘lifecycle’
     All declared Imports should be used.

Related: in addition to above NOTE, goodpractice also raises #19, output see details.

What's the cleanest way to fix this NOTE?

sessionInfo and goodpractice

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.04

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C               LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8     LC_MONETARY=en_AU.UTF-8    LC_MESSAGES=en_AU.UTF-8   
 [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ruODK_0.6.5        usethis_1.5.1.9000

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2         xmlparsedata_1.0.2 compiler_3.6.1     prettyunits_1.0.2  remotes_2.1.0      tools_3.6.1        digest_0.6.21      packrat_0.5.0     
 [9] pkgbuild_1.0.5     jsonlite_1.6       praise_1.0.0       pkgconfig_2.0.3    rlang_0.4.0        igraph_1.2.4.1     rex_1.1.2          whoami_1.3.0      
[17] cli_1.1.0          rstudioapi_0.10    curl_4.1           xfun_0.9           xopen_1.0.0        cyclocomp_1.1.0    stringr_1.4.0      knitr_1.25        
[25] withr_2.1.2        httr_1.4.1         xml2_1.2.2         desc_1.2.0         fs_1.3.1           rprojroot_1.3-2    glue_1.3.1         R6_2.4.0          
[33] processx_3.4.1     rcmdcheck_1.3.3    callr_3.3.2        lintr_1.0.3        covr_3.3.1         magrittr_1.5       backports_1.1.4    ps_1.3.0          
[41] clisymbols_1.2.0   assertthat_0.2.1   goodpractice_1.0.2 stringi_1.4.3      lazyeval_0.2.2     crayon_1.3.4      

Output from goodpractice::goodpractice():

── GP ruODK ───────────────────────────────

It is good practice tofix this R CMD check NOTE: Namespace in Imports field not imported from:lifecycleAll declared Imports should be used.
────────────────────────────────────────
There were 43 warnings (use warnings() to see them)

warnings()
# brings one of these per use of \lifecycle{} macro
In parse_Rd("/home/florian/projects/ruODK/man/yell_if_missing.Rd",  ... :
  /home/florian/projects/ruODK/man/yell_if_missing.Rd:21: unknown macro '\lifecycle'
> 

Lexically-scoped verbosity

The behaviour for soft-deprecation verbosity in unit tests was originally intented to depend on whether the soft-deprecated function is called from the tested package or downstack:

  • If called from the tested package, the default verbosity is set to "warning"
  • If called from a dependency, it is set to "quiet"

This conditional verbosity is implemented in deprecate_soft() via the envvar TESTTHAT_PKG which is set to the package being tested. Unfortunately, this default stopped working correctly with testthat 3e because it hardcodes verbosity to warning. The problem is that verbosity is currently set via a global option whereas we really want some sort of lexical scoping instead.

I think it's a good idea to let testthat set the lifecycle verbosity, but we need a lexically scoped mechanism. I see two options. The simplest is to allow defining verbosity with a local binding:

local_bindings(
  .lifecycle_verbosity = "warning"
)

This is not practical when the deprecation is signalled from helpers though, because the calling environment of these helpers will not have that binding in scope. What we really want is to set verbosity for the whole namespace. So we could provide a custom tool for this:

lifecycle::local_verbosity(
  rlang = "warning",
  purrr = "warning"
)

testthat would use this to enable warnings for the package being tested instead of setting the global option.

We could also frame the behaviour with the global environment in terms of this mechanism. You could disable this behaviour like this:

lifecycle::poke_verbosity(global = NULL)

This would be less risky than using the global options(lifecycle_verbosity = "quiet") which silences all warnings without distinction.

What do you think @hadley?

Cannot install lifecycle; inhibits installation of kableExtra

any ideas on how to install and implement on R 3.6.3 on Windows 10?

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

remotes::install_github("r-lib/lifecycle")
Downloading GitHub repo r-lib/lifecycle@master
Error: Failed to install 'lifecycle' from GitHub:
System command 'Rcmd.exe' failed, exit status: -1, stdout + stderr empty

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

additionally, we have

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

install.packages('lifecycle')

There is a binary version available but the source version is later:
binary source needs_compilation
lifecycle 0.1.0 0.2.0 FALSE

installing the source package ‘lifecycle’

trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_0.2.0.tar.gz'
Content type 'application/x-gzip' length 164455 bytes (160 KB)
downloaded 160 KB

Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\sjones\AppData\Local\Temp\RtmpiuiiLZ\downloaded_packages’

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Thank you!

Consider deprecation warning

Instead of

Warning: `data_frame()` is deprecated as of tibble 1.1.0.

maybe

Warning: `data_frame()` was deprecated in tibble 1.1.0.

Message for when default values change?

It might be useful to provide a message once per session for default values that have changed and were not explicitly set by the user so that they can decide whether to go with the old or new behaviour.

last_warnings() doesn't take simplify argument

Despite the documentation saying:

If you call these in the console, these warnings are printed with a backtrace. Pass the simplify argument to control the verbosity of the backtrace. It supports one of "branch" (the default), "collapse", and "none" (in increasing order of verbosity).

deprecate_soft() needs to say "soft" in message

lifecycle::deprecate_soft("1.0.0", "dplyr::funs()")
#> Warning message:
#> `funs()` is deprecated as of dplyr 1.0.0.

should be

lifecycle::deprecate_soft("1.0.0", "dplyr::funs()")
#> Warning message:
#> `funs()` is soft deprecated as of dplyr 1.0.0.

how to access use_lifecycle

I am trying to add the lifecycle badge to an Rd file following the instructions in the vignette.

* Call `usethis::use_lifecycle()` to import the badges in your package.

this function does not seem to be exported from usethis

> usethis::use_lifecycle()
Error: 'use_lifecycle' is not an exported object from 'namespace:usethis'
sessioninfo
Session info ───────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       macOS Mojave 10.14.5        
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2019-09-01Packages ───────────────────────────────────────────────────────────────────────────
 package     * version    date       lib source                            
 assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                    
 backports     1.1.4      2019-04-10 [1] CRAN (R 3.6.0)                    
 base64enc     0.1-3      2015-07-28 [1] CRAN (R 3.6.0)                    
 cli           1.1.0      2019-03-19 [1] CRAN (R 3.6.0)                    
 clipr         0.7.0      2019-07-23 [1] CRAN (R 3.6.0)                    
 clisymbols    1.2.0      2017-05-21 [1] CRAN (R 3.6.0)                    
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                    
 desc          1.2.0      2019-07-25 [1] Github (r-lib/desc@c860e7b)       
 details       0.0.51     2019-07-22 [1] Github (yonicd/details@f2fb5e7)   
 digest        0.6.20     2019-07-04 [1] CRAN (R 3.6.0)                    
 fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                    
 git2r         0.26.1     2019-06-29 [1] CRAN (R 3.6.0)                    
 glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                    
 htmltools     0.3.6.9004 2019-08-28 [1] Github (rstudio/htmltools@cb452a8)
 htmlwidgets   1.3        2018-09-30 [1] CRAN (R 3.6.0)                    
 lifecycle     0.1.0      2019-08-01 [1] CRAN (R 3.6.0)                    
 magick        2.2        2019-08-26 [1] CRAN (R 3.6.0)                    
 magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                    
 packrat       0.5.0      2018-11-14 [1] CRAN (R 3.6.0)                    
 R6            2.4.0      2019-02-14 [1] CRAN (R 3.6.0)                    
 Rcpp          1.0.2      2019-07-25 [1] CRAN (R 3.6.0)                    
 rlang         0.4.0      2019-06-25 [1] CRAN (R 3.6.0)                    
 rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                    
 rstudioapi    0.10       2019-03-19 [1] CRAN (R 3.6.0)                    
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                    
 slickR      * 0.4.3      2019-09-01 [1] local                             
 usethis       1.5.1      2019-07-04 [1] CRAN (R 3.6.0)                    
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                    
 xml2          1.2.2      2019-08-09 [1] CRAN (R 3.6.0)                    

[1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

How to soft-deprecate properties of a function argument?

The current interface seems to support unconditional deprecation of functions and arguments. Can we communicate messages such as "Passing a list to this function/method is no longer supported" and "The vector must not contain NA values" using the same channel? Ideally, these messages will be seen once per session, only if called from the top level, and always from tests.

tidyverse/tibble#669

Optionally warn for experimental behaviour

It would be good to be able to get code to issue warnings / errors if experimental functions have been used (the same way it does with depreciated functions). The aim being to highlight in potential production code where unstable functions have been used.

For example:

options(lifecycle_verbosity = "error_experimental")

Show release date of deprecated version?

This seems like it would be quite a lot of work to implement, but it would be cool if we could automatically include the release date in the deprecated message

`data_frame()` is deprecated as of tibble 1.1.0 (released 2016-10-04).

Maybe even just roughly bucketing:

`data_frame()` is deprecated as of tibble 1.1.0 (released four years ago).

Using something like the logic in prettyunits::pretty_dt(compact = TRUE)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.