Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: feature request: dependency navigator #52762

Open
adonovan opened this issue May 7, 2022 · 0 comments
Open

x/pkgsite: feature request: dependency navigator #52762

adonovan opened this issue May 7, 2022 · 0 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@adonovan
Copy link
Member

adonovan commented May 7, 2022

When trying to understand an existing project, or to remove unwanted dependencies, it is very useful to be able to see and navigate the dependency graph of imported packages. Pkgsite already has the raw information and exposes it through the "imports" and "imported by" links, but other forms would make it easier to comprehend at scale, and without the UX overhead of two clicks and page reloads per graph edge traversed.

Graphical presentations (e.g. graphviz) are generally not practical for graphs of more than a few dozen nodes. See for example https://deps.dev/go/golang.org%2Fx%2Ftools%2Fgopls/v0.8.3/dependencies/graph, and note that this is only the module dependency graph, not the import graph over packages, which is much larger. (It's a missed opportunity that deps.dev's table presentation doesn't go into more detail than classifying dependencies as "direct" vs "indirect", such as showing a path for the indirect ones.)

I would (immodestly) propose a presentation along the lines of that used by https://github.com/adonovan/spaghetti. Given a starting package, it displays the complete forward transitive closure of imported packages, organized hierarchically by name, with one root node per module. Clicking on any tree node shows its direct imports and exports (Spaghetti uses two select widgets for these, though it might be better to populate two separate panes or <div>s with links.) A "live" search box allows rapid query of dependencies, and reports an arbitrary path from the starting package (which is a fixed property of the rendered page) to the selected package.

Spaghetti additionally allows the user to simulate the removal of one or more edges to see how the dependencies would change, which is useful for evaluating the benefit of hypothetical simplification projects. This feature also seems appropriate and useful for Pkgsite. The implementation isn't hard: Spaghetti is less than 1000 LoC.

@gopherbot gopherbot added this to the pkgsite/unplanned milestone May 7, 2022
@julieqiu julieqiu removed their assignment May 9, 2022
@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants