ComfyUI/comfy/comfy_types
bymyself 83df2a88bd
Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.10) (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
refactor: add prompt_id as hidden type, fix imports, add docstrings
- Add PROMPT_ID as a new hidden type in the Hidden enum, HiddenHolder,
  HiddenInputTypeDict, and execution engine resolution (both V3 and legacy)
- Refactor GetImageSize to use cls.hidden.prompt_id instead of manually
  calling get_executing_context() — addresses reviewer feedback
- Remove lazy import of get_executing_context from nodes_images.py
- Add docstrings to send_progress_text, _display_text, HiddenHolder,
  and HiddenHolder.from_dict

Amp-Thread-ID: https://ampcode.com/threads/T-019ca1cb-0150-7549-8b1b-6713060d3408
2026-02-27 17:21:14 -08:00
..
examples Fix custom node type-hinting examples (#6281) 2024-12-31 03:41:09 -05:00
__init__.py Add type hint for FileLocator (#6968) 2025-03-05 15:35:26 -05:00
node_typing.py refactor: add prompt_id as hidden type, fix imports, add docstrings 2026-02-27 17:21:14 -08:00
README.md Fix custom node type-hinting examples (#6281) 2024-12-31 03:41:09 -05: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.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