You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "rapsealk (via GitHub)" <gi...@apache.org> on 2026/07/28 08:39:50 UTC

[PR] fix: Add deadline and callback exports to `airflow.sdk` type stub [airflow]

rapsealk opened a new pull request, #70578:
URL: https://github.com/apache/airflow/pull/70578

   `AsyncCallback`, `SyncCallback`, `DeadlineAlert` and `DeadlineReference` are importable from `airflow.sdk` at runtime via its lazy import map, but `task-sdk/src/airflow/sdk/__init__.pyi` had no entries for them. The Deadline Alerts documentation tells users to write `from airflow.sdk import DeadlineAlert`, which then fails a type check:
   
   ```
   error: Module "airflow.sdk" has no attribute "DeadlineAlert"  [attr-defined]
   ```
   
   This adds the four names to the stub's imports and `__all__`. `SyncCallback` is included for stub/runtime parity — it is a public class in `airflow.sdk.definitions.callback` alongside `AsyncCallback`, and leaving it out would just reproduce the same gap for the next user.
   
   Split out of #66269 at review request — that PR mixed this fix with an example Dag and a serialization fix.
   
   ## Verification
   
   - `prek run mypy-task-sdk --all-files` passes.
   - With this change applied, a Dag using `from airflow.sdk import DAG, AsyncCallback, DeadlineAlert, DeadlineReference, task` typechecks clean under `mypy-airflow-core`; without it, mypy reports three `attr-defined` errors.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add deadline and callback exports to `airflow.sdk` type stub [airflow]

Posted by "ferruzzi (via GitHub)" <gi...@apache.org>.
ferruzzi commented on PR #70578:
URL: https://github.com/apache/airflow/pull/70578#issuecomment-5592389262

   Closing this asit appears this has already landed.  To be clear, your change was right, we just mixed up the merge order.
   
   This was split out of #66269 at review request, but #66269 then merged on 29 August still carrying the same six lines in `task-sdk/src/airflow/sdk/__init__.pyi`, so the split never got reflected in the parent.  I compared the two changesets line by line and they are identical.  All six are on `main` today, each exactly once:
   
   - `from airflow.sdk.definitions.callback import AsyncCallback, SyncCallback`
   - `from airflow.sdk.definitions.deadline import DeadlineAlert, DeadlineReference`
   - `"AsyncCallback"`, `"SyncCallback"`, `"DeadlineAlert"` and `"DeadlineReference"` in `__all__`
   
   So the gap you reported is closed, including `SyncCallback` which you argued for on stub/runtime parity grounds, and the fix is credited to you via #66269 either way.
   
   Thanks for doing the split, and apologies that it ended up unused.  If you (or anyone else) sees this and thinks it's a mistake, please let me know.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add deadline and callback exports to `airflow.sdk` type stub [airflow]

Posted by "ferruzzi (via GitHub)" <gi...@apache.org>.
ferruzzi closed pull request #70578: Add deadline and callback exports to `airflow.sdk` type stub
URL: https://github.com/apache/airflow/pull/70578


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org