Julia’s @exfiltrate for Python; Exports the local variables into a global dictionary for later debugging.
pip install pyexfiltrator
Or install the latest master:
pip install -U 'git+https://github.com/NightMachinary/PyExfiltrator'
from pyexfiltrator import exfiltrate, exfiltrated
from icecream import ic # prints its input
global_var_1 = "Hi"
global_var_2 = "ice"
def test_fn(arg1=8, arg2=['a', 'b']):
print("test_fn started")
global global_var_1
local_var_1 = (1,2,3)
ic(exfiltrate())
print("test_fn finished")
def test_fn2(arg1=3, arg3='monkey'):
print("test_fn2 started")
local_var_2 = None
ic(exfiltrate())
print("test_fn2 finished")
test_fn(arg1=10)
ic(exfiltrated)
test_fn2()
ic(exfiltrated)
>>> test_fn started ic| exfiltrate(): {'arg1': 10, 'arg2': ['a', 'b'], 'local_var_1': (1, 2, 3)} test_fn finished ic| exfiltrated: {'arg1': 10, 'arg2': ['a', 'b'], 'local_var_1': (1, 2, 3)} test_fn2 started ic| exfiltrate(): {'arg1': 3, 'arg3': 'monkey', 'local_var_2': None} test_fn2 finished ic| exfiltrated: {'arg1': 3, 'arg2': ['a', 'b'], 'arg3': 'monkey', 'local_var_1': (1, 2, 3), 'local_var_2': None}
The MIT License