r-lib / usethis

Set up commonly used 📦 components
https://usethis.r-lib.org/
Other
821 stars 258 forks source link

use_package() does not add package if installation is not done #1958

Closed JosiahParry closed 3 months ago

JosiahParry commented 3 months ago

For reasons I want to add a package to my imports but, I do not want usethis to install the package on my behalf. When selecting No, the function will not continue and will not inform you of this.

Desired functionality: the package will still be added to the DESCRIPTION file even if I choose to not install the package when prompted.

usethis::use_package("fizzbizz", min_version = "3.14.159")

edit: for my future self, this comes from rlang::check_installed()

jennybc commented 3 months ago

usethis is really focused on interactive workflow and The Road Most Travelled. If this is an interactive workflow issue, I think you should open DESCRIPTION and just add the package manually. If this is a programmatic workflow, I suggest you use the excellent desc package, which is what usethis does under the hood for all DESCRIPTION edits.