Skip to content

Commit

Permalink
fixup emit_* options for uv compile
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 27, 2024
1 parent 9f1bda2 commit 5b783c5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions comfy_cli/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ def Install_Build_Deps(executable: PathLike = sys.executable):
def Compile(
cwd: PathLike,
reqFiles: list[PathLike],
emit_index_annotation: bool = True,
emit_index_url: bool = True,
executable: PathLike = sys.executable,
index_strategy: str = "unsafe-best-match",
override: Optional[PathLike] = None,
out: Optional[PathLike] = None,
override: Optional[PathLike] = None,
resolve_strategy: Optional[str] = None,
) -> subprocess.CompletedProcess[Any]:
cmd = [
Expand All @@ -95,24 +97,28 @@ def Compile(
"uv",
"pip",
"compile",
"--emit-index-url",
"--emit-index-annotation",
]

for reqFile in reqFiles:
cmd.append(str(reqFile))

if emit_index_annotation:
cmd.append("--emit-index-annotation")

if emit_index_url:
cmd.append("--emit-index-url")

# ensures that eg tqdm is latest version, even though an old tqdm is on the amd url
# see https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#packages-that-exist-on-multiple-indexes and https://github.com/astral-sh/uv/issues/171
if index_strategy is not None:
cmd.extend(["--index-strategy", "unsafe-best-match"])

if override is not None:
cmd.extend(["--override", str(override)])

if out is not None:
cmd.extend(["-o", str(out)])

if override is not None:
cmd.extend(["--override", str(override)])

try:
return _run(cmd, cwd)
except subprocess.CalledProcessError as e:
Expand Down Expand Up @@ -362,6 +368,8 @@ def make_override(self):
completed = DependencyCompiler.Compile(
cwd=self.cwd,
reqFiles=self.reqFilesCore,
emit_index_annotation=False,
emit_index_url=False,
executable=self.executable,
override=self.override,
)
Expand Down

0 comments on commit 5b783c5

Please sign in to comment.