tl.eggdeps.graph

Classes

class tl.eggdeps.graph.Graph(working_set=None, show=<function <lambda> at 0x9ba53ac>, follow=<function <lambda> at 0x9ba53e4>, extras=True)

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']))]
clear()
D.clear() -> None. Remove all items from D.
copy()
D.copy() -> a shallow copy of D
filter(specifications, find=False)

Yield pairs of specifications and belonging nodes that should be included in the graph.

Specifications are either requirements or distributions.

find(requirement)

Find a distribution in the working set associated with the graph.

This is a convenience method to handle the VersionConflict exception.

from_specifications(*specifications)
Build the dependency graph starting from one or more eggs.
from_working_set()
Build the dependency graph for the whole working set.
static fromkeys()
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.
get()
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
has_key()
D.has_key(k) -> True if D has a key k, else False
items()
D.items() -> list of D’s (key, value) pairs, as 2-tuples
iteritems()
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys()
D.iterkeys() -> an iterator over the keys of D
itervalues()
D.itervalues() -> an iterator over the values of D
keys()
D.keys() -> list of D’s keys
names(specifications)
Return a set of project names to be processed from an iterable of either requirements or distributions.
pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value If key is not found, d is returned if given, otherwise KeyError is raised
popitem()
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty
setdefault()
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update()
D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
values()
D.values() -> list of D’s values
class tl.eggdeps.graph.Node(graph, specification)

Bases: dict

A graph node representing an egg and its dependencies.

clear()
D.clear() -> None. Remove all items from D.
copy()
D.copy() -> a shallow copy of D
depend(dep, dep_extras=())

Store a dependency on another distribution.

dep: name of a dependency

extra_depend(extra, dep, dep_extras=())

Store an extra dependency on another distribution.

extra: name of an extra via which self depends on dep dep: name of a dependency

static fromkeys()
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.
get()
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
has_key()
D.has_key(k) -> True if D has a key k, else False
items()
D.items() -> list of D’s (key, value) pairs, as 2-tuples
iter_deps()

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.

iter_deps_with_extras()

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.

iteritems()
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys()
D.iterkeys() -> an iterator over the keys of D
itervalues()
D.itervalues() -> an iterator over the values of D
keys()
D.keys() -> list of D’s keys
pop()
D.pop(k[,d]) -> v, remove specified key and return the corresponding value If key is not found, d is returned if given, otherwise KeyError is raised
popitem()
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty
require(specification)

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.

setdefault()
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
update()
D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
values()
D.values() -> list of D’s values

Table Of Contents

Previous topic

tl.eggdeps.cli

Next topic

tl.eggdeps.plaintext

This Page