Install versioned dependencies from a fresher CRAN mirror instead of from Github #3244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changes dependency installation to use two different CRAN sources: Most packages continue to come from a fixed-date snapshot the same age as the R version (same as before this PR), but now will consult a newer CRAN mirror for packages that both:
Imports: lubridate (>= 1.7.0)
), andMotivation and Context
Our Docker images inherit the CRAN settings of the Rocker images we build them from, which all use static snapshots that match the age of the version of R they are built for. This is usually what we want -- someone running an old version of R is likely also running old versions of at least some packages, so it makes sense to test PEcAn on a range of dependency versions as well as R versions.
But there are cases where we really do need a functionality or bugfix that is only available in a version of a dependency that was released later than the oldest CRAN snapshot we want to test against. Until now, we've handled this by installing these dependencies from GitHub, usually pinning them to the oldest version known to work. This increases build time (install_github is always from source whereas the Posit package manager gives us prebuilt binaries), creates confusion when the version we pinned goes out of date ("why are we installing this old version of rmarkdown from GitHub instead of using the one on CRAN?"), and generally feels silly.
The change I make here is to take advantage of a nice difference in behavior of
remotes::install_version
compared tobase::install.packages
: If argumentrepos
has length > 1,install.packages
checks all repositories and installs the newest available version of a package, whileinstall_version
checks them in order and installs the first one that matches your version requirements. By looking first in the fixed snapshot and then in the current version of CRAN, we can get several nice properties:Review Time Estimate
Types of changes
Checklist: