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 4231a87ff2d Deprecate `airflow.utils.warnings` properly (#53339)
4231a87ff2d is described below
commit 4231a87ff2d331b6de83d810f85477654ca03b63
Author: Amogh Desai <[email protected]>
AuthorDate: Sat Jul 19 10:56:57 2025 +0530
Deprecate `airflow.utils.warnings` properly (#53339)
---
airflow-core/src/airflow/utils/__init__.py | 19 +------------------
airflow-core/src/airflow/utils/warnings.py | 22 ----------------------
2 files changed, 1 insertion(+), 40 deletions(-)
diff --git a/airflow-core/src/airflow/utils/__init__.py
b/airflow-core/src/airflow/utils/__init__.py
index 39a213c77c6..153438c8c16 100644
--- a/airflow-core/src/airflow/utils/__init__.py
+++ b/airflow-core/src/airflow/utils/__init__.py
@@ -20,24 +20,6 @@ from __future__ import annotations
from airflow.utils.deprecation_tools import add_deprecated_classes
-
-def _deprecate_this_module(message: str, **shims: tuple[str, str]):
- import warnings
-
- from airflow.exceptions import RemovedInAirflow4Warning
-
- warnings.warn(message, RemovedInAirflow4Warning, stacklevel=3)
-
- def __getattr__(name: str):
- try:
- impa, attr = shims[name]
- except KeyError:
- raise AttributeError(f"module {__name__!r} has no attribute
{name!r}") from None
- return getattr(__import__(impa), attr)
-
- return __getattr__
-
-
__deprecated_classes = {
"setup_teardown": {
"BaseSetupTeardownContext":
"airflow.sdk.definitions._internal.setup_teardown.BaseSetupTeardownContext",
@@ -47,4 +29,5 @@ __deprecated_classes = {
"XCOM_RETURN_KEY": "airflow.models.xcom.XCOM_RETURN_KEY",
},
}
+
add_deprecated_classes(__deprecated_classes, __name__)
diff --git a/airflow-core/src/airflow/utils/warnings.py
b/airflow-core/src/airflow/utils/warnings.py
deleted file mode 100644
index ab6e201fec5..00000000000
--- a/airflow-core/src/airflow/utils/warnings.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-from __future__ import annotations
-
-from airflow.utils import _deprecate_this_module
-
-__getattr__ = _deprecate_this_module("airflow.utils.warnings is deprecated.")