This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-10-test by this push:
new 77ce307139 Detect situation where Breeze is installed with both pipx
and uv (#43694) (#43695)
77ce307139 is described below
commit 77ce3071397922a86fda1aca907a343d64a4d3a1
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Nov 5 15:45:50 2024 +0100
Detect situation where Breeze is installed with both pipx and uv (#43694)
(#43695)
When breeze is installed with both - pipx and uv, we do not know
which version is available first on the path and self-upgrading
breeze might not upgrade the one that is first. Therefore we
detect that situation and fail self upgrade with appropriate
instructions what to do (recommending leaving uv as faster)
(cherry picked from commit ccd65867387117cd4503715195a877a1ac2892a2)
---
dev/breeze/src/airflow_breeze/utils/reinstall.py | 38 +++++++++++++++++++-----
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/utils/reinstall.py
b/dev/breeze/src/airflow_breeze/utils/reinstall.py
index 6165c8a307..6fdf994c6e 100644
--- a/dev/breeze/src/airflow_breeze/utils/reinstall.py
+++ b/dev/breeze/src/airflow_breeze/utils/reinstall.py
@@ -37,14 +37,38 @@ def reinstall_breeze(breeze_sources: Path, re_run: bool =
True):
# Breeze from different sources than originally installed (i.e. when we
reinstall airflow
# From the current directory.
get_console().print(f"\n[info]Reinstalling Breeze from {breeze_sources}\n")
- result = subprocess.run(["uv", "tool", "list"], text=True,
capture_output=True, check=False)
- if result.returncode == 0:
- if "apache-airflow-breeze" in result.stdout:
- subprocess.check_call(
- ["uv", "tool", "install", "--force", "--reinstall", "-e",
breeze_sources.as_posix()]
- )
- else:
+ breeze_installed_with_uv = False
+ breeze_installed_with_pipx = False
+ result_uv = subprocess.run(["uv", "tool", "list"], text=True,
capture_output=True, check=False)
+ if result_uv.returncode == 0:
+ if "apache-airflow-breeze" in result_uv.stdout:
+ breeze_installed_with_uv = True
+ result_pipx = subprocess.run(["pipx", "list"], text=True,
capture_output=True, check=False)
+ if result_pipx.returncode == 0:
+ if "apache-airflow-breeze" in result_pipx.stdout:
+ breeze_installed_with_pipx = True
+ if breeze_installed_with_uv and breeze_installed_with_pipx:
+ get_console().print(
+ "[error]Breeze is installed both with `uv` and `pipx`. This is not
supported.[/]\n"
+ )
+ get_console().print(
+ "[info]Please uninstall Breeze and install it only with one of the
methods[/]\n"
+ "[info]The `uv` installation method is recommended as it is much
faster[/]\n"
+ )
+ get_console().print(
+ "To uninstall Breeze installed with pipx run:\n pipx uninstall
apache-airflow-breeze\n"
+ )
+ get_console().print(
+ "To uninstall Breeze installed with uv run:\n uv tool
uninstall apache-airflow-breeze\n"
+ )
+ sys.exit(1)
+ elif breeze_installed_with_uv:
+ subprocess.check_call(
+ ["uv", "tool", "install", "--force", "--reinstall", "-e",
breeze_sources.as_posix()]
+ )
+ elif breeze_installed_with_pipx:
subprocess.check_call(["pipx", "install", "-e",
breeze_sources.as_posix(), "--force"])
+
if re_run:
# Make sure we don't loop forever if the metadata hash hasn't been
updated yet (else it is tricky to
# run pre-commit checks via breeze!)