With the '--json' flag specified, pipdeptree will output the dependency
tree as json list. The resulting json output is intended to be consumed
by external tools.
The primary reason behind refactoring the code is to be able to make it
straightforward to implement the --reverse mode (ie. instead of showing
package and their sub-deps, it will show the sub-deps and the packages
that need them).
As a part of this change, wrapper classes have been added for
Distribution and Requirements instances that pip returns. These wrapper
classes have handle the rendering of the pkg as a root (top level) and a
branch (non-top level) accordingly. As a result the same function
`render_tree` can be used for --reverse mode.
This change doesn't include the --reverse mode implementation. It will
be added in the subsequent commit.
This makes the output of pipdeptree (with freeze flag) pip friendly
ie. the output can be saved in a requirements.txt file. At the same time
it's human readable due to indentations for sub-dependencies.
There is however one gotcha! In case pip finds a dependency multiple
times in the requirements.txt file, it fails. So the user will need to
take care about this when dumping the output in requirements.txt.
Fixes#31.
* Added code to show warnings about possibly confusing dependencies
* A command line option '-w' or '--nowarn' added to allow for inhibition
of the warnings
* A lot of code had to be refactored to do this cleanly