Create dependency structure of your package collection

dependency_table(
  project = ".",
  project_type = c("local", "repo@host")[1],
  ref = NULL,
  local_repos = if ((project_type) == "local") get_local_pkgs_from_config() else NULL,
  direction = "all",
  fallback_branch = "main",
  renv_profile = NULL,
  verbose = 1
)

Arguments

project

(character) If project_type is local then directory of project (for which to calculate the dependency structure); must be a git repository. If project_type is repo@host then should be character of the form openpharma/stageddeps.food@https://github.com If host is not included in the string then the default https://github.com is assumed.

project_type

(character) See project argument.

ref

(character) git branch (or tag) inferred from the branch of the project if not provided; warning if not consistent with current branch of project. If project_type is not local then this argument must be provided.

local_repos

(data.frame) repositories that should be taken from local file system rather than cloned; columns are repo, host, directory.

direction

(character) direction in which to discover packages either "upstream","downstream" or "all".

fallback_branch

(character) the default branch to try to use if no other matches found. It defaults to "main".

renv_profile

(character) the name of the renv profile of the renv.lock files to be included from the repos. The standard renv.lock file uses the default NULL argument here.

verbose

(numeric)
verbosity level, incremental; (0: None, 1: packages that get installed + high-level git operations, 2: includes git checkout infos)

Value

dependency_structure An S3 object with the following items:

project

project argument used to create the object (absolute path if project_type is local

project_type

project_type used to create object

current_pkg

The R package name of code in the project directory

table

data.frame contain one row per r package discovered, with the following rows package_name, type (current, upstream, downstream or other), distance (minimum number of steps from current_pkg), ref, repo, host, sha cache_dir, accessible, installable and install_index (the order to install the packages). Note some items are are suppressed when printing the object

deps

list with three elements, upstream_depsis the graph where edges point from a package to its upstream dependencies. They are ordered in installation order. The downstream_deps list is the graph with the edge direction flipped, and is ordered in reverse installation order. external contains the external R packages found in the description files of the internal packages. It is a dataframe of the form returned by desc::desc_get_deps

direction

direction argument used to create object

renv_files

named list containing the json of the renv.lock files for the chosen profile for each repo. An entry to the list is NULL if a repos does not have the required lock file

Examples

if (FALSE) {
dependency_table(verbose = 1)
dependency_table(
  project = "openpharma/stageddeps.food@https://github.com",
  project_type = "repo@host",
  ref = "main"
)
x <- dependency_table(
  project = "path/to/project",
  direction = c("upstream")
)
print(x)
plot(x)
}