Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check_downstream_deps() #927

Merged
merged 5 commits into from
Feb 26, 2020
Merged

Conversation

lionel-
Copy link
Member

@lionel- lionel- commented Feb 24, 2020

Branched from #926. Implemented in a standalone compat file that can be copied in zero-dep packages, but will eventually be exported from rlang as well.

Sometimes a package is updated with known breaking changes. Broken downstream dependencies can then be updated to fix the breakage and bump the required version of the upstream package in their DESCRIPTION file. However that doesn't cover the common case of updating the upstream dependencies independently. Since there is no way of specifying minimal versions of downstream dependencies in DESCRIPTION, the downstream packages won't be updated even though they are no longer compatible. This can result in surprising and hard to debug behaviour.

The goal of check_downstream_deps() is to reduce friction when breaking updates are released with known downstream dependencies requirements. One instance where these requirements are known ahead of time is when the maintainer owns both the upstream and downstream packages and coordinates a joint release to CRAN.

check_downstream_deps() takes named vectors of min and from components. min is the minimum version of the downstream package that is compatible with the upstream package. from is the earliest version of the upstream package that is compatible with that minimum version. For instance here is the downstream-deps spec for rlang:

.onLoad <- function(lib, pkg) {
  check_downstream_deps(
    pkg,
    dplyr = c(min = "0.8.0", from = "0.4.0")
  )
}

If the user has updated rlang but not dplyr, they get this warning once the load is complete:

suppressMessages(library(dplyr))
#> Warning message:
#> As of rlang 0.4.0, dplyr must be at least version 0.8.0.
#> ✖ dplyr 0.7.2 is too old for rlang 0.4.4.
#> ℹ Please update dplyr with `install.packages("dplyr")` and restart R.

As in #926, Windows users receive specific advice about safe installation on that platform:

suppressMessages(library(dplyr))
#> Warning message:
#> As of rlang 0.4.0, dplyr must be at least version 0.8.0.
#> ✖ dplyr 0.7.2 is too old for rlang 0.4.4.
#> ℹ Please update dplyr to the latest version.
#> ℹ Updating packages on Windows requires precautions:
#>   <https://github.com/jennybc/what-they-forgot/issues/62>

@lionel- lionel- changed the base branch from add-check-linked-version to master February 26, 2020 14:15
@lionel- lionel- force-pushed the add-check-downstream-dep branch from 778c1d8 to fee171e Compare February 26, 2020 14:20
@lionel- lionel- merged commit 253c72b into r-lib:master Feb 26, 2020
@lionel- lionel- deleted the add-check-downstream-dep branch February 26, 2020 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant