How you evaluate if changes in one pkg of the tidyverse impact other pkgs of the tidyverse?


I’m developing an ecosystem of packages similar to (and inspired by) the tidyverse. As I refactor a function [say fun1()] in one package I may be breaking other packages. My goal is to quickly find and re-test those broken packages.

I wonder if there is any function [maybe a wrapper around remotes::dev_package_deps()] that specifically returns the packages that call a specific function [e.g. fun1()]. How do the tidyverse team go about this problem?

So far my solution finds not functions but packages to focus on. Say that I refactored a package called mypkg.n; this is how I find other packages in my ecosystem mypkg that depend on mypkg.n:

# Argument `root` assumes that all packages of the ecosystem __mypkg__ have the same parent directory.
mypkg_package_deps <- function(pkg, 
                               root = "../", 
                               mypkg_pkgs = c("mypkg.1", "mypkg.2"))) {
  mypkg_deps <- list_mypkg_deps(root, mypkg_pkgs)
  deps_matching_pkg <- purrr::keep(mypkg_deps, ~any(grepl(pkg, .)))

list_mypkg_deps <- function(root, mypkg_pkgs) {
  paths <- paste0(root, mypkg_pkgs)
  all_deps <- purrr::map(paths, remotes::local_package_deps, TRUE)
  all_deps <- purrr::set_names(all_deps, mypkg_pkgs)
  mypkg_deps <- purrr::map(all_deps, ~intersect(., mypkg_pkgs))


You can get the reverse dependencies of a given package with devtools::revdeps(), to see all the packages which depend on the package in question.

There are no functions written to query particular function names, but you can get a good idea simply by grepping for the function name in the relevant source files.

Also the revdepcheck package is what we use to verify our changes have not broken reverse dependencies before submitting a new version to CRAN.