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
merged 3 commits into from Jul 2, 2015

Conversation

Projects
None yet
3 participants
@markus1189
Contributor

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:
wreq

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:
wreq_pruned_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
wreq_pruned

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
                           limit)
  --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 some commits Jul 1, 2015

Implement dot --prune
dot --prune lens,wreq,nats prunes the three packages "lens" "wreq" and
"nats" from the dependency graph and also removes resulting orphans.

@snoyberg snoyberg added the in progress label Jul 2, 2015

snoyberg added a commit that referenced this pull request Jul 2, 2015

Merge pull request #487 from markus1189/dot-prune
Add --prune to `stack dot`

@snoyberg snoyberg merged commit 7749876 into commercialhaskell:master Jul 2, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@snoyberg snoyberg removed the in progress label Jul 2, 2015

@zudov

This comment has been minimized.

Contributor

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