Skip to content

addon

Declare addon definition for ComfyUI.

This is not the actual addon itself. It just sets up some preamble with launch hooks.

There appears to be some expected interface that is shared between all hosts but, not documented at all.

ComfyUIAddon

Bases: AYONAddon, IHostAddon

Comfy UI Addon Definition.

Source code in client/ayon_comfyui/addon.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class ComfyUIAddon(AYONAddon, IHostAddon):
    """Comfy UI Addon Definition."""

    name = "comfyui"
    host_name = "comfyui"
    label = "ComfyUI"
    version = __version__

    def add_implementation_envs(self, env, _app):
        defaults = {
            "LOGLEVEL": "DEBUG",
            "AYON_LOG_NO_COLORS": "1",
        }
        for key, value in defaults.items():
            if not env.get(key):
                env[key] = value

    def get_workfile_extensions(self) -> list[str]:  # noqa:PLR6301
        """Returns associated paths."""
        return [".json"]

    def get_launch_hook_paths(self, app: IHostAddon) -> list[str]:
        """Returns paths to launch hooks."""
        if app.host_name != self.host_name:
            return []
        return [os.path.join(COMFYUI_ADDON_ROOT, "hooks")]

get_launch_hook_paths(app)

Returns paths to launch hooks.

Source code in client/ayon_comfyui/addon.py
40
41
42
43
44
def get_launch_hook_paths(self, app: IHostAddon) -> list[str]:
    """Returns paths to launch hooks."""
    if app.host_name != self.host_name:
        return []
    return [os.path.join(COMFYUI_ADDON_ROOT, "hooks")]

get_workfile_extensions()

Returns associated paths.

Source code in client/ayon_comfyui/addon.py
36
37
38
def get_workfile_extensions(self) -> list[str]:  # noqa:PLR6301
    """Returns associated paths."""
    return [".json"]

get_launch_script_path()

Returns script for launching logic implementation.

Source code in client/ayon_comfyui/addon.py
47
48
49
def get_launch_script_path() -> str:
    """Returns script for launching logic implementation."""
    return os.path.join(COMFYUI_ADDON_ROOT, "api", "launch_script.py")