hamilton icon indicating copy to clipboard operation
hamilton copied to clipboard

@does + default kwargs don't work

Open elijahbenizzy opened this issue 3 years ago • 0 comments

Short description explaining the high-level reason for the new issue.

Current behavior

It breaks, dependencies marked as optional are not carried over.

Stack Traces

(If applicable)

Screenshots

(If applicable)

Steps to replicate behavior

from hamilton import driver
from hamilton.function_modifiers import does
from hamilton.ad_hoc_utils import create_temporary_module


def _identity(**kwargs) -> int:
    return 1

@does(_identity)
def foo(bar: int=1) -> int:
    pass

h_dr = driver.Driver({}, create_temporary_module(foo))
h_dr.raw_execute(['foo'])
python ./demo-hamilton-bug.py
Traceback (most recent call last):
  File "/Users/elijahbenizzy/dev/hamilton-os/sf_nlp/etls/./demo-hamilton-bug.py", line 14, in <module>
    h_dr.raw_execute(['foo'])
  File "/Users/elijahbenizzy/dev/hamilton-os/hamilton/hamilton/driver.py", line 147, in raw_execute
    self.validate_inputs(user_nodes, inputs)  # TODO -- validate within the function graph itself
  File "/Users/elijahbenizzy/dev/hamilton-os/hamilton/hamilton/driver.py", line 102, in validate_inputs
    raise ValueError(error_str)
ValueError: 1 errors encountered:
  Error: Required input bar not provided for nodes: ['foo'].

Library & System Information

E.g. python version, hamilton library version, linux, etc.

Expected behavior

This should work

Additional context

Add any other context about the problem here.

elijahbenizzy avatar Aug 22 '22 23:08 elijahbenizzy