ploomber / soorgeon

Convert monolithic Jupyter notebooks 📙 into maintainable Ploomber pipelines. 📊
https://ploomber.io
Apache License 2.0
78 stars 20 forks source link

Changing signature and calls of functions using global variables #12

Closed edublancas closed 2 years ago

edublancas commented 2 years ago

Given the following snippet:

x = 1

def add(y):
    return x + y

add(y=10)

add, depends on x to work, however, since the library creates a new exported.py file with the function definitions, they no longer have access to the global variable.

So we need to update the function calls from:

add(y=10)

to:

add(y=10, x=x)

And modify the function's signature to:

def add(x, y):
    return x + y
edublancas commented 2 years ago

we fixed this in https://github.com/ploomber/soorgeon/issues/13