Skip to content

Commit 7534931

Browse files
committed
Support overriding installer for make-variant
1 parent 382129c commit 7534931

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

variantlib/commands/make_variant.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def make_variant(args: list[str]) -> None:
4646
help="Output Directory to use to store the Wheel Variant",
4747
)
4848

49+
parser.add_argument(
50+
"--installer",
51+
choices=("pip", "uv"),
52+
help="Installer to use for providers (choices: pip, uv)",
53+
)
54+
4955
group = parser.add_mutually_exclusive_group(required=True)
5056

5157
group.add_argument(
@@ -100,6 +106,7 @@ def make_variant(args: list[str]) -> None:
100106
properties=parsed_args.properties,
101107
validate_properties=not parsed_args.skip_plugin_validation,
102108
variant_info=pyproject_toml,
109+
installer=parsed_args.installer,
103110
)
104111

105112

@@ -111,6 +118,7 @@ def _make_variant(
111118
properties: list[VariantProperty],
112119
validate_properties: bool = True,
113120
variant_info: VariantPyProjectToml,
121+
installer: str | None = None,
114122
) -> None:
115123
# Input Validation
116124
if not input_filepath.is_file():
@@ -133,7 +141,17 @@ def _make_variant(
133141
if validate_properties:
134142
from build.env import DefaultIsolatedEnv
135143

136-
with DefaultIsolatedEnv() as venv:
144+
# make it really verbose to make mypy happy
145+
if installer is None:
146+
env_factory = DefaultIsolatedEnv()
147+
elif installer == "pip":
148+
env_factory = DefaultIsolatedEnv(installer="pip")
149+
elif installer == "uv":
150+
env_factory = DefaultIsolatedEnv(installer="uv")
151+
else:
152+
raise ValueError(f"unexpected installer={installer}")
153+
154+
with env_factory as venv:
137155
try:
138156
venv.install(
139157
variant_info.get_provider_requires(

0 commit comments

Comments
 (0)