obarisk commented on code in PR #54693: URL: https://github.com/apache/airflow/pull/54693#discussion_r2314729817
########## devel-common/src/docs/shared/template-examples/taskflow-kwargs.rst: ########## @@ -17,15 +17,14 @@ .. code-block:: python - from airflow.models.taskinstance import TaskInstance - from airflow.models.dagrun import DagRun + from airflow.sdk.api.datamodels._generated import DagRun + from airflow.sdk.execution_time.task_runner import RuntimeTaskInstance Review Comment: But let back the reason why there's a type Hint. My understanding is that, type hint helps language server to recognize the variable type. with correct type hint, editior can show the correct method/attribute. ---- For airflow to correct assign the context variable, (the second type of `print_info`). Though I don't know how airflow unpack **kwargs in this case. ```python def print_ti_info(task_instance: RuntimeTaskInstanceProtocol, dag_run: DagRunProtocol) ``` Duck typing works. But editors/developers still can't find the correct attributes of the variable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
