@dataloader
decorator doesn't work when using full type annotations
#1260
Labels
triage
label for issues that need to be triaged.
Current behavior
If I use full type annotations for return types, like
dict[str, Any]
instead ofdict
, the@dataloader
decorator raises an errorStack Traces
Screenshots
Steps to replicate behavior
Simple reproducing example:
Then running the main script with
python main.py
raises the error shown in stacktrace and screenshot.Library & System Information
Python 3.12.7, Hamilton 1.85.0, error reproduced in Mac OS and Ubuntu Linux, running in a virtual environment that just contains hamilton and its dependencies
Expected behavior
The decorator accepts the stricter type as valid
Additional context
Not a big deal, but generally annoying in projects that use strict typing, as making hamilton happy forces to add a
# type: ignore
comment in every decorated function to preventmypy
from complaining.The text was updated successfully, but these errors were encountered: