Skip to content

Commit

Permalink
HACK: Install uv in user venv and use it to pip install wheels.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosperate committed Feb 16, 2024
1 parent e086cbe commit d6ab00c
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions mu/virtual_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,18 @@ def run(
params.extend(args)

if slots.output is None:
result = self.process.run_blocking(
self.executable, params, wait_for_s=wait_for_s
)
if command == "install":
venv_path = os.path.dirname(os.path.dirname(self.executable))
exe = self.executable.replace("pip", "uv")
params.remove("--disable-pip-version-check")
result = self.process.run_blocking(
exe, ["pip"] + params, wait_for_s=wait_for_s,
VIRTUAL_ENV=venv_path
)
else:
result = self.process.run_blocking(
self.executable, params, wait_for_s=wait_for_s
)
logger.debug("Process output: %s", compact(result.strip()))
return result
else:
Expand Down Expand Up @@ -886,6 +895,15 @@ def create_venv(self):
),
)
ok, output = self.run_subprocess(*args, env=env)
args = filter(
None,
(
os.path.join(self.path, "bin", "pip"),
"install",
"uv",
),
)
ok, output = self.run_subprocess(*args, env=env)
if ok:
logger.info(
"Created virtual environment using %s at %s",
Expand Down Expand Up @@ -951,6 +969,7 @@ def install_from_zipped_wheels(self, zipped_wheels_filepath):
os.path.basename(wheel)
)
)
wheel = f"{os.path.basename(wheel).split('-')[0]}@{wheel}"
self.pip.install(wheel, deps=False, index=False)

def install_baseline_packages(self):
Expand Down

0 comments on commit d6ab00c

Please sign in to comment.