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

Add --prune to stack dot #487

merged 3 commits into from Jul 2, 2015


Copy link

@markus1189 markus1189 commented Jul 2, 2015

TL;DR: Add --prune p1,p2,p3 to stack dot to remove nodes from the dependency graph

The Motivation

Playing around with some haskell projects and their stack dot graphs, it becomes apparent that it it a little hard to look at them because they get quite huge. As an example, take the graph for wreq generated by stack dot --external --no-include-base:

okay that is a LOT. Looking a bit more we see that wreq-examples is also there which depends on a bunch of the dependencies.

The new feature is that --prune takes a comma separated list of package names that will be pruned.

So here is wreq without dependencies of wreq-examples and lens:
Still a lot but more manageable.

Of course we can have a dependency graph that is a little more focused by pruning more (randomly chosen) dependencies from the graph:

stack dot --external --no-include-base --prune lens,wreq-examples,http-client,aeson,tls,http-client-tls

The implementation

  • new flag --prune PACKAGE1,PACKAGE2,...
  • add pruning functionality to Stack.Dot
  • properties in DotSpec for pruning
  • new dependency for stack library: split without version bound, do we need one?
  • new dependency in stack tests: QuickCheck, should not be questionable

Help text for stack dot

Usage: stack dot ([--external] | [--no-external]) ([--include-base] |
                 [--no-include-base]) [--depth DEPTH] [--prune PACKAGES]
  Visualize your project's dependency graph using Graphviz dot

Available options:
  --external               Enable inclusion of external dependencies
  --no-external            Disable inclusion of external dependencies
  --include-base           Enable inclusion of dependencies on base
  --no-include-base        Disable inclusion of dependencies on base
  --depth DEPTH            Limit the depth of dependency resolution (Default: No
  --prune PACKAGES         Prune each package name from the comma separated list
                           of package names PACKAGES

PS: I also took the liberty to add the changes to CHANGELOG, or is this not wanted / do you prefer to do it yourself in the future?

markus1189 added 2 commits Jul 1, 2015
dot --prune lens,wreq,nats prunes the three packages "lens" "wreq" and
"nats" from the dependency graph and also removes resulting orphans.
snoyberg added a commit that referenced this pull request Jul 2, 2015
@snoyberg snoyberg merged commit 7749876 into commercialhaskell:master Jul 2, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Copy link

@zudov zudov commented Jul 2, 2015

@markus1189 Wow, I was just going to ask for that feature. Thanks a lot.

@markus1189 markus1189 deleted the markus1189:dot-prune branch Jul 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants