This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0ae12a1560c Correct compat shim routing for XCom models and introduce
deprecation warning (#62067)
0ae12a1560c is described below
commit 0ae12a1560c6a642497bedf5fdd186dbe189fe90
Author: Amogh Desai <[email protected]>
AuthorDate: Tue Feb 17 19:54:39 2026 +0530
Correct compat shim routing for XCom models and introduce deprecation
warning (#62067)
---
airflow-core/src/airflow/models/xcom.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/airflow-core/src/airflow/models/xcom.py
b/airflow-core/src/airflow/models/xcom.py
index 3dbbc6ca2c5..0f848bc60bf 100644
--- a/airflow-core/src/airflow/models/xcom.py
+++ b/airflow-core/src/airflow/models/xcom.py
@@ -411,9 +411,24 @@ __compat_imports = {
def __getattr__(name: str):
+ import importlib
+ import warnings
+
+ from airflow.utils.deprecation_tools import DeprecatedImportWarning
+
try:
modpath = __compat_imports[name]
except KeyError:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
from None
- globals()[name] = value = getattr(__import__(modpath), name)
+
+ warnings.warn(
+ f"Importing {name} from 'airflow.models.xcom' is deprecated and will
be removed in a future version. "
+ f"Please import from '{modpath}' instead.",
+ DeprecatedImportWarning,
+ stacklevel=2,
+ )
+
+ mod = importlib.import_module(modpath)
+ value = getattr(mod, name)
+ globals()[name] = value
return value