While this method is not being used in the script, it's been added for
completeness and to ensure that the APIs of all the classes involved
are clean.
Also, the 'DistPackage.as_required_by' method has been renamed to
'DistPackage.as_parent_of' for clarity.
Tests have been added and modified.
Earlier the graphviz output format didn't work if called with the
reverse flag. This is now fixed.
This commit also handles the case of more than one packages having
conflicting versions of the same dependency. In such cases, the edges
between dependency and the parent pkg will be labelled as per the
required version_spec of the respective dependency.
- 'Tree' was used for class representing a direct acyclic
graph (DAG). It has now been appropriately renamed to 'PackageDAG'
- The 'ReverseTree' has been renamed to 'ReversedPackageDAG'
- The optional arg 'base' in the constructor and the instance
attribute havee been removed as they are nowhere being used
- Local variables are renamed, comments are modified and tests are
updated to reflect the above changes
The Tree class is completely agnostic of any notion of a dependency
tree. So it's filter and reverse methods purely work on the given
datastructure which is a map. So the combination of '--reverse' and
'--packages' options require the reverse method to be called before
filter. If done the other way, when reverse is called, it will have
only partial tree resulting in incorrect behaviour in the context of
this script.
Added documentation on the tree class and it's methods accordingly.
The earlier approach for integration tests was unreliable as it used
pickled objects from virtualenvs, which didn't work with all the pip
internal code and would often require tests to be fixed.
In this new approach, a combination of bash and python scripts drive
the tests. Test virtualenvs are setup on demand with support for
varying python and pip versions. As a result, the test
environment (python 3.6) can be completely different from the test
environment ie. the env in which pipdeptree is tested.
TODO: Get the new approach working with travis and remove old
integration tests.
The missing dependencies will now be displayed with 'dashed' nodes and
edges.
This commit also fixes the problem of duplicate nodes being displayed
in the graph, which would happen when the 'project_name' attribute of
'ReqPackage' and the corresponding 'DistPackage' obj different. Now we
are using the 'key' attribute which is guaranteed to be the same for
both objects.
- Replaced the function 'render_tree' with 'render_text' which prints
text representation of an alredy filtered and/or reversed tree to
stdout
- Modify main code to print warnings for conflicting and/or cyclic
dependencies only if user has not selected an output type other than
default (text) - for eg. json, json_tree etc.
Earlier, in the Tree.filter method, we were checking for conflicts in
'show_only' and 'exclude' sets before normalizing all values to lower
case as a result of which it would miss values that were in both the
sets but in different cases.
This is now fixed by checking for conflicts after normalizing all the
values in both sets to lowercase first.
The package 'pkg_resources' is part of the 'setuptools' project. The
project 'pip' (in its current version) vendors setuptools.
Since 'pipdeptree' currently uses pip's private internal API already,
we might as well use pip's vendored pkg_resources. This, of course,
might break if pip's internals change in a later version.
GitHub: naiquevin/pipdeptree#119
So that a new 'test_pipdeptree.py' can be added for unit tests (with
mocking etc.).
Integration test suite will still be run during 'make test' but the
state of the test suite is pretty bad at present. In future, we might
replace it with a complete approach for easy maintenance.
In pip 19.0 the function signature of FrozenRequirement.to_dist has
been changed. The last argument 'depedency_links' is now removed as
depedency support has been removed in pip 19.0.
Fixes#113.
Pull request removing dependency links support:
https://github.com/pypa/pip/pull/6060
Commit removing the 'dependency_links' argument:
46ffb13f13
It also works with previous versions of pip.
The alias to 'get_installed_distributions' in 'pip._internal' module
was removed in pip commit db72d427c5538a29df182bf7a724c304ac323cf6
Ref:
db72d427c5Fixes#105
The dependencies in test setup were old and in spite of the versions
being pinned, the test results were not consistent locally and
travis.
Note: This is an attempted fix (to be verified only after tests are
run on travis)
This was fixed to work with pip 10.0.0 in an earlier commit but import
import of 'FrozenRequirement' was still broken. It is only invoked
when running with '-f' option and is fixed in this commit.