hamilton icon indicating copy to clipboard operation
hamilton copied to clipboard

bug: `@load_from` and `@save_to` overwrite tags

Open zilto opened this issue 4 months ago • 1 comments

When developing the @cache decorator, which is essentially a custom @tag decorator, I realized that decorator order matters when used with @load_from or @save_to. Instead, we should propagate tags independently of ordering.

For instance, this will apply the hello="world" tag

@load_from.json(path="/path/to/file")
@tag(hello="world")
def foo(data: dict) -> dict:
   return foo

While this will make the tag disappear

@tag(hello="world")
@load_from.json(path="/path/to/file")
def foo(data: dict) -> dict:
   return foo

zilto avatar Oct 02 '24 14:10 zilto