Closed AARON-CLARK closed 10 months ago
It looks like the {riskmetric}
package only looks at Imports
, Depends
and LinkingTo
Here is one method for finding all the suggests
across all packages loaded
package_names <- dbSelect("select * from package", db_name)$name
sugs <- unlist(tools::package_dependencies(package_names, available.packages(),
which=c("Suggests"), recursive=FALSE)) %>% unique()
@Robert-Krajcik I would tack it onto the upload package process. That process currently grabs information from the tarball. Could easily grab the suggests then too.
Or the pkg_explorer mod
Example using {dplyr}
pkg_name <- "dplyr"
ref <- riskmetric::pkg_ref(pkg_name,
source = "pkg_cran_remote")
ref_ver <- as.character(ref$version)
src_dir <- file.path("source", pkg_name)
if (!dir.exists(src_dir)) {
utils::untar(file.path("tarballs", glue::glue("{pkg_name}_{ref_ver}.tar.gz")), exdir = "source")
}
dcf <- read.dcf(paste0(src_dir, "/DESCRIPTION"))
sugs <- dcf[,"Suggests"] %>% gsub("\n", "", .) %>% unname()
The package explorer is set to only trigger if someone opens it because unpacking the tarballs takes time.
Yes I know. I am just borrowing some code from it
I guess I was thinking we should be storing this information upon uploading of the package so all our data is pointing to the same point in time.
Well the tools::package_dependencies()
function sure is a whole lot faster than having to unpack a tarball.
So what are your thoughts on how to approach this?
This line actually untar the tarball when uploading the package. The information should be available to grab in the source folder at that time. Probably need a safeguard in place in the event that there was an issue downloading the tarball.
closed with #631
Does
{riskmetric}
not provide a list of pkgs that fall into the "Suggests" field of the DESCRIPTION file? After chatting with @borgmaan, he shared that knowing those pkgs are really helpful because some orgs actually run a R CMD Check on a pkg and the "Suggests" pkgs are often needed to execute a pkg's tests.broom
's suggest field is extensive https://github.com/tidymodels/broom/blob/a579b0dcfc9f8feedb4e937bf336478c288852cc/DESCRIPTION#L556C6-L637