From a9dbb15ffa4df90d00671dda3f0ba00161f09bcd Mon Sep 17 00:00:00 2001 From: Will Miao Date: Tue, 21 Jul 2026 18:44:04 +0800 Subject: [PATCH] fix(create_hook_lora): lazy import comfy.hooks/comfy.utils to fix CI pipeline (#744) --- py/nodes/create_hook_lora.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/py/nodes/create_hook_lora.py b/py/nodes/create_hook_lora.py index 5796b4d5..a5f44fb8 100644 --- a/py/nodes/create_hook_lora.py +++ b/py/nodes/create_hook_lora.py @@ -9,9 +9,6 @@ from __future__ import annotations import logging import os -import comfy.hooks # type: ignore -import comfy.utils # type: ignore - from ..utils.utils import get_lora_info_absolute from .utils import ( FlexibleOptionalInputType, @@ -59,6 +56,10 @@ class CreateHookLoraLM: """ del text # used by the frontend widget only + # Lazy imports: comfy is not available in CI/test environment at module level + import comfy.hooks # type: ignore # noqa: C0415 + import comfy.utils # type: ignore # noqa: C0415 + prev_hooks: comfy.hooks.HookGroup | None = kwargs.get("prev_hooks") hook_group = prev_hooks.clone() if prev_hooks is not None else comfy.hooks.HookGroup()