Best practice: devtools vs r-lib packages

In general, is it likely that most functions which have been moved to rlib packages e.g. withr, callr, remotes, usethis etc will be eventually be deprecated from devtools? If not, what is the overall strategy? For example, could these packages end up going the way of the tidyverse, with devtools becoming a metapackage which contains them?

Other than keeping an eye on actively maintained RStudio packages (e.g. those in the tidyverse) and closely following the NEWS.md updates for the various r-lib projects, what are the good ways to keep in touch with best practice for package development in R and the way the tooling is headed?

11 Likes

They will not be deprecated from devtools, but devtools will just be a wrapper to these packages. This way the individual packages can be used by other packages/projects, and their maintenance is also easier.

I think we will have blog posts, as soon as some of the packages get stable, and make their way to CRAN.

6 Likes

Ok cool. Thanks Gabor! :wink:

I became curios regarding the uncoupling of devtools. From this blogpost

devtools will remain the primary package developers will interact with when writing R packages; it will just rely on these other packages internally for most of the functionality.

my impression was that you can use devtools as before but internally devtools uses other packages like usethis. However, I got a deprecation warning. I got interested about the reasoning and future plans.

utils::packageVersion("devtools")
#> '2.0.1'
devtools::use_package("tibble", type = "Suggests")
#> Setting active project to ...
#> ✔ Adding 'tibble' to Suggests field in DESCRIPTION
#> ● Use `requireNamespace("tibble", quietly = TRUE)` to test if package is installed
#> ● Then use `tibble::fun()` to refer to functions.
#> Warning message:
#> 'devtools::use_package' is deprecated.
#> Use 'usethis::use_package()' instead.
#> See help("Deprecated") and help("devtools-deprecated"). 

This function in the code: devtools/R/infrastructure.R at b72cf4a3a5d5efe1452e44abbb4bf2b87e98b691 · r-lib/devtools · GitHub

Is this only happening to usethis functions and other (sessioninfo, pkgload etc) won't be deprecated? Related new item: https://github.com/r-lib/devtools/blame/master/NEWS.md#L87

Any comment is much appreciated!

3 Likes

Maybe the thread below can help?

2 Likes

thank you! this is exactly what I was looking for.

2 Likes

So this deprecation message was mainly so we could catch people using devtools::use_xyz() in package code, as we wanted those packages to instead import usethis directly rather than devtools.

For interactive use you can attach devtools (e.g. library(devtools)) then call the function without qualification use_package(), this will call the usethis function directly and there will be no deprecation message. You don't have to separately attach usethis, but of course it is fine if you do.

5 Likes