thebjorn / pydeps

Python Module Dependency graphs
https://pydeps.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
1.8k stars 114 forks source link

Chained Visualisation for imported modules #186

Closed Awizhey closed 1 year ago

Awizhey commented 1 year ago

Hi, I am trying to use pydeps to visualise dependencies inside of a huge repository that I am working with.

However, I can only see the modules that are imported into the file I specified as an argument for pydeps (with --include-missing), and not any further dependencies for those imported modules. I want it to be like a recursive function that stops once it finds modules that are not dependent on any other.

Also, I do not want to see detailed dependency graph for installed python modules like mlflow.

Is there a way to achieve this?

thebjorn commented 1 year ago

The --max-bacon parameter lets you control how many "hops" in the import graph pydeps will follow (default is 2, higer values gives you more of the graph, 0 gives you the entire graph -- although I can't guarantee that graphviz will be able to generate a graph for a very large package).

The --cluster parameter collapses external dependencies into a single node, and you can control it further by using --min-cluster-size and --max-cluster-size, which will control how many nodes there has to be in a sub-graph before it is collapsed.

If pydeps doesn't catch some files that you are interested in, you can either write a dummy file that imports all the modules you're interested in, or call pydeps with on a directory or package.