Getting the dependencies of a function from a library

Dieter Maurer dieter at handshake.de
Tue Apr 21 12:38:10 EDT 2020


elisha hollander wrote at 2020-4-21 00:40 +0300:
>I have a python library with a function.
>This function call some other functions, classes and variable from the
>library (and those functions and classes call other ones, etc)...
>Can I automatically create a file with all of the dependencies (and nothing
>else)?

Have a look at Python's "trace" module.

I have not used it myself (explicitly; but it is likely the
basis of so called (test) coverage tools and those are routinely
applied to code I test).

Apparently, it is not a static analysis tool; i.e. the functions
must be executed to learn which other functions their (concrete) execution
depends upon. Other executions may call other functions.


More information about the Python-list mailing list