hamilton
hamilton copied to clipboard
bug: `@load_from` and `@save_to` overwrite tags
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