uptake / pkgnet

R package for analyzing other R packages via graph representations of their dependencies
https://uptake.github.io/pkgnet/
Other
152 stars 37 forks source link

[enhancement] Add option for additional dependency types #303

Closed petergodbert closed 5 months ago

petergodbert commented 11 months ago

Currently only required imports and depends dependencies are listed. The dependency tree does not include any 'linking to' type dependencies, which would be installed with the package, but do not appear in the list of nodes. Additionally it may be helpful to include an option to include suggested or enhancing dependencies. I'd suggest using a dependencies option, much as install.packages() uses. The type of dependency could by reported in the package_type column of the dependency network table. On the visualization it would be helpful to identify suggested and enhancing dependencies using differing colours, but would suggest using paler colours of the existing palette or different borders to the node symbols.

I'm trying to use pkgnet to generate a list of all the packages required within a controlled R installation and the absence of the linking to dependent packages is a gap.

petergodbert commented 11 months ago

After some digging I found we could use this: $initialize(dep_types = c("Imports", "Depends","LinkingTo")) though this was not covered in the help pages. This should possibly be the default behaviour. The same mechanism can be extended to include 'Suggests' and I assume 'Enhances', but the report generated has so many nodes I'd question its value.

jameslamb commented 11 months ago

Thanks for using {pkgnet}.

You're exactly right, passing in dep_types to DependencyReporter's constructor is the preferred way to control which types of dependencies are included in the reporting.

https://github.com/uptake/pkgnet/blob/9354e79795beb8ed07e22805707bc0c10107d458/R/DependencyReporter.R#L43

this was not covered in the help pages

Back when we last generated the documentation in 2022, I don't think {roxygen2} + {pkgdown} automatically generated signature docs for public methods on {R6} classes, and we didn't write new custom docs to cover that. We'd welcome a contribution to update the documentation if you're interested!

This should possibly be the default behaviour.

I'd support changing that default to include LinkingTo. LinkingTo is effectively the same as Imports, in the sense that all the LinkingTo dependencies must be present for a package to be successfully installed.

We'd be happy to review a pull request adding that, but just to warn you... it's a been about 10 months since the last commit in this repo, so I suspect you'll run into some difficulties with the CI jobs. If you'd like to work through those we'd be grateful, and happy to help with reviews.