def visualize():
import networkx as nx
# How about we don't fire up a JVM just to start my script?
from asciinet import graph_to_ascii
G = nx.DiGraph()
root = "Root"
G.add_node(root)
# @ENHANCEMENT
# Right now we just visualize it as a stright up dependency graph. We might
# want to show when we use provides instead in the future. This would
# involve adding a fake node when we look for a provides and let that
# depend on the actual implementors
for package in local_repo.get_all_packages():
G.add_node(package)
if package.reason == InstallReason.REQ:
G.add_edge(root, package)
for dep_str in package.dependecies:
q = Query(dep_str)
dep = local_repo.find_package(q)
if dep is None:
print(package, q)
G.add_edge(package, dep)
print(graph_to_ascii(G))
# Show details about a package
评论列表
文章目录