-
Notifications
You must be signed in to change notification settings - Fork 164
Open
Description
Is your feature request related to a problem? Please describe.
The following code throws errors:
Under: my_module/
__init__.py
from .base import a, z
from .base_extended import b_p, d, ebase.py
def a(input: int) -> int:
return input * 2
def z(input: int) -> int:
return input * 3base_extended.py
from hamilton.function_modifiers import parameterize, value
from my_module import base
b_p = parameterize(
b={"input":value(1)},
c={"input":value(2)}
)(base.a)
def d(b: int, c: int) -> int:
return b + cThen in my run.py outside my_module.
from hamilton import driver
import my_module
dr = driver.Builder().with_modules(my_module).build()
dr.display_all_functions("base_extended.png")
print(dr.execute(['b', 'c']))Throws two possible things (if you allow module overrides one error goes away):
bis redefined twice.ais missing from the graph.
Describe the likely problem
- I think we're modifying the underlying function in the
parameterizedecorator which results inabeing lost. - Because of (2) we have
aeffectively as a function twice. Once via the parameterize decorator, once via module import. This then means that we're definingbandctwice.
Describe the solution you'd like
- we should be able to import functions and use them in a decorator - without impacting the use of that function in hamilton as a standalone by itself thing.
- with (1) resolved I think things should then just work.
Describe alternatives you've considered
N/A
Additional context
Comes from a problem a user ran into in slack.
Metadata
Metadata
Assignees
Labels
No labels