You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2025/04/23 18:31:03 UTC
(airflow) 03/03: Add backcompat shim for get_current_context (#49630)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit e386b3e449e3c0cf7d0dd3f3d82f861dd66de2e1
Author: Amogh Desai <am...@gmail.com>
AuthorDate: Wed Apr 23 20:17:22 2025 +0530
Add backcompat shim for get_current_context (#49630)
* Add backcompat shim for get_current_context
* use sdk!
Co-authored-by: Kaxil Naik <ka...@gmail.com>
---------
Co-authored-by: Kaxil Naik <ka...@gmail.com>
(cherry picked from commit 59260fe13a6ec269bb3b278581ec5f965f10b236)
---
airflow-core/src/airflow/operators/__init__.py | 1 +
airflow-core/src/airflow/utils/deprecation_tools.py | 2 ++
2 files changed, 3 insertions(+)
diff --git a/airflow-core/src/airflow/operators/__init__.py b/airflow-core/src/airflow/operators/__init__.py
index df46ec18164..5e0b62cc344 100644
--- a/airflow-core/src/airflow/operators/__init__.py
+++ b/airflow-core/src/airflow/operators/__init__.py
@@ -35,6 +35,7 @@ __deprecated_classes = {
"ExternalPythonOperator": "airflow.providers.standard.operators.python.ExternalPythonOperator",
"BranchExternalPythonOperator": "airflow.providers.standard.operators.python.BranchExternalPythonOperator",
"BranchPythonVirtualenvOperator": "airflow.providers.standard.operators.python.BranchPythonVirtualenvOperator",
+ "get_current_context": "airflow.sdk.get_current_context",
},
"bash":{
"BashOperator": "airflow.providers.standard.operators.bash.BashOperator",
diff --git a/airflow-core/src/airflow/utils/deprecation_tools.py b/airflow-core/src/airflow/utils/deprecation_tools.py
index e819e92b901..0d19e1f70f4 100644
--- a/airflow-core/src/airflow/utils/deprecation_tools.py
+++ b/airflow-core/src/airflow/utils/deprecation_tools.py
@@ -72,6 +72,8 @@ def add_deprecated_classes(
"""
Add deprecated class PEP-563 imports and warnings modules to the package.
+ Side note: It also works for methods, not just classes.
+
:param module_imports: imports to use
:param package: package name
:param override_deprecated_classes: override target classes with deprecated ones. If module +