techfreakworm commited on
Commit
5926879
·
unverified ·
1 Parent(s): 00ae1f7

docs(plan): correct ComfyUI import paths and pin runtime clone to submodule SHA

Browse files

- import execution / import nodes (top-level modules), not comfy.execution
- await nodes.init_extra_nodes() via asyncio.run (it's async in modern ComfyUI)
- use comfy.utils.set_progress_bar_global_hook() instead of direct global write
- COMFYUI_COMMIT defaults to the pinned SHA so Spaces matches local submodule

docs/superpowers/plans/2026-04-30-ltx23-aio-generator.md CHANGED
@@ -1913,12 +1913,18 @@ class ComfyUILibraryBackend:
1913
  sys.path.insert(0, str(self._comfy_dir))
1914
 
1915
  # Defer comfy imports until the path is set up.
1916
- import comfy.cli_args # noqa: F401 imports as side-effect register
1917
- import comfy.execution
1918
- import nodes # ComfyUI's node registration entrypoint
 
1919
 
1920
- nodes.init_extra_nodes() # discover custom_nodes/
1921
- self._executor = comfy.execution.PromptExecutor(server_instance=None)
 
 
 
 
 
1922
 
1923
  def __repr__(self) -> str:
1924
  return f"ComfyUILibraryBackend(comfy_dir={self._comfy_dir!r})"
@@ -1984,7 +1990,9 @@ class ComfyUILibraryBackend: # extending — shown in full above; appending met
1984
  import comfy.utils
1985
  saved_hook = getattr(comfy.utils, "PROGRESS_BAR_HOOK", None)
1986
  try:
1987
- comfy.utils.PROGRESS_BAR_HOOK = _hook
 
 
1988
  self._executor.execute(
1989
  workflow,
1990
  prompt_id="ltx23-aio",
@@ -2000,7 +2008,7 @@ class ComfyUILibraryBackend: # extending — shown in full above; appending met
2000
  _push(ErrorEvent(category=_classify(exc), message=str(exc),
2001
  traceback=tb_mod.format_exc()))
2002
  finally:
2003
- comfy.utils.PROGRESS_BAR_HOOK = saved_hook
2004
  _free_memory()
2005
  _push(None) # sentinel: stop the consumer
2006
 
@@ -2317,7 +2325,12 @@ def _on_spaces() -> bool:
2317
 
2318
 
2319
  COMFYUI_REPO = "https://github.com/comfyanonymous/ComfyUI.git"
2320
- COMFYUI_COMMIT = os.environ.get("LTX23_AIO_COMFYUI_COMMIT", "main")
 
 
 
 
 
2321
 
2322
  CUSTOM_NODES_PINNED: list[tuple[str, str]] = [
2323
  ("https://github.com/Lightricks/ComfyUI-LTXVideo.git", "main"),
 
1913
  sys.path.insert(0, str(self._comfy_dir))
1914
 
1915
  # Defer comfy imports until the path is set up.
1916
+ # NOTE: ComfyUI ships PromptExecutor in the top-level `execution.py`
1917
+ # module, NOT under `comfy.execution`. Same for `nodes`. Both must be
1918
+ # imported AFTER the sys.path insert above.
1919
+ import asyncio
1920
 
1921
+ import comfy.cli_args # noqa: F401 — side-effect: registers CLI flags
1922
+ import execution # top-level module — provides PromptExecutor
1923
+ import nodes # top-level module — provides init_extra_nodes (async)
1924
+
1925
+ # init_extra_nodes is an async function in modern ComfyUI; run it once.
1926
+ asyncio.run(nodes.init_extra_nodes()) # discover custom_nodes/
1927
+ self._executor = execution.PromptExecutor(server_instance=None)
1928
 
1929
  def __repr__(self) -> str:
1930
  return f"ComfyUILibraryBackend(comfy_dir={self._comfy_dir!r})"
 
1990
  import comfy.utils
1991
  saved_hook = getattr(comfy.utils, "PROGRESS_BAR_HOOK", None)
1992
  try:
1993
+ # Use the public setter; it writes the same global the
1994
+ # ProgressBar class reads, but is the documented API.
1995
+ comfy.utils.set_progress_bar_global_hook(_hook)
1996
  self._executor.execute(
1997
  workflow,
1998
  prompt_id="ltx23-aio",
 
2008
  _push(ErrorEvent(category=_classify(exc), message=str(exc),
2009
  traceback=tb_mod.format_exc()))
2010
  finally:
2011
+ comfy.utils.set_progress_bar_global_hook(saved_hook)
2012
  _free_memory()
2013
  _push(None) # sentinel: stop the consumer
2014
 
 
2325
 
2326
 
2327
  COMFYUI_REPO = "https://github.com/comfyanonymous/ComfyUI.git"
2328
+ # Pinned to the same commit the local git submodule uses (set in Task 5).
2329
+ # Override via env var only when intentionally testing a different ComfyUI version.
2330
+ COMFYUI_COMMIT = os.environ.get(
2331
+ "LTX23_AIO_COMFYUI_COMMIT",
2332
+ "eb0686bbb60c83e44c3a3e4f7defd0f589cfef10",
2333
+ )
2334
 
2335
  CUSTOM_NODES_PINNED: list[tuple[str, str]] = [
2336
  ("https://github.com/Lightricks/ComfyUI-LTXVideo.git", "main"),