This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-9-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 8e458d979ee269bdf6e51dd22e1c083808c429db
Author: Andrey Anshin <[email protected]>
AuthorDate: Tue Apr 23 14:21:46 2024 +0400

    Add warning about run/import Airflow under the Windows (#39196)
    
    (cherry picked from commit b82c428697b5210020c3251f1796cb6101386039)
---
 airflow/__init__.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/airflow/__init__.py b/airflow/__init__.py
index f3aa6c3277..197f52c84a 100644
--- a/airflow/__init__.py
+++ b/airflow/__init__.py
@@ -21,6 +21,7 @@ __version__ = "2.9.0"
 
 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 @@ if os.environ.get("_AIRFLOW_PATCH_GEVENT"):
 
     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'.",
@@ -87,8 +97,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}'.",

Reply via email to