Bases: dict
A graph of egg dependencies.
The nodes of the graph represent distributions (sometimes informally called ‘packages’ or ‘eggs’). The edges represent dependencies.
After creating a graph you need to populate it. To collect information about all installed packages, call:
graph = Graph()
graph.from_working_set()
To get information about a subset of packages (and their dependencies), call:
graph = Graph()
graph.from_specifications('package1', 'package2')
There are options for filtering the graph, described in the docstring of the constructor.
To access a graph node, index the graph using the distribution name as the key:
node = graph['zope.component']
Setuptools has this notion of extra dependencies. These are optional and are grouped by feature names. For example, ‘zope.component’ has a ‘test’ extra that pulls in ‘zope.testing’ and ‘zope.location’. Nodes are mappings of names of their dependencies to sets of extras by way of which the dependencies arise:
list(nodes.iter_deps()) == [('zope.interface', set()),
('zope.testing', set(['test']))]
Yield pairs of specifications and belonging nodes that should be included in the graph.
Specifications are either requirements or distributions.
Find a distribution in the working set associated with the graph.
This is a convenience method to handle the VersionConflict exception.
Bases: dict
A graph node representing an egg and its dependencies.
Store a dependency on another distribution.
dep: name of a dependency
Store an extra dependency on another distribution.
extra: name of an extra via which self depends on dep dep: name of a dependency
Yield (name, source extras) pairs of dependencies.
Source extras are extras of the distribution represented by self by way of which the respective named dependencies are connected.
Yield (name, dep. extras, source extras) triples of dependencies.
Source extras are extras of the distribution represented by self by way of which the respective named dependencies are connected.
Dependency extras are those extras of each dependency that are being required by the distribution represented by self.
Find a matching distribution in the working set.
Returns whether a distribution compatible with the specification (requirement or another distribution) could be found.
Raises ValueError if the specification is for a different project.