[R-pkg-devel] Package dependency graphs of packages in development (local)
Gábor Csárdi
c@@rd|@g@bor @end|ng |rom gm@||@com
Thu May 9 11:24:32 CEST 2019
You can do something like this with https://github.com/r-lib/pkgdepends:
pr <- pkgdepends::remotes()$new("local::.", library = tempfile())
#> ℹ Creating library directory:
`/var/folders/59/0gkmw1yj2w7bf2dfc3jznv5w0000gn/T//Rtmpo5NL9R/filee95427c73f55`
pr$solve()
#> ℹ Checking for package metadata updates
#> ✔ All 10 metadata files are current.
#> ✔ Using session cached package metadata
#> ✔ Using cached package metadata
#> PKG SOLUTION, 1 refs, resolved in 1.2s, solved in 193ms
───────────────────────
#> local::.
#> Dependencies:
#> github:
#> r-lib/crancache, r-lib/rcmdcheck
#> standard:
#> askpass, assertthat, backports, base64enc, bit, bit64, blob, callr,
#> cli, clisymbols, cranlike, crayon, curl, DBI, debugme, desc,
#> digest, evaluate, fansi, glue, gmailr, highr, hms, httr, jsonlite,
#> knitr, magrittr, markdown, memoise, mime, openssl, parsedate,
#> pillar, pkgbuild, pkgconfig, prettyunits, processx, progress, ps,
#> R6, rappdirs, Rcpp, rematch2, remotes, rlang, rprojroot, RSQLite,
#> sessioninfo, stringi, stringr, sys, tibble, utf8, whoami, withr,
#> xfun, xopen, yaml
tibble::as_tibble(pr$get_solution()$data)
#> # A tibble: 61 x 27
#> ref type direct status package version license
needscompilation priority
#> <chr> <chr> <lgl> <chr> <chr> <chr> <chr> <lgl> <chr>
#> 1 loca… local TRUE OK revdep… 1.0.0.… MIT + … NA NA
#> 2 askp… stan… FALSE OK askpass 1.1 NA FALSE NA
#> 3 asse… stan… FALSE OK assert… 0.2.1 NA FALSE NA
#> 4 back… stan… FALSE OK backpo… 1.1.4 NA FALSE NA
#> 5 base… stan… FALSE OK base64… 0.1-3 NA FALSE NA
#> 6 bit64 stan… FALSE OK bit64 0.9-7 NA FALSE NA
#> 7 bit stan… FALSE OK bit 1.1-14 NA FALSE NA
#> 8 blob stan… FALSE OK blob 1.1.1 NA FALSE NA
#> 9 callr stan… FALSE OK callr 3.2.0 NA FALSE NA
#> 10 cli stan… FALSE OK cli 1.1.0 NA FALSE NA
#> # … with 51 more rows, and 18 more variables: md5sum <chr>, sha256 <chr>,
#> # filesize <int>, built <chr>, platform <chr>, rversion <chr>,
repodir <chr>,
#> # target <chr>, deps <list>, mirror <chr>, sources <list>, remote <list>,
#> # error <list>, metadata <list>, extra <list>, dep_types <list>,
#> # cache_status <chr>, lib_status <chr>
And the `deps` column there shows the direct dependencies of the dependencies:
❯ pr$get_solution()$data$deps[1:2]
#> [[1]]
#> # A tibble: 25 x 5
#> ref type package op version
#> <chr> <chr> <chr> <chr> <chr>
#> 1 assertthat Imports assertthat "" ""
#> 2 callr Imports callr "" ""
#> 3 cli Imports cli "" ""
#> 4 clisymbols Imports clisymbols "" ""
#> 5 r-lib/crancache Imports crancache >= 0.0.0.9001
#> 6 crayon Imports crayon "" ""
#> 7 DBI Imports DBI "" ""
#> 8 desc Imports desc >= 1.1.1.9002
#> 9 glue Imports glue "" ""
#> 10 gmailr Imports gmailr "" ""
#> # … with 15 more rows
#>
#> [[2]]
#> # A tibble: 2 x 5
#> ref type package op version
#> <chr> <chr> <chr> <chr> <chr>
#> 1 testthat suggests testthat "" ""
#> 2 sys imports sys >= 2.1
Gabor
On Thu, May 9, 2019 at 8:53 AM Rainer M Krug <Rainer using krugs.de> wrote:
>
> Hi
>
> I am quite sure, there was a recent discussion about dependency graphs of packages. I saw the post from Dirk at http://dirk.eddelbuettel.com/blog/2018/02/28/#017_dependencies but `tools::package_dependencies()` does only work on packages on CRAN.
>
> But my package is not yet on CRAN (but on GitHub and a drat repo), and I would like to look at the package dependencies BEFORE submitting to CRAN.
>
> Is there a tool which allows me to plot a dependency graph for my local package?
>
> Thanks,
>
> Rainer
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> Orcid ID: 0000-0002-7490-0066
>
> Department of Evolutionary Biology and Environmental Studies
> University of Zürich
> Office Y34-J-74
> Winterthurerstrasse 190
> 8075 Zürich
> Switzerland
>
> Office: +41 (0)44 635 47 64
> Cell: +41 (0)78 630 66 57
> email: Rainer.Krug using uzh.ch
> Rainer using krugs.de
> Skype: RMkrug
>
> PGP: 0x0F52F982
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list