Open pawamoy opened 4 years ago
The --show-deps
flag will ouput the result of the dependency analysis.
The output is something like (very abridged):
"pydeps.arguments": {
"bacon": 1,
"imported_by": [
"__main__",
"pydeps.cli"
],
"imports": [
"pydeps.pycompat"
],
"name": "pydeps.arguments",
"path": "c:\\srv\\lib\\code\\pydeps\\pydeps\\arguments.py"
},
"pydeps.cli": {
"bacon": 1,
"imported_by": [
"__main__",
"pydeps.depgraph",
"pydeps.dot",
"pydeps.dummymodule",
"pydeps.pydeps"
],
"imports": [
"pydeps",
"pydeps.arguments",
"pydeps.pycompat"
],
"name": "pydeps.cli",
"path": "c:\\srv\\lib\\code\\pydeps\\pydeps\\cli.py"
},
There is currently no functionality to start with/import this format, but it seems like a useful feature. The relevant lines from pydeps.py
makes me believe that it would be relatively easy to do as well:
dep_graph = py2depgraph.py2dep(trgt, **kw)
if kw.get('show_deps'):
cli.verbose("DEPS:")
pprint.pprint(dep_graph)
dotsrc = depgraph_to_dotsrc(trgt, dep_graph, **kw)
We should probably define the format to be json to make such a feature useful (and specify a jsonschema, https://json-schema.org/, to make it extra useful).
I don't have the time to do something like this until well after the holidays, but I'm to include it if anyone wants to create a PR.
Great, thank you for your anwser. I'll play with depgraph_to_dotsrc
and see if I can send a PR with some "import" command/flag.
I'm wondering if this is possible to feed data to
pydeps
instead of letting it read it from the source files. I developed a dependency analyzer tool myself (shameless plug) and I would like to feed its output topydeps
to generate the graphs 🙂I didn't see such options in the README, but there is an "intermediate" format description. I think I can easily add a
pydeps
format output to my tool. How would I then feed it topydeps
?