在python中构建一个包含模块和函数的调用图? [英] Build a Call graph in python including modules and functions?

查看:315
本文介绍了在python中构建一个包含模块和函数的调用图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆脚本来执行任务。我真的需要知道项目的调用图,因为它很混乱。我无法执行代码,因为它需要额外的硬件和软件才能执行。但是,我需要了解它背后的逻辑。所以,我需要知道是否有一个工具(不需要任何python文件执行)可以使用模块而不是trace或python解析器来构建调用图。我有这样的C工具,但不能用于python。

谢谢。

解决方案

您可能想要check out pycallgraph:



pycallgraph



另外在这个链接中还介绍了更多的手动方法:

generate-call-graph-for-understanding-and-refactoring-python-code


I have a bunch of scripts to perform a task. And I really need to know the call graph of the project because it is very confusing. I am not able to execute the code because it needs extra HW and SW to do so. However, I need to understand the logic behind it. So, I need to know if there is a tool (which do not require any python file execution) that can build a call graph using the modules instead of the trace or python parser. I have such tools for C but not for python.
Thank you.

解决方案

You might want to check out pycallgraph:

pycallgraph

Also in this link a more manual approach is described:

generating-call-graphs-for-understanding-and-refactoring-python-code

这篇关于在python中构建一个包含模块和函数的调用图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆