You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2025/11/13 11:53:30 UTC
[PR] Remove SDK reference for NOTSET in Airflow Core [airflow]
uranusjr opened a new pull request, #58258:
URL: https://github.com/apache/airflow/pull/58258
ACTUALLY one reference is kept---if both Core and SDK exist in the same process, we still try to import the SDK sentinels if we can, so they are actually sentinels as expected. Only if when the SDK is NOT available, we define a separate type in the process.
--
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] Remove SDK reference for NOTSET in Airflow Core [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #58258:
URL: https://github.com/apache/airflow/pull/58258#discussion_r2523195872
##########
airflow-core/src/airflow/serialization/definitions/notset.py:
##########
@@ -18,7 +18,26 @@
from __future__ import annotations
-from airflow.sdk.definitions._internal.types import NOTSET, ArgNotSet
+from typing import TYPE_CHECKING, TypeVar
-# TODO (GH-52141): Have different NOTSET and ArgNotSet in the scheduler.
-__all__ = ["NOTSET", "ArgNotSet"]
+if TYPE_CHECKING:
+ from typing_extensions import TypeIs
+
+ T = TypeVar("T")
+
+__all__ = ["NOTSET", "ArgNotSet", "is_set"]
+
+
+try:
+ # If core and SDK exist together, use the SDK to avoid identity issues.
+ from airflow.sdk.definitions._internal.types import NOTSET, ArgNotSet
+except ModuleNotFoundError:
+
+ class ArgNotSet: # type: ignore[no-redef]
+ """Sentinel type for annotations, useful when None is not viable."""
+
+ NOTSET = ArgNotSet()
+
+
+def is_set(value: T | ArgNotSet) -> TypeIs[T]:
Review Comment:
nit: `is_arg_set`?
##########
task-sdk/src/airflow/sdk/definitions/_internal/types.py:
##########
@@ -36,19 +43,15 @@ def is_arg_passed(arg: Union[ArgNotSet, None] = NOTSET) -> bool:
is_arg_passed(None) # True.
"""
- @staticmethod
- def serialize():
- return "NOTSET"
-
- @classmethod
- def deserialize(cls):
- return cls
-
NOTSET = ArgNotSet()
"""Sentinel value for argument default. See ``ArgNotSet``."""
+def is_set(value: T | ArgNotSet) -> TypeIs[T]:
Review Comment:
Same as above
--
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] Remove SDK reference for NOTSET in Airflow Core [airflow]
Posted by "uranusjr (via GitHub)" <gi...@apache.org>.
uranusjr merged PR #58258:
URL: https://github.com/apache/airflow/pull/58258
--
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