From bbc308cd5bfbe28cb4763d8e44b05ab110afd482 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Thu, 23 Jul 2026 23:58:29 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20sweep=20dead-code=20cluster=20?= =?UTF-8?q?=E2=80=94=20unused=20Graph=20query=20API,=20vestigial=20Standal?= =?UTF-8?q?onePython=20installers,=20orphaned=20helpers=20(BE-4354)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete zero-reference symbols verified by word-boundary grep over the repo: - cql/engine.py Graph: pack_nodes, label_nodes, cloud_disabled_nodes, api_nodes, output_nodes, known_labels (kept cloud_enabled_nodes/packs/ downstream/find_paths) - standalone.py: install_comfy_cli, install_comfy (+ run_comfy_cli, orphaned once install_comfy went) - cmdline.py: validate_comfyui + commented-out scan_dir TODO block - update.py: get_version_from_pyproject (+ now-unused metadata import) - ui.py: prompt_autocomplete - utils.py: install_conda_package (+ now-unused subprocess/typer/rprint imports) - env_checker.py: EnvChecker.is_isolated_env - cql/errors.py: CQLRuntimeError.as_details --- comfy_cli/cmdline.py | 13 ------------- comfy_cli/cql/engine.py | 28 ---------------------------- comfy_cli/cql/errors.py | 3 --- comfy_cli/env_checker.py | 3 --- comfy_cli/standalone.py | 12 ------------ comfy_cli/ui.py | 20 -------------------- comfy_cli/update.py | 6 ------ comfy_cli/utils.py | 15 --------------- 8 files changed, 100 deletions(-) diff --git a/comfy_cli/cmdline.py b/comfy_cli/cmdline.py index 57c6f0d6..d02cbc44 100644 --- a/comfy_cli/cmdline.py +++ b/comfy_cli/cmdline.py @@ -351,13 +351,6 @@ def entry( ) ctx.exit() - # TODO: Move this to proper place - # start_time = time.time() - # workspace_manager.scan_dir() - # end_time = time.time() - # - # logging.info(f"scan_dir took {end_time - start_time:.2f} seconds to run") - def validate_commit_and_version(commit: str | None, ctx: typer.Context) -> str | None: """ @@ -1160,12 +1153,6 @@ def run_cli( ) -def validate_comfyui(_env_checker): - if _env_checker.comfy_repo is None: - rprint("[bold red]If ComfyUI is not installed, this feature cannot be used.[/bold red]") - raise typer.Exit(code=1) - - @app.command(help="Stop background ComfyUI") @tracking.track_command() def stop(): diff --git a/comfy_cli/cql/engine.py b/comfy_cli/cql/engine.py index 04439c21..0ae3e252 100644 --- a/comfy_cli/cql/engine.py +++ b/comfy_cli/cql/engine.py @@ -543,42 +543,14 @@ def downstream(self, name: str) -> list[Morphism]: result.sort(key=lambda m: m.id) return result - def pack_nodes(self, pack: str) -> list[Morphism]: - """All nodes belonging to a custom-node pack (case-insensitive).""" - p = pack.lower() - return sorted([m for m in self._nodes.values() if m.pack.lower() == p], key=lambda m: m.id) - - def label_nodes(self, label: str) -> list[Morphism]: - """All nodes carrying a specific behavioral label.""" - return sorted([m for m in self._nodes.values() if label in m.labels], key=lambda m: m.id) - - def cloud_disabled_nodes(self) -> list[Morphism]: - """All nodes that are disabled on Comfy Cloud.""" - return sorted([m for m in self._nodes.values() if m.cloud_disabled], key=lambda m: m.id) - def cloud_enabled_nodes(self) -> list[Morphism]: """All nodes that are enabled on Comfy Cloud.""" return sorted([m for m in self._nodes.values() if not m.cloud_disabled], key=lambda m: m.id) - def api_nodes(self) -> list[Morphism]: - """All partner API nodes.""" - return sorted([m for m in self._nodes.values() if m.is_api_node], key=lambda m: m.id) - - def output_nodes(self) -> list[Morphism]: - """All terminal output nodes (SaveImage, etc.).""" - return sorted([m for m in self._nodes.values() if m.is_output_node], key=lambda m: m.id) - def packs(self) -> list[str]: """All known pack names, sorted.""" return sorted(set(m.pack for m in self._nodes.values() if m.pack)) - def known_labels(self) -> list[str]: - """All known labels, sorted.""" - labels: set[str] = set() - for m in self._nodes.values(): - labels.update(m.labels) - return sorted(labels) - def find_paths( self, from_type: str, diff --git a/comfy_cli/cql/errors.py b/comfy_cli/cql/errors.py index fe58eb45..481bc7b1 100644 --- a/comfy_cli/cql/errors.py +++ b/comfy_cli/cql/errors.py @@ -24,6 +24,3 @@ def __post_init__(self): def __str__(self) -> str: # pragma: no cover - trivial return self.runtime_message - - def as_details(self) -> dict[str, Any]: - return {**self.details, "runtime_message": self.runtime_message} diff --git a/comfy_cli/env_checker.py b/comfy_cli/env_checker.py index d45ac252..8145e062 100644 --- a/comfy_cli/env_checker.py +++ b/comfy_cli/env_checker.py @@ -105,9 +105,6 @@ def __init__(self): self.python_version = sys.version_info self.check() - def is_isolated_env(self): - return self.virtualenv_path or self.conda_env - def get_isolated_env(self): if self.virtualenv_path: return self.virtualenv_path diff --git a/comfy_cli/standalone.py b/comfy_cli/standalone.py index 9c89bde5..7bfdc5d1 100644 --- a/comfy_cli/standalone.py +++ b/comfy_cli/standalone.py @@ -167,18 +167,6 @@ def pip_install(self, *args: str): def uv_install(self, *args: str): self.run_module("uv", "pip", "install", *args) - def install_comfy_cli(self, dev: bool = False): - if dev: - self.uv_install(str(_here.parent)) - else: - self.uv_install("comfy_cli") - - def run_comfy_cli(self, *args: str): - self.run_module("comfy_cli", *args) - - def install_comfy(self, *args: str, gpu_arg: str = "--nvidia"): - self.run_comfy_cli("--here", "--skip-prompt", "install", "--fast-deps", gpu_arg, *args) - def dehydrate_comfy_deps( self, comfyDir: PathLike, diff --git a/comfy_cli/ui.py b/comfy_cli/ui.py index 74087776..df71c7cd 100644 --- a/comfy_cli/ui.py +++ b/comfy_cli/ui.py @@ -38,26 +38,6 @@ def show_progress(iterable, total, description="Downloading..."): ChoiceType = str | Choice | dict[str, Any] -def prompt_autocomplete( - question: str, choices: list[ChoiceType], default: ChoiceType = "", force_prompting: bool = False -) -> ChoiceType | None: - """ - Asks a single select question using questionary and returns the selected response. - - Args: - question (str): The question to display to the user. - choices (List[ChoiceType]): A list of choices the user can autocomplete from. - default (ChoiceType): Default choice. - force_prompting (bool): Whether to force prompting even if skip_prompting is set. - - Returns: - Optional[ChoiceType]: The selected choice from the user, or None if skipping prompts. - """ - if workspace_manager.skip_prompting and not force_prompting: - return None - return questionary.autocomplete(question, choices=choices, default=default).ask() - - def prompt_select( question: str, choices: list[ChoiceType], default: ChoiceType = "", force_prompting: bool = False ) -> ChoiceType | None: diff --git a/comfy_cli/update.py b/comfy_cli/update.py index 4c8ec4db..aecea53b 100644 --- a/comfy_cli/update.py +++ b/comfy_cli/update.py @@ -4,7 +4,6 @@ import subprocess import sys import time -from importlib.metadata import metadata from pathlib import Path import requests @@ -40,11 +39,6 @@ def check_for_newer_pypi_version(package_name, current_version): return False, current_version -def get_version_from_pyproject(): - package_metadata = metadata("comfy-cli") - return package_metadata["Version"] - - def upgrade_cli(): """Upgrade the ``comfy-cli`` package itself via pip against the running interpreter. Raises ``CalledProcessError`` if pip fails — fail fast.""" diff --git a/comfy_cli/utils.py b/comfy_cli/utils.py index e5c582e2..e41d2120 100644 --- a/comfy_cli/utils.py +++ b/comfy_cli/utils.py @@ -5,7 +5,6 @@ import functools import platform import shutil -import subprocess import tarfile from contextlib import contextmanager from pathlib import Path @@ -13,16 +12,11 @@ import psutil import requests -import typer from rich import progress from rich.live import Live from rich.table import Table from comfy_cli.constants import DEFAULT_COMFY_WORKSPACE, OS, PROC - -# Use the output shim so prints go to stderr (not stdout) in JSON mode, -# preserving the one-envelope-on-stdout contract. -from comfy_cli.output import rprint as print # noqa: A001 - intentional shadowing from comfy_cli.typing import PathLike @@ -70,15 +64,6 @@ def get_proc(): raise ValueError -def install_conda_package(package_name): - try: - subprocess.check_call(["conda", "install", "-y", package_name]) - print(f"[bold green] Successfully installed {package_name} [/bold green]") - except subprocess.CalledProcessError as e: - print(f"[bold red] Failed to install {package_name}. Error: {e} [/bold red]") - raise typer.Exit(code=1) - - def get_not_user_set_default_workspace(): return DEFAULT_COMFY_WORKSPACE[get_os()]