We populate a custom working set and compute its dependency graph, arranging for one subtree to appear more than once in the graph:
>>> anton_1 = make_dist("anton-1.egg", depends="""berta
... charlie[extra]""")
>>> berta_2 = make_dist("berta-2.egg", depends="charlie")
>>> charlie_1_4 = make_dist("charlie-1.4.egg", depends="""[extra]
... dora""")
>>> dora_0_5 = make_dist("dora-0.5.egg")
>>> ws = make_working_set(anton_1, berta_2, charlie_1_4, dora_0_5)
>>> from tl.eggdeps.graph import Graph
>>> graph = Graph(working_set=ws)
>>> graph.from_working_set()
>>> sprint(graph)
{'anton': {'berta': {None: set([])}, 'charlie': {'extra': set([])}},
'berta': {'charlie': {None: set([])}},
'charlie': {'dora': {None: set(['extra'])}},
'dora': {}}
>>> from tl.eggdeps.dot import print_dot
>>> print_dot(graph, Options())
digraph {
"anton" [style="filled", fillcolor="green", label="anton"]
"berta" [style="filled", fillcolor="yellow", label="berta"]
"dora" [label="dora"]
"charlie" [style="filled", fillcolor="yellow", label="charlie"]
"anton" -> "charlie"
"anton" -> "berta"
"berta" -> "charlie"
"charlie" -> "dora" [color="lightgrey"]
}
>>> print_dot(graph, Options(version_numbers=True))
digraph {
"anton" [... label="anton 1"]
"berta" [... label="berta 2"]
"dora" [label="dora 0.5"]
"charlie" [... label="charlie 1.4"]
...
}
>>> print_dot(graph, Options(cluster=True))
digraph {
...
subgraph cluster_0 {
"charlie"
"berta"
"anton"
}
...
}
>>> options = Options()
>>> options.comment = u"called by a doc test\nand has two lines"
>>> print_dot(graph, options)
// called by a doc test
// and has two lines
digraph {
...