Skip to content

Commit 01c610d

Browse files
committed
Add support for dev-only nodes.
When a node is declared as dev-only, it doesn't show in the default UI unless the dev mode is enabled in the settings. The intention is to allow nodes related to unit testing to be included in ComfyUI distributions without confusing the average user.
1 parent bc72d7f commit 01c610d

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

comfy/comfy_types/node_typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ class ComfyNodeABC(ABC):
236236
"""Flags a node as experimental, informing users that it may change or not work as expected."""
237237
DEPRECATED: bool
238238
"""Flags a node as deprecated, indicating to users that they should find alternatives to this node."""
239+
DEV_ONLY: bool
240+
"""Flags a node as dev-only, hiding it from search/menus unless dev mode is enabled."""
239241
API_NODE: Optional[bool]
240242
"""Flags a node as an API node. See: https://docs.comfy.org/tutorials/api-nodes/overview."""
241243

comfy_api/latest/_io.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,7 @@ class NodeInfoV1:
12471247
output_node: bool=None
12481248
deprecated: bool=None
12491249
experimental: bool=None
1250+
dev_only: bool=None
12501251
api_node: bool=None
12511252
price_badge: dict | None = None
12521253
search_aliases: list[str]=None
@@ -1264,6 +1265,7 @@ class NodeInfoV3:
12641265
output_node: bool=None
12651266
deprecated: bool=None
12661267
experimental: bool=None
1268+
dev_only: bool=None
12671269
api_node: bool=None
12681270
price_badge: dict | None = None
12691271

@@ -1375,6 +1377,8 @@ class Schema:
13751377
"""Flags a node as deprecated, indicating to users that they should find alternatives to this node."""
13761378
is_experimental: bool=False
13771379
"""Flags a node as experimental, informing users that it may change or not work as expected."""
1380+
is_dev_only: bool=False
1381+
"""Flags a node as dev-only, hiding it from search/menus unless dev mode is enabled."""
13781382
is_api_node: bool=False
13791383
"""Flags a node as an API node. See: https://docs.comfy.org/tutorials/api-nodes/overview."""
13801384
price_badge: PriceBadge | None = None
@@ -1483,6 +1487,7 @@ def get_v1_info(self, cls) -> NodeInfoV1:
14831487
output_node=self.is_output_node,
14841488
deprecated=self.is_deprecated,
14851489
experimental=self.is_experimental,
1490+
dev_only=self.is_dev_only,
14861491
api_node=self.is_api_node,
14871492
python_module=getattr(cls, "RELATIVE_PYTHON_MODULE", "nodes"),
14881493
price_badge=self.price_badge.as_dict(self.inputs) if self.price_badge is not None else None,
@@ -1517,6 +1522,7 @@ def get_v3_info(self, cls) -> NodeInfoV3:
15171522
output_node=self.is_output_node,
15181523
deprecated=self.is_deprecated,
15191524
experimental=self.is_experimental,
1525+
dev_only=self.is_dev_only,
15201526
api_node=self.is_api_node,
15211527
python_module=getattr(cls, "RELATIVE_PYTHON_MODULE", "nodes"),
15221528
price_badge=self.price_badge.as_dict(self.inputs) if self.price_badge is not None else None,
@@ -1789,6 +1795,14 @@ def DEPRECATED(cls): # noqa
17891795
cls.GET_SCHEMA()
17901796
return cls._DEPRECATED
17911797

1798+
_DEV_ONLY = None
1799+
@final
1800+
@classproperty
1801+
def DEV_ONLY(cls): # noqa
1802+
if cls._DEV_ONLY is None:
1803+
cls.GET_SCHEMA()
1804+
return cls._DEV_ONLY
1805+
17921806
_API_NODE = None
17931807
@final
17941808
@classproperty
@@ -1883,6 +1897,8 @@ def GET_SCHEMA(cls) -> Schema:
18831897
cls._EXPERIMENTAL = schema.is_experimental
18841898
if cls._DEPRECATED is None:
18851899
cls._DEPRECATED = schema.is_deprecated
1900+
if cls._DEV_ONLY is None:
1901+
cls._DEV_ONLY = schema.is_dev_only
18861902
if cls._API_NODE is None:
18871903
cls._API_NODE = schema.is_api_node
18881904
if cls._OUTPUT_NODE is None:

server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ def node_info(node_class):
679679
info['deprecated'] = True
680680
if getattr(obj_class, "EXPERIMENTAL", False):
681681
info['experimental'] = True
682+
if getattr(obj_class, "DEV_ONLY", False):
683+
info['dev_only'] = True
682684

683685
if hasattr(obj_class, 'API_NODE'):
684686
info['api_node'] = obj_class.API_NODE

0 commit comments

Comments
 (0)