Skip to content

Commit 667ba76

Browse files
committed
use the top-level SDK path (e.g. airflow.sdk.DAG)
1 parent 930a600 commit 667ba76

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

task-sdk/docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Assets
6969
Everything else
7070
---------------
7171

72-
.. autoapimodule:: airflow.sdk
72+
.. autoapi_module:: airflow.sdk
7373
:members:
7474
:exclude-members: BaseOperator, DAG, dag, asset, Asset, AssetAlias, AssetAll, AssetAny, AssetWatcher, TaskGroup, XComArg, get_current_context, get_parsing_context
7575
:undoc-members:

task-sdk/docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
autoapi_options = [
4444
"undoc-members",
4545
"members",
46+
"imported-members",
4647
]
4748
autoapi_add_toctree_entry = False
4849
autoapi_generate_api_docs = False
@@ -78,6 +79,6 @@ def skip_util_classes(app, objtype, name, obj, skip, options):
7879
return skip
7980

8081

81-
def setup(sphinx):
82-
# sphinx.connect("autoapi-skip-member", skip_util_classes)
83-
...
82+
def setup(app):
83+
# Skip utility classes from definitions modules, but expose DAG under airflow.sdk.DAG
84+
app.connect("autoapi-skip-member", skip_util_classes)

task-sdk/tests/test_docs_inventory.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
# under the License.
1717
from __future__ import annotations
1818

19+
import sys
20+
from pathlib import Path
21+
22+
# Add the SDK src directory to sys.path so that importlib loads our airflow.sdk module
23+
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
1924
import importlib
2025
import shutil
2126
import subprocess
@@ -62,7 +67,11 @@ def test_docs_inventory_matches_public_api(tmp_path):
6267
assert inv_path.exists(), "objects.inv not found after docs build"
6368

6469
inv = read_inventory(inv_path)
65-
documented = {name.rsplit(".", 1)[-1] for name in inv.keys()}
70+
documented = {
71+
name.rsplit(".", 1)[-1]
72+
for name in inv.keys()
73+
if name.startswith("airflow.sdk.") and name.count(".") == 2
74+
}
6675
sdk = importlib.import_module("airflow.sdk")
6776
public = set(getattr(sdk, "__all__", []))
6877

0 commit comments

Comments
 (0)