# Function call dependency tracking in Python / how to do it in Julia

**URL:** <https://discourse.julialang.org/t/function-call-dependency-tracking-in-python-how-to-do-it-in-julia/100064>\
**Category:** Internals & Design\
**Tags:** metaprogramming\
**Created:** [June 8, 2023, 5:08pm UTC](https://discourse.julialang.org/t/function-call-dependency-tracking-in-python-how-to-do-it-in-julia/100064 "2023-06-08T17:08:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [June 8, 2023, 5:08pm UTC](https://discourse.julialang.org/t/function-call-dependency-tracking-in-python-how-to-do-it-in-julia/100064/1 "2023-06-08T17:08:55Z")

</div>

I found this [post from a Python friend of mine](https://amakelov.github.io/blog/deps/) very interesting, especially in the context of comparing Python and Julia introspection and metaprogramming tools. He works through what is necessary for function-level dependency tracking in python code – a really impressive level of metaprogramming. Maybe even Julia uses too much dark magic to implement similar capabilities (IRTools, Cassette, etc). I am curious whether folks have quick and rough pointers on what to learn in order to implement the same capabilities in Julia. I would like to stress that it took just about **100 lines** to do a first version in python.

It was rather difficult for me to find a good place to post this, but paradoxically “Internals” seems like the best category, given the amount of introspection being discussed.

Direct link: [Practical dependency tracking for Python function calls | Alex Makelov](https://amakelov.github.io/blog/deps/)

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [June 8, 2023, 5:37pm UTC](https://discourse.julialang.org/t/function-call-dependency-tracking-in-python-how-to-do-it-in-julia/100064/2 "2023-06-08T17:37:42Z")

</div>

looks like you need to modify the source code to do that? idk, try to call numpy function, see if it can work across boundary.

* * *

On the Julia side I’m sure JET.jl does this already, but matter of visualization I guess

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [June 8, 2023, 8:45pm UTC](https://discourse.julialang.org/t/function-call-dependency-tracking-in-python-how-to-do-it-in-julia/100064/3 "2023-06-08T20:45:34Z")

</div>

Cthulhu and JET do this based on the statically reachable call-graph, and indeed it would only be a matter of extracting the information and visualizing it.

If you want the full dynamic call-graph you would need to use Cassette, in particular the pre/post call hooks were meant to do tracing like that.
