ComfyUI/comfy/comfy_types
imgbot[bot] 3a001d7878
[ImgBot] Optimize images (#1)
*Total -- 570.49kb -> 541.41kb (5.1%)

/comfy/comfy_types/examples/input_options.png -- 18.89kb -> 10.54kb (44.18%)
/comfy/comfy_types/examples/required_hint.png -- 18.83kb -> 11.26kb (40.21%)
/comfy/comfy_types/examples/input_types.png -- 16.42kb -> 10.20kb (37.86%)
/input/example.png -- 8.39kb -> 5.56kb (33.68%)
/web/assets/images/sad_girl.png -- 173.47kb -> 171.69kb (1.02%)
/web/assets/primeicons-Dr5RGzOO.svg -- 334.50kb -> 332.15kb (0.7%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2025-01-06 22:53:26 +11:00
..
2025-01-06 22:53:26 +11:00

Comfy Typing

Type hinting for ComfyUI Node development

This module provides type hinting and concrete convenience types for node developers. If cloned to the custom_nodes directory of ComfyUI, types can be imported using:

from comfy_types import IO, ComfyNodeABC, CheckLazyMixin

class ExampleNode(ComfyNodeABC):
    @classmethod
    def INPUT_TYPES(s) -> InputTypeDict:
        return {"required": {}}

Full example is in examples/example_nodes.py.

Types

A few primary types are documented below. More complete information is available via the docstrings on each type.

IO

A string enum of built-in and a few custom data types. Includes the following special types and their requisite plumbing:

  • ANY: "*"
  • NUMBER: "FLOAT,INT"
  • PRIMITIVE: "STRING,FLOAT,INT,BOOLEAN"

ComfyNodeABC

An abstract base class for nodes, offering type-hinting / autocomplete, and somewhat-alright docstrings.

Type hinting for INPUT_TYPES

INPUT_TYPES auto-completion in Visual Studio Code

INPUT_TYPES return dict

INPUT_TYPES return value type hinting in Visual Studio Code

Options for individual inputs

INPUT_TYPES return value option auto-completion in Visual Studio Code