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

gopidesu 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 ab25e19089f Add a warning about python interpreter using with uv 
(#54262)
ab25e19089f is described below

commit ab25e19089ff5dc108bb939780ce2941f50173b9
Author: GPK <[email protected]>
AuthorDate: Fri Aug 8 11:57:53 2025 +0100

    Add a warning about python interpreter using with uv (#54262)
    
    * Add a warning about python interpreter using with uv
    
    * resolve comments
    
    * resolve comments
---
 .../src/airflow/providers/standard/utils/python_virtualenv.py  | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/providers/standard/src/airflow/providers/standard/utils/python_virtualenv.py 
b/providers/standard/src/airflow/providers/standard/utils/python_virtualenv.py
index 37ab5bee497..d89d0ed8971 100644
--- 
a/providers/standard/src/airflow/providers/standard/utils/python_virtualenv.py
+++ 
b/providers/standard/src/airflow/providers/standard/utils/python_virtualenv.py
@@ -21,6 +21,7 @@ from __future__ import annotations
 
 import os
 import shutil
+import warnings
 from pathlib import Path
 
 import jinja2
@@ -55,6 +56,15 @@ def _use_uv() -> bool:
 
 def _generate_uv_cmd(tmp_dir: str, python_bin: str, system_site_packages: 
bool) -> list[str]:
     """Build the command to install the venv via UV."""
+    if python_bin == "python" or python_bin == "python3":
+        python_interpreter_exists = bool(shutil.which(python_bin))
+        if not python_interpreter_exists:
+            warnings.warn(
+                f"uv trying to use `{python_bin}` as the python interpreter. 
it could lead to errors if the python interpreter not found in PATH. "
+                f"please specify python_version in operator.",
+                UserWarning,
+                stacklevel=3,
+            )
     cmd = ["uv", "venv", "--allow-existing", "--seed", "--python", python_bin]
     if system_site_packages:
         cmd.append("--system-site-packages")

Reply via email to