Skip to content

Commit a565a5f

Browse files
committed
hatch: Update to use find_uv_bin()
1 parent 306dd82 commit a565a5f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/hatch/cli/application.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
from __future__ import annotations
22

33
import os
4+
import pathlib
45
import sys
56
from functools import cached_property
67
from typing import TYPE_CHECKING, cast
78

9+
from uv import find_uv_bin
10+
811
from hatch.cli.terminal import Terminal
912
from hatch.config.user import ConfigFile, RootConfig
1013
from hatch.project.core import Project
1114
from hatch.utils.fs import Path
1215
from hatch.utils.platform import Platform
1316
from hatch.utils.runner import ExecutionContext
1417

15-
from uv import find_uv_bin
16-
1718
if TYPE_CHECKING:
1819
from collections.abc import Generator
1920

@@ -165,7 +166,7 @@ def ensure_plugin_dependencies(self, dependencies: list[Requirement], *, wait_me
165166
uv_bin = find_uv_bin()
166167
pip_command = [uv_bin, 'pip']
167168

168-
pip_command.extend(['install'])
169+
pip_command.extend(['install', '--directory', str(pathlib.Path(sys.executable).parent.parent)])
169170

170171
# Default to -1 verbosity
171172
add_verbosity_flag(pip_command, self.verbosity, adjustment=-1)

tests/helpers/helpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import importlib
44
import json
55
import os
6+
import pathlib
67
import re
78
import sys
89
from datetime import datetime, timezone
@@ -50,7 +51,13 @@ def get_current_timestamp():
5051

5152
def assert_plugin_installation(subprocess_run, dependencies: list[str], *, verbosity=0, count=1):
5253
uv_bin = find_uv_bin()
53-
command = [uv_bin, 'pip', 'install']
54+
command = [
55+
uv_bin,
56+
'pip',
57+
'install',
58+
'--directory',
59+
str(pathlib.Path(sys.executable).parent.parent),
60+
]
5461
add_verbosity_flag(command, verbosity, adjustment=-1)
5562
command.extend(dependencies)
5663

0 commit comments

Comments
 (0)