r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

Revisit dependencies with no direct usage #2524

Closed jennybc closed 11 months ago

jennybc commented 12 months ago

At the very least, update how we justify Imports that have no obvious direct usage within devtools. Determine if some of these @importFroms should be updated:

https://github.com/r-lib/devtools/blob/9568e51adabfb6f7c6914d9ebc309ce65a7060c9/R/devtools-package.R#L13-L16

to instead use the technique described here:

https://r-pkgs.org/dependencies-in-practice.html#how-to-not-use-a-package-in-imports

This came up after a recent incident that reminded us that merely loading devtools causes shiny to be loaded (via miniUI), during the "package version as character" episode.

gadenbuie commented 12 months ago

devtools is most likely taking a dependency on miniUI (and therefore shiny) to avoid a dialog that pops up when running an addin in RStudio if the package isn't installed. The dialog is somewhat aggressive in that it prevents any addins from running if the miniUI package isn't installed. https://github.com/rstudio/rstudio/issues/12078 argues for the removal of this check, but isn't currently on a roadmap for release in the RStudio IDE.

hadley commented 11 months ago

I think we just need to use the new technique that doesn't immediately load these namespaces.

jennybc commented 11 months ago

devtools actually makes use of lifecycle::deprecated(), so it makes sense to @importFrom.

OTOH these are expedient @importFroms, so we can convert them to use the new technique: