Automated generation/suggestion of DESCRIPTION's Imports

I'm trying to migrate my package-development workflows from the 'do-everything-by-hand' approach to using newer RStudio-style tooling.

One major piece of the puzzle that I'm surprised by is I can't seem to find any function/helper in devtools, usethis, pkgbuild, or related packages that either (i) creates or (ii) suggests the Imports: section of a package's DESCRIPTION. renv already does a great job scanning through R code for dependencies, and @import roxygen2 tag variants would identify any symbols attached within the package, so it seems like this must be doable? When using these RStudio-esque workflows, does a package DESCRIPTION's Import still require by-hand curation during package development?

(Yes, I'm aware of usethis::use_package(...), which I categorize as 'by-hand', since it still requires an explicit action from the developer to add a package to Imports.)

I believe by-hand curation of the DESCRIPTION file is still required (and perhaps intended) for the "default" RStudio workflows. I suspect the main reason is because one can specify version requirements for packages specified within the DESCRIPTION file, but there isn't any separate mechanism for declaring such version requirements elsewhere within a project (and so perhaps the DESCRIPTION file is the right place to declare such dependencies by hand).

That said, you could approximate this, at least partially, with something like:

deps <- renv::dependencies()

although the renv machinery doesn't (yet) detect dependencies discovered from roxygen comments, or from (e.g.) the NAMESPACE file (which is typically auto-generated via devtools / roxygen).

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.