This is an automated email from the ASF dual-hosted git repository.
potiuk 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 dc715304bc8 Improve docstring with usage for add_deprecated_classes
(#50436)
dc715304bc8 is described below
commit dc715304bc8c78f97457104fc6d5b391929e75c7
Author: Amogh Desai <[email protected]>
AuthorDate: Sat May 10 21:37:05 2025 +0530
Improve docstring with usage for add_deprecated_classes (#50436)
---
airflow-core/src/airflow/utils/deprecation_tools.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/airflow-core/src/airflow/utils/deprecation_tools.py
b/airflow-core/src/airflow/utils/deprecation_tools.py
index 0d19e1f70f4..abf575d61e0 100644
--- a/airflow-core/src/airflow/utils/deprecation_tools.py
+++ b/airflow-core/src/airflow/utils/deprecation_tools.py
@@ -79,6 +79,15 @@ def add_deprecated_classes(
:param override_deprecated_classes: override target classes with
deprecated ones. If module +
target class is found in the dictionary, it will be displayed in the
warning message.
:param extra_message: extra message to display in the warning or import
error message
+
+ Example:
+ add_deprecated_classes(
+ {"basenotifier": {"BaseNotifier":
"airflow.sdk.bases.notifier.BaseNotifier"}},
+ package=__name__,
+ )
+
+ This makes 'from airflow.notifications.basenotifier import BaseNotifier'
still work,
+ even if 'basenotifier.py' was removed, and shows a warning with the new
path.
"""
for module_name, imports in module_imports.items():
full_module_name = f"{package}.{module_name}"