uplsh580 commented on code in PR #62277:
URL: https://github.com/apache/airflow/pull/62277#discussion_r2867453998


##########
dev/breeze/src/airflow_breeze/utils/run_utils.py:
##########
@@ -212,6 +212,16 @@ def get_environments_to_print(env: Mapping[str, str] | 
None):
     return env_to_print
 
 
+def get_prek_executable() -> str:
+    """Return path to prek executable in same env as breeze (bin/prek)."""
+    prek_bin = shutil.which("prek", path=str(Path(sys.executable).parent))
+    if prek_bin is not None:
+        return prek_bin
+    # Fallback when prek is not found via which (e.g. Windows .exe resolution)
+    prek_in_bin = Path(sys.executable).parent / ("prek.exe" if sys.platform == 
"win32" else "prek")

Review Comment:
   You're right. That fallback logic was redundant since shutil.which already 
handles executable resolution (including PATHEXT on Windows).
   
   I've removed the manual path construction and updated the code to use the 
new -m option, which was recently introduced in prek v0.3.4 
([j178/prek#1686](https://github.com/j178/prek/pull/1686)). This makes the 
implementation much cleaner and relies on the official support from the tool 
itself.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to