[R-pkg-devel] Package Deprecation Message
Uwe Ligges
||gge@ @end|ng |rom @t@t|@t|k@tu-dortmund@de
Wed Jun 1 09:37:00 CEST 2022
Please use .onAttach:
Users who directly use yourt package will see it as they will attach
your package.
Users who use your package via another one (which may load yours) cannot
do much, as the corresponding maintainer of the other package has to
change the code. So the idea would be to contact maintainers of reverse
dependencies explicitly via mail with the deprecation information and
inform direct users of your package via .onAttach.
Best,
Uwe Ligges
On 31.05.2022 23:10, pikappa.devel using gmail.com wrote:
> Dear all,
>
>
>
> I am looking for a way to communicate the deprecation of a package as a
> newer package supersedes it.
>
>
>
> 1 ) My initial approach was to emit a warning message during the deprecated
> package's loading, i.e., something like the following lines
>
>
>
> .onLoad <- function(libname, pkgname) {
>
> message <- "Some deprecation message."
>
> rlang::warn(message)
>
> }
>
>
>
> This approach leads to the following warning during RCHECK
>
>
>
> * checking whether package 'package_name' can be installed ... WARNING
>
> Found the following significant warnings:
>
> Warning: Some deprecation message.
>
>
>
> 2) My subsequent approach was to use packageStartupMessage, i.e.
>
>
>
>
>
> .onLoad <- function(libname, pkgname) {
>
> message <- "Some deprecation message."
>
> packageStartupMessage(message, appendLF = TRUE)
>
> }
>
>
>
> This approach leads to a note
>
>
>
> * checking R code for possible problems ... NOTE
>
> File 'package_name/R/zzz.R': .onLoad calls: packageStartupMessage(message,
> appendLF = TRUE)
>
> See section 'Good practice' in '?.onAttach'.
>
>
>
> Unfortunately, the package fails to pass the CRAN's automated incoming
> checks with this note.
>
>
>
> I have checked the 'Good practice' section of the .onAttach help page. It
> starts with:
>
>
>
> "Loading a namespace should where possible be silent, with startup messages
> given by '.onAttach'.
>
> These messages (and any essential ones from '.onLoad') should use
> packageStartupMessage so they can be silenced where they would be a
> distraction."
>
>
>
> From the above passage, I understand that essential messages can be
> communicated from .onLoad. Should I consider the deprecation message as
> essential and leave it in the body of .onLoad, or should I instead use
> .onAttach in order to submit the package to CRAN?
>
>
>
> Is there maybe a better way to communicate that the package is deprecated?
>
>
>
> Kind regards,
>
> Pantelis
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list