pkgnet icon indicating copy to clipboard operation
pkgnet copied to clipboard

Add ability to investigate individual function dependencies

Open JonathanLieberman opened this issue 6 years ago • 3 comments

I know this may be a lot of effort, but it would be great to be able to build dependency graphs for specific functions within a package. Even better, count the number of function calls for functions from other packages. This would be very useful as a package ages and dependencies change. You could look at each function within your package to see if there are any functions which have only a few calls to very "heavy" packages. This way you could look at alternatives to reduce the dependencies of a package.

JonathanLieberman avatar Oct 24 '18 23:10 JonathanLieberman

Hi @JonathanLieberman,

Effort aside, there's some good ideas for future functionality in here. Let me break them out to continue the conversation:

count the number of function calls for functions from other packages Merging the functional dependency graphs for multiple packages seems like a logical progression. We toyed with an idea of an "ecosystem reporter" that would report on many packages at once and their interconnectivity (think of viewing tidyverse in one report as an example), but it hasn't gone anywhere.

What would be a good stopping point for this? Building out a full recursive graph of external package function dependencies could get pretty hairy quick.

look at each function within your package to see [which external dependencies you have for that function] In theory, these could be added as more nodes (perhaps different shaped or colored) to an extension of the existing function network. First step would be to see R's abstract syntax tree contains these external functions as well. This aligns with #22 and maybe #79.

build dependency graphs for specific functions within a package This functionality exists visually currently (click on a node and the subgraph is highlighted) and we surface counts of dependencies in the stats. What's the vision on top of this.

Thanks for the feedback. Let's flush these out.

  • Brian

bburns632 avatar Oct 25 '18 21:10 bburns632

Thanks for the response @bburns632

In my mind, I envisioned a graphic which shows where the external dependencies come from for a package. The Function Network does a great job of showing function dependencies within a package, but it would be nice to see the next layer outside the package. I don't think you need to extend it past the first external layer.

In addition, it would be nice to click on a function in the Function Network and see how many times each external function is called and possibly where the function calls can be found in the source code. This would help discover where dependencies are buried in packages.

I like your idea of different colors/shapes for external function calls. You could use unique colors for each outside package, and if you run out of distinguishable colors, you could possibly use unique color/shape pairs? An "ecosystem reporter" sounds like a great concept, and it could cut down on the number of colors/shapes necessary. I'm not familiar with enough R package dependency graphs to know the best way for defining unique ecosystems.

Jonathan

JonathanLieberman avatar Oct 26 '18 16:10 JonathanLieberman

Hi @JonathanLieberman,

Unfortunately, this feature was not implemented in v0.4.0. This is not a reflection on this feature, and this feature was not blocked or prevented from development. It just happens that authors and contributors focused on the main theme of the v0.4.0 release, improving usability, and did not yet implement this feature.

This idea is being staged for the next release (v.0.5.0) temporarily. The theme, goal and scope of v.0.5.0 is open for discussion in #208, and I encourage you to join the conversation.

bburns632 avatar Apr 01 '19 04:04 bburns632