my eye

Save output of dependency graph as json

Committed f8b74e

--- a/gmpg/analysis.py
+++ b/gmpg/analysis.py

 import inspect
 import json
 import os
+import pathlib
 import pkgutil
 import re
 import subprocess
 
 
 def generate_dependency_graph(project_name, project_dir="."):
-    subprocess.run(
-        ["pydeps", project_name, "--no-show", "--pylib", "-o", "deps.svg"],
+    project_dir = pathlib.Path(project_dir)
+    proc = subprocess.Popen(
+        [
+            "pydeps",
+            project_name,
+            "--no-show",
+            "--pylib",
+            "-o",
+            "deps.svg",
+            "--show-deps",
+        ],
         cwd=project_dir,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
     )
+    with (project_dir / "deps.json").open("w") as fp:
+        for line in proc.communicate():
+            print(line.decode("utf-8"), file=fp)
 
 
 def test(pkgdir="."):