开发者

Creating Dependency Graphs in Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 3 years ago.

Improve this question

I have inherited a huge codebase that I need to make some small changes into. I was wondering if there are utilities that would parse python code and give depend开发者_StackOverflow社区encies between functions, as in if I make changes to a function I want to be sure that I dont break other functions, so if I could see in a graph like diagram it would make my life easier.


  • Usually "dependency" is defined for module / package import.
  • What you are looking for is a visualizing call flow.

    • http://pycallgraph.slowchop.com/
  • You can still not guarantee that you will not break functionality :)

  • My experience and solution:

    Many a times, I found the call flow data overwhelming and the diagram too complex. So what i usually do is trace call flow partially for the function, I am interested in.

    This is done by utilizing the sys.settrace(...) function. After generating the call flows as textual data, I generate a call graph using graphviz.

    • http://docs.python.org/library/sys.html
    • On call tracing
    • For generating graphs, use graphviz solutions from networkX.

[Edit: based on comments]

Then my piecemeal solution works better. Just insert the code and use the decorator on a function that you want to trace. You will see gaps where deferred comes into picture but that can be worked out. You will not get the complete picture directly.

I have been trying to do that and made a few post that works on that understanding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜