Skip to content

Can't stack @inject and @parameterize decorators #160

Description

@j7zAhU

As per the issue title. This throws an error:

from hamilton.function_modifiers import inject, source, parameterize

@inject(params=source('my_func__params'))
@parameterize(
    my_func_a={'date_range': source('my_func_a_date_range')},
    my_func_b={'date_range': source('my_func_b_date_range')}
)
def my_func(date_range: tuple[pd.Timestamp, pd.Timestamp], params: int) -> int:
    return 1

temp_module = ad_hoc_utils.create_temporary_module(
    my_func, module_name="my_module"
)

config = {
    'my_func__params': 1,
    'my_func_a__date_range': [pd.Timestamp('2022-01-01'), pd.Timestamp('2022-01-10')],
    'my_func_b__date_range': [pd.Timestamp('2023-01-01'), pd.Timestamp('2023-01-10')],
}
dr = driver.Driver(config, temp_module)
df = dr.execute(final_vars=['my_func_a'])

Library & System Information

Hamilton: 1.22.5 , Python 3.11.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions