chooseVersion: Choose version based on the version indication, and available...

View source: R/package_version_management.R

chooseVersionR Documentation

Choose version based on the version indication, and available versions.

Description

Obtains the correct version based on the version instruction provided (e.g. >= 0.5), the package name and it's available versions. If no compatible version is found between the available versions a suitable error is thrown. All different version indications should be handled in this function, including:

  1. a version with > or >= indicator.

  2. just a version e.g. '0.5.0' (most specific)

  3. a zero length char e.g. ''

Usage

chooseVersion(
  packVersion,
  versionList,
  packageName = "",
  pick.last = FALSE,
  warn_for_major_diff = TRUE
)

Arguments

packVersion

A single named version value. i.e. A package name and it's version requirement like: c(dplyr = '>= 0.4.0').

versionList

A list of available versions for this package to choose from. It is the list to choose from and check availability. Created with lib.available_versions.

packageName

It is used for clear error handling. It should be the package name it is trying to load so we can mention it when crashing.

pick.last

See details.

warn_for_major_diff

If true, it will throw a warning when the requested package is a major release higher than that is specified.

Details

Note that both (1) and (3) are effected by 'pick.last'.

If a version like >= 0.5 is given and multiple versions exist, a choice needs to be made. By default it will take the same or first higher version (when it exists, just 0.5 in the example). This most likely leads to not changing the behaviour of the code. Alternatively, picking the latest version is most likely to be accepted by other packages their dependencies (e.g. if a package that is loaded in the future depends on this package but asks for > 0.6, it will likely fail). The downside of this is that an update could be a major one, going from 0.5 to 2.0, where allot of things can have changed and your code that used to work fine is at risk.


multiversion documentation built on March 22, 2022, 1:07 a.m.