apache / apache/hamilton

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

Open
#1,162 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Jupyter Notebook
Stars
2.6k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

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
```python
@load_from.json(path="/path/to/file")
@tag(hello="world")
def foo(data: dict) -> dict:
return foo
```
While this will make the tag disappear
```python
@tag(hello="world")
@load_from.json(path="/path/to/file")
def foo(data: dict) -> dict:
return foo
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.