From eef7137ba2da9cac29cab23a7064d5897ae15a60 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Thu, 16 Jul 2026 22:31:18 -0700 Subject: [PATCH] refactor: remove 8 dead symbols + vestigial where.py re-export (BE-3268) Delete zero-reference symbols confirmed dead by full-repo grep (no decorators, no dynamic/string refs, no __all__ exports): - update.py: get_version_from_pyproject (+ orphaned metadata import) - utils.py: install_conda_package (+ orphaned subprocess/typer/print-shim imports) - auth/store.py: known_providers (+ orphaned Iterable import); callers use SUPPORTED_PROVIDERS directly - command/install.py: get_os_details - ui.py: prompt_autocomplete - command/generate/spec.py: active_spec_path (unused wrapper over _select_spec_path) - cmdline.py: validate_comfyui (undecorated; distinct from custom_nodes validate_comfyui_manager) - cloud/oauth.py: OAuthCancelled (never raised or caught) - where.py: vestigial get_token re-export line Also removes the coupled oauth_cancelled entry from error_codes.REGISTRY: the OAuthCancelled class attribute was the only source of that code, so deleting the class made it dead and the registry's own test_every_registered_code_is_raised requires it gone. --- comfy_cli/auth/store.py | 5 ----- comfy_cli/cloud/oauth.py | 4 ---- comfy_cli/cmdline.py | 6 ------ comfy_cli/command/generate/spec.py | 4 ---- comfy_cli/command/install.py | 6 ------ comfy_cli/error_codes.py | 5 ----- comfy_cli/ui.py | 20 -------------------- comfy_cli/update.py | 6 ------ comfy_cli/utils.py | 15 --------------- comfy_cli/where.py | 2 -- 10 files changed, 73 deletions(-) diff --git a/comfy_cli/auth/store.py b/comfy_cli/auth/store.py index d415c426..2ad71cea 100644 --- a/comfy_cli/auth/store.py +++ b/comfy_cli/auth/store.py @@ -17,7 +17,6 @@ import os import re import secrets -from collections.abc import Iterable from dataclasses import asdict, dataclass from datetime import datetime, timezone from pathlib import Path @@ -211,10 +210,6 @@ def remove(provider: str) -> bool: return True -def known_providers() -> Iterable[str]: - return SUPPORTED_PROVIDERS - - # --------------------------------------------------------------------------- # Cloud OAuth session # --------------------------------------------------------------------------- diff --git a/comfy_cli/cloud/oauth.py b/comfy_cli/cloud/oauth.py index f6459fa8..dfb52862 100644 --- a/comfy_cli/cloud/oauth.py +++ b/comfy_cli/cloud/oauth.py @@ -86,10 +86,6 @@ class OAuthRefreshError(OAuthError): code = "oauth_refresh_failed" -class OAuthCancelled(OAuthError): - code = "oauth_cancelled" - - class OAuthTimeout(OAuthError): code = "oauth_timeout" diff --git a/comfy_cli/cmdline.py b/comfy_cli/cmdline.py index 4662b788..a0204274 100644 --- a/comfy_cli/cmdline.py +++ b/comfy_cli/cmdline.py @@ -1103,12 +1103,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/command/generate/spec.py b/comfy_cli/command/generate/spec.py index f0052e37..e4061025 100644 --- a/comfy_cli/command/generate/spec.py +++ b/comfy_cli/command/generate/spec.py @@ -420,7 +420,3 @@ def write_cache(yaml_text: str) -> Path: load_raw_spec.cache_clear() _registry.cache_clear() return _USER_CACHE - - -def active_spec_path() -> Path: - return _select_spec_path() diff --git a/comfy_cli/command/install.py b/comfy_cli/command/install.py index ed5a0c27..fcc882c1 100755 --- a/comfy_cli/command/install.py +++ b/comfy_cli/command/install.py @@ -29,12 +29,6 @@ console = Console() -def get_os_details(): - os_name = platform.system() # e.g., Linux, Darwin (macOS), Windows - os_version = platform.release() - return os_name, os_version - - def _pip_install_torch(python: str, index_args: list[str]) -> subprocess.CompletedProcess: """Install torch, torchvision, and torchaudio with the given index arguments.""" return subprocess.run( diff --git a/comfy_cli/error_codes.py b/comfy_cli/error_codes.py index 4cba21d3..cabe5148 100644 --- a/comfy_cli/error_codes.py +++ b/comfy_cli/error_codes.py @@ -308,11 +308,6 @@ class ErrorCode: "OAuth token refresh failed.", "run `comfy cloud login` to sign in again", ), - ErrorCode( - "oauth_cancelled", - "OAuth flow was cancelled by the user.", - "re-run `comfy cloud login` to retry sign-in", - ), ErrorCode( "oauth_timeout", "Timed out waiting for browser callback during OAuth login.", 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()] diff --git a/comfy_cli/where.py b/comfy_cli/where.py index cb2c87d2..ce555b8c 100644 --- a/comfy_cli/where.py +++ b/comfy_cli/where.py @@ -24,8 +24,6 @@ from enum import Enum from typing import Any -from comfy_cli.cancellation import get_token # noqa: F401 — re-exported indirectly - class WhereTarget(str, Enum): LOCAL = "local"