I have a bunch of simple scripts in Python with simple expressions[1] like :
C = A+B
D = C * 4
I need to execute them, but most importantly I need to know what are the objects I depend on; in the previous case, the object A and B are outer dependencies. Eg. given i have the former code in a var called source, i wanna be able to:
deps = { "A" : 1 , "B": 2}
exec source in deps
so it's strictly necessary to know how to build the dict deps.
I've lurked into the ast Python module but I had no clue.
[1] simple math aggregations, to an extent for cycles, nothing more.