From b82c428697b5210020c3251f1796cb6101386039 Mon Sep 17 00:00:00 2001 From: Andrey Anshin Date: Tue, 23 Apr 2024 14:21:46 +0400 Subject: [PATCH] Add warning about run/import Airflow under the Windows (#39196) --- airflow/__init__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/airflow/__init__.py b/airflow/__init__.py index 65bf6ef5f635a..c19d298092454 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -21,6 +21,7 @@ import os import sys +import warnings if os.environ.get("_AIRFLOW_PATCH_GEVENT"): # If you are using gevents and start airflow webserver, you might want to run gevent monkeypatching @@ -30,6 +31,17 @@ patch_all() +if sys.platform == "win32": + warnings.warn( + "Airflow currently can be run on POSIX-compliant Operating Systems. For development, " + "it is regularly tested on fairly modern Linux Distros and recent versions of macOS. " + "On Windows you can run it via WSL2 (Windows Subsystem for Linux 2) or via Linux Containers. " + "The work to add Windows support is tracked via https://github.com/apache/airflow/issues/10388, " + "but it is not a high priority.", + category=RuntimeWarning, + stacklevel=1, + ) + # The configuration module initializes and validates the conf object as a side effect the first # time it is imported. If it is not imported before importing the settings module, the conf # object will then be initted/validated as a side effect of it being imported in settings, @@ -76,8 +88,6 @@ def __getattr__(name: str): module_path, attr_name, deprecated = __lazy_imports.get(name, ("", "", False)) if not module_path: if name.startswith("PY3") and (py_minor := name[3:]) in ("6", "7", "8", "9", "10", "11", "12"): - import warnings - warnings.warn( f"Python version constraint {name!r} is deprecated and will be removed in the future. " f"Please get version info from the 'sys.version_info'.", @@ -88,8 +98,6 @@ def __getattr__(name: str): raise AttributeError(f"module {__name__!r} has no attribute {name!r}") elif deprecated: - import warnings - warnings.warn( f"Import {name!r} directly from the airflow module is deprecated and " f"will be removed in the future. Please import it from 'airflow{module_path}.{attr_name}'.",