ronaldoussoren / modulegraph

modulegraph determines a dependency graph between Python modules primarily by bytecode analysis for import statements. modulegraph uses similar methods to modulefinder from the standard library, but uses a more flexible internal representation, has more extensive knowledge of special cases, and is extensible.
MIT No Attribution
38 stars 4 forks source link

ModuleGraph.foldReferences calls non-existent get_edges on node #45

Closed ronaldoussoren closed 5 years ago

ronaldoussoren commented 5 years ago

Original report by Anthony Foglia (Bitbucket: afoglia, GitHub: afoglia).


https://bitbucket.org/ronaldoussoren/modulegraph/src/5aa11cc594d4/modulegraph/modulegraph.py?at=default#lines-955

When calling a ModuleGraph.foldReferences, I get an error on that line that the SourceModule instance has no such attribute.

I figure that's supposed to be a call to self.get_edges(n).

ronaldoussoren commented 5 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


Good catch. Thanks for the report.

What is your use case for using this method? I'm working on a rewrite of modulegraph (see https://modulegraph2.readthedocs.io) and haven't ported this functionality yet because I do not yet have a good use case for it. The only use case for this I have is for creating smaller reports, and I intend to solve that using smarter reports.

ronaldoussoren commented 5 years ago

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


Fix buglet in foldReferences

Fixes #45

ronaldoussoren commented 5 years ago

Original comment by Anthony Foglia (Bitbucket: afoglia, GitHub: afoglia).


We have a complicate python app in a codebase and I'm trying to track down all the dependencies. There's more complications that I don't know if I can say.

I wanted a nice dot-generated graph of our dependencies, but with so many packages, there were so many nodes dot couldn't make an image. So folding was necessary.

I eventually wrote a script to do all the folding and pruned all the standard libraries from the graph.

There were a few other little bugs I hit upon. I'll see if I can get approval to send a patch.

Modulegraph2 might be interesting, but modulegraph is one of our indirect dependencies already.