From 771a3581175fad649b222ab09791b34f0f7447bf Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org> Date: Tue, 5 Nov 2024 17:03:37 +0100 Subject: [PATCH] app_manager: Use more efficient uv cli instead of pip It's more efficient and faster for computing the requirements (twice as fast). --- scripts/app_manager.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/app_manager.py b/scripts/app_manager.py index af3c20d92..f9f0824df 100755 --- a/scripts/app_manager.py +++ b/scripts/app_manager.py @@ -71,11 +71,25 @@ class AppEnvBuilder(EnvBuilder): self.context = context + self.run_bootstrap_deps() self.run_pip("install", "--upgrade", "pip", "setuptools", "wheel") + def run_bootstrap_deps(self, *args, capture_output=False): + """Install the necessary dependencies to run pip/uv.""" + return self.run_command( + [self.context.env_exe, "-m", "pip", "install", "uv"], + capture_output=capture_output, + ) + def run_pip(self, *args, capture_output=False): - cmd = [self.context.env_exe, "-m", "pip", *args] + """Execute pip command through the uv cli.""" + return self.run_command( + [self.context.env_exe, "-m", "uv", "pip", *args], + capture_output=capture_output, + ) + def run_command(self, cmd: List[str], capture_output=False): + """Actually execute the cmd.""" return subprocess.run(cmd, capture_output=capture_output, check=True) -- GitLab