Skip to content

Commit

Permalink
mark staticmethods with UpperCamelCase names
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 2, 2024
1 parent 00e447e commit 0773ed0
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions comfy_cli/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ class DependencyCompiler:
}

@staticmethod
def findReqFiles(*ders: PathLike) -> list[Path]:
def FindReqFiles(*ders: PathLike) -> list[Path]:
return [file
for der in ders
for file in Path(der).absolute().iterdir()
if file.name in DependencyCompiler.reqNames
]

@staticmethod
def installBuildDeps():
def InstallBuildDeps():
"""Use pip to install bare minimum requirements for uv to do its thing
"""
if shutil.which("uv") is None:
_check_call(cmd=["python", "-m", "pip", "install", "-U", "pip"])
_check_call(cmd=["python", "-m", "pip", "install", "uv"])

@staticmethod
def compile(
def Compile(
cwd: PathLike,
reqFiles: list[PathLike],
override: Optional[PathLike] = None,
Expand Down Expand Up @@ -102,7 +102,7 @@ def compile(
return _run(cmd, cwd)

@staticmethod
def install(
def Install(
cwd: PathLike,
reqFile: list[PathLike],
override: Optional[PathLike] = None,
Expand Down Expand Up @@ -144,7 +144,7 @@ def install(
return _check_call(cmd, cwd)

@staticmethod
def sync(
def Sync(
cwd: PathLike,
reqFile: list[PathLike],
extraUrl: Optional[str] = None,
Expand Down Expand Up @@ -178,7 +178,7 @@ def sync(
return _check_call(cmd, cwd)

@staticmethod
def resolveGpu(gpu: Union[str, None]):
def ResolveGpu(gpu: Union[str, None]):
if gpu is None:
try:
tver = metadata.version("torch")
Expand All @@ -203,7 +203,7 @@ def __init__(
):
self.cwd = Path(cwd)
self.reqFiles = [Path(reqFile) for reqFile in reqFilesExt] if reqFilesExt is not None else None
self.gpu = DependencyCompiler.resolveGpu(gpu)
self.gpu = DependencyCompiler.ResolveGpu(gpu)

self.gpuUrl = DependencyCompiler.nvidiaPytorchUrl if self.gpu == GPU_OPTION.NVIDIA else DependencyCompiler.rocmPytorchUrl if self.gpu == GPU_OPTION.AMD else None
self.out = self.cwd / outName
Expand All @@ -213,11 +213,11 @@ def __init__(
self.reqFilesExt = reqFilesExt if reqFilesExt is not None else self.findExtReqs()

def findCoreReqs(self):
return DependencyCompiler.findReqFiles(self.cwd)
return DependencyCompiler.FindReqFiles(self.cwd)

def findExtReqs(self):
extDirs = [d for d in (self.cwd / "custom_nodes").iterdir() if d.is_dir() and d.name != "__pycache__"]
return DependencyCompiler.findReqFiles(*extDirs)
return DependencyCompiler.FindReqFiles(*extDirs)

def makeOverride(self):
#clean up
Expand All @@ -228,7 +228,7 @@ def makeOverride(self):
f.write(DependencyCompiler.overrideGpu.format(gpu=self.gpu, gpuUrl=self.gpuUrl))
f.write("\n\n")

coreOverride = DependencyCompiler.compile(
coreOverride = DependencyCompiler.Compile(
cwd=self.cwd,
reqFiles=self.reqFilesCore,
override=self.override
Expand All @@ -244,23 +244,23 @@ def compileCorePlusExt(self):
#clean up
self.out.unlink(missing_ok=True)

DependencyCompiler.compile(
DependencyCompiler.Compile(
cwd=self.cwd,
reqFiles=(self.reqFilesCore + self.reqFilesExt),
override=self.override,
out=self.out,
)

def installCorePlusExt(self):
DependencyCompiler.install(
DependencyCompiler.Install(
cwd=self.cwd,
reqFile=self.out,
override=self.override,
extraUrl=self.gpuUrl,
)

def syncCorePlusExt(self):
DependencyCompiler.sync(
DependencyCompiler.Sync(
cwd=self.cwd,
reqFile=self.out,
extraUrl=self.gpuUrl,
Expand Down Expand Up @@ -288,7 +288,7 @@ def handleOpencv(self):
f.write(line)

def installComfyDeps(self):
DependencyCompiler.installBuildDeps()
DependencyCompiler.InstallBuildDeps()

self.makeOverride()
self.compileCorePlusExt()
Expand Down

0 comments on commit 0773ed0

Please sign in to comment.