AP24110011695 opened a new pull request, #76486:
URL: https://github.com/apache/airflow/pull/76486
**Stacked on #76481** (same export-surface concern; that PR adds the file
this one extends).
### Problem
`airflow.sdk` resolves its 105-name public API through module-level
`__getattr__` (PEP 562 lazy imports) but defines no `__dir__`. So
`dir(airflow.sdk)` — the surface IDEs, REPLs, debuggers and documentation
tooling rely on — exposes almost none of the public API until each name is
accessed first.
PEP 562's recommended pairing for `__getattr__` is a matching `__dir__`.
### Fix
```python
def __dir__() -> list[str]:
return sorted({*globals(), *__lazy_imports})
```
`dir(airflow.sdk)` now lists all lazy imports (122 entries, verified at
runtime), sorted, without importing any of them.
### Test
Extends `task-sdk/tests/test_sdk_public_api.py` with
`test_dir_lists_lazy_imports`: every `__lazy_imports` name must appear in
`dir(airflow.sdk)`. Fails on the parent commit (assertion names the missing
entries), passes with the change; the two existing guard tests still pass.
`ruff` (pinned 0.17.3) check + format clean on both touched files.
---
_Transparent disclosure: developed and verified with AI assistance under
human direction, per the repo's agent guidelines._
--
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]