r-lib / devtools

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

Why is `install()` so keen to update packages? #2486

Open jennybc opened 1 year ago

jennybc commented 1 year ago

This requires more analysis, but my current thinking is that install() should not, by default, be so eager to update packages.

skr5k commented 1 year ago

Hi @jennybc, I think, this has become an issue for me in the following context:

Thus, I can personally think of three ways to deals with my problem:

I'll find a workaround in the meantime, just wanted to share this user experience in this context. Thanks, skr

jennybc commented 11 months ago

I view this more evidence that it will be good to start using pak inside devtools. In which case install() would probably wrap pak::local_install(), whose upgrade argument has some nice behaviour:

When FALSE, the default, pak does the minimum amount of work to give you the latest version(s) of pkg. It will only upgrade dependent packages if pkg, or one of their dependencies explicitly require a higher version than what you currently have. It will also prefer a binary package over to source package, even it the binary package is older.

When upgrade = TRUE, pak will ensure that you have the latest version(s) of pkg and all their dependencies.

Compare this to the upgrade argument of remotes::install_deps(), which is currently used inside `devtools::install():

Should package dependencies be upgraded? One of "default", "ask", "always", or "never". "default" respects the value of the R_REMOTES_UPGRADE environment variable if set, and falls back to "ask" if unset. "ask" prompts the user for which out of date packages to upgrade. For non-interactive sessions "ask" is equivalent to "always". TRUE and FALSE are also accepted and correspond to "always" and "never" respectively.

infotroph commented 10 months ago

+1 to rethinking this, and in particular I wonder how essential it is to check for available updates even when upgrade = FALSE.

In PEcAn Project we install and test dozens of packages in a single CI run that tries to match the user-facing installation experience and therefore calls install separately for each package. Many of our packages share dependencies that we install from GitHub at the start of the run. But each call to installs insists on checking for updates to each dependency again, and we've run into cases where just those update checks were enough to exceed the request limit of our GitHub token... even though we know we brought all the remotes up to date at the start of the run.

It's very possible our CI use case is better suited to a non-devtools installation method such as remotes::install_local, but we do like using devtools in our user-facing installation and keeping the CI run as equivalent to that as possible.

hadley commented 2 months ago

It feels to me like it's time to switch to pak here.