This is an automated email from the ASF dual-hosted git repository. uranusjr pushed a commit to branch backport-2031171-v3-1-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 0cd9988f76c3ef5082e60370c3827a6e599a56c8 Author: Tzu-ping Chung <[email protected]> AuthorDate: Wed Dec 24 22:08:09 2025 +0800 [v3-1-test] Expose literal and ParamsDict at SDK top level (#59782) (cherry picked from commit 20311719342318ccc4ae3bac68a067a70281eb67) Co-authored-by: Tzu-ping Chung <[email protected]> --- task-sdk/docs/api.rst | 14 ++++++++------ task-sdk/src/airflow/sdk/__init__.py | 5 ++++- task-sdk/tests/task_sdk/docs/test_public_api.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/task-sdk/docs/api.rst b/task-sdk/docs/api.rst index c689a21c7e0..f2ace936dbc 100644 --- a/task-sdk/docs/api.rst +++ b/task-sdk/docs/api.rst @@ -66,8 +66,6 @@ Bases .. autoapiclass:: airflow.sdk.BaseXCom -.. autoapiclass:: airflow.sdk.XComArg - .. autoapiclass:: airflow.sdk.PokeReturnValue .. autoapiclass:: airflow.sdk.BaseHook @@ -82,14 +80,20 @@ Tasks & Operators ----------------- .. autoapiclass:: airflow.sdk.TaskGroup -.. autoapifunction:: airflow.sdk.get_current_context +.. autoapiclass:: airflow.sdk.XComArg -.. autoapifunction:: airflow.sdk.get_parsing_context +.. autoapifunction:: airflow.sdk.literal .. autoapiclass:: airflow.sdk.Param +.. autoclass:: airflow.sdk.ParamsDict + .. autoclass:: airflow.sdk.TriggerRule +.. autoapifunction:: airflow.sdk.get_current_context + +.. autoapifunction:: airflow.sdk.get_parsing_context + State Enums ----------- .. autoclass:: airflow.sdk.TaskInstanceState @@ -106,8 +110,6 @@ Setting Dependencies .. autoapifunction:: airflow.sdk.cross_downstream -.. autoapifunction:: airflow.sdk.literal - Edges & Labels ~~~~~~~~~~~~~~ .. autoapiclass:: airflow.sdk.EdgeModifier diff --git a/task-sdk/src/airflow/sdk/__init__.py b/task-sdk/src/airflow/sdk/__init__.py index a2530097eb6..33cf6cc0d1d 100644 --- a/task-sdk/src/airflow/sdk/__init__.py +++ b/task-sdk/src/airflow/sdk/__init__.py @@ -39,6 +39,7 @@ __all__ = [ "Metadata", "ObjectStoragePath", "Param", + "ParamsDict", "PokeReturnValue", "TaskGroup", "TaskInstanceState", @@ -78,7 +79,7 @@ if TYPE_CHECKING: from airflow.sdk.definitions.decorators import setup, task, teardown from airflow.sdk.definitions.decorators.task_group import task_group from airflow.sdk.definitions.edges import EdgeModifier, Label - from airflow.sdk.definitions.param import Param + from airflow.sdk.definitions.param import Param, ParamsDict from airflow.sdk.definitions.taskgroup import TaskGroup from airflow.sdk.definitions.template import literal from airflow.sdk.definitions.variable import Variable @@ -105,6 +106,7 @@ __lazy_imports: dict[str, str] = { "Metadata": ".definitions.asset.metadata", "ObjectStoragePath": ".io.path", "Param": ".definitions.param", + "ParamsDict": ".definitions.param", "PokeReturnValue": ".bases.sensor", "SecretCache": ".execution_time.cache", "TaskGroup": ".definitions.taskgroup", @@ -120,6 +122,7 @@ __lazy_imports: dict[str, str] = { "dag": ".definitions.dag", "get_current_context": ".definitions.context", "get_parsing_context": ".definitions.context", + "literal": ".definitions.template", "setup": ".definitions.decorators", "task": ".definitions.decorators", "task_group": ".definitions.decorators", diff --git a/task-sdk/tests/task_sdk/docs/test_public_api.py b/task-sdk/tests/task_sdk/docs/test_public_api.py index 9c72fefaa87..99ce259beb3 100644 --- a/task-sdk/tests/task_sdk/docs/test_public_api.py +++ b/task-sdk/tests/task_sdk/docs/test_public_api.py @@ -68,7 +68,7 @@ def test_lazy_imports_match_public_api(): import airflow.sdk as sdk lazy = getattr(sdk, "__lazy_imports", {}) - expected = set(getattr(sdk, "__all__", [])) - {"__version__", "literal"} + expected = set(getattr(sdk, "__all__", [])) - {"__version__"} ignore = {"SecretCache"} actual = set(lazy.keys()) missing = expected - actual
