From 7ce2ff99cc04f99af35f8336137e22ba0428d557 Mon Sep 17 00:00:00 2001 From: Amogh Desai Date: Sat, 10 May 2025 17:01:18 +0530 Subject: [PATCH] Improve docstring with usage for add_deprecated_classes --- 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 0d19e1f70f455..abf575d61e0ed 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}"