-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix callable script linting/typing #837
Comments
It might really be related to python/mypy#1693, in which case I am not sure if this is worth it because the type is determined at run time by the context |
We also saw issues with specifying Task dependencies, e.g.: workflow_template.py:20: error: Unsupported operand types for >> ("list[Task]" and "Task") [operator]
workflow_template.py:20: note: Left operand is of type "Task | list[Task]" |
Related to this issue is the fact that the hera/src/hera/workflows/script.py Line 611 in 91df4de
was to allow the script decorator itself to set the But, the unintended side effect was the function itself lost type hints because I thought I needed to add the Script type hints at the call site as well, but actually this should be the type hints for Step/Task, e.g. because it's using the Furthermore, types hints for the function itself broke: |
Also seeing callable scripts throwing
|
Pre-bug-report checklist
1. This bug can be reproduced using YAML
2. This bug occurs when...
Bug report
Describe the bug
A clear and concise description of what the bug is:
When using script functions under e.g. a DAG context, the linter still doesn't know it's actually a
Task
necessitatingcast
s or# type: ignore
s. e.g.:To Reproduce
Any Hera examples using Task functions, i.e.
on_success
or>>
operators.Expected behavior
A clear and concise description of what you expected to happen:
No linting errors.
Environment
Additional context
Add any other context about the problem here.
Maybe we can fix it with overload functions? Depends what the linter can figure out
The text was updated successfully, but these errors were encountered: