def test_build_pip_deps(): # pip is a downloaded module. builder = GraphBuilder(Space(), ['pip', 'django'], max_num_package=50) builder.build() v = Viewer(builder.finished_packages) path = 'sample-graph.png' v.output_image(path) assert os.path.isfile(path) os.system('xdg-open %s' % path)
def test_build_pip_deps(): # pip is a downloaded module. builder = GraphBuilder(Space(), ["pip", "django"], max_num_package=50) builder.build() v = Viewer(builder.finished_packages) path = "sample-graph.png" v.output_image(path) assert os.path.isfile(path) os.system("xdg-open %s" % path)
def main(argv): _, library1, library2, max_num_nodes = argv builder = GraphBuilder(library1, max_num_nodes=int(max_num_nodes)) builder.add_root(library2) errors = builder.build() builder.freeze() compute_vector(builder, library1) node1 = builder.nodes[library1] compute_vector(builder, library2) node2 = builder.nodes[library2] angle = angle_between_nodes(node1, node2) print 'Angle between `%s\' and `%s\' is %f' % (library1, library2, angle)
pickle.dump(clean_graph, f) def load_graph(f): return pickle.load(f) logger = get_logger("main-script") INPUT_FILE = "modules.json" with open(INPUT_FILE) as f: modules = json.load(f).keys() modules = modules[:50] logger.warn("modules=%s", modules) OUTPUT_FILE = "modules-graph.p" MAX_NUM_PACKAGES = 200 logger.warn("max_num_packages=%d", MAX_NUM_PACKAGES) builder = GraphBuilder(Space(), modules, max_num_package=MAX_NUM_PACKAGES) try: builder.build() except KeyboardInterrupt: pass with open(OUTPUT_FILE, "w") as f: dump_graph(builder.finished_packages, f)
pickle.dump(clean_graph, f) def load_graph(f): return pickle.load(f) logger = get_logger('main-script') INPUT_FILE = 'modules.json' with open(INPUT_FILE) as f: modules = json.load(f).keys() modules = modules[:50] logger.warn('modules=%s', modules) OUTPUT_FILE = 'modules-graph.p' MAX_NUM_PACKAGES = 200 logger.warn('max_num_packages=%d', MAX_NUM_PACKAGES) builder = GraphBuilder(Space(), modules, max_num_package=MAX_NUM_PACKAGES) try: builder.build() except KeyboardInterrupt: pass with open(OUTPUT_FILE, 'w') as f: dump_graph(builder.finished_packages, f)
def test_build_pip_deps(): builder = GraphBuilder(Space(), 'pip', max_num_package=50) builder.build() print builder.finished_packages # package-name -> package