Skip to content

Commit dcff27f

Browse files
authored
Add support for dev-only nodes. (Comfy-Org#12106)
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 0972596 commit dcff27f

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
@@ -1485,6 +1489,7 @@ def get_v1_info(self, cls) -> NodeInfoV1:
14851489
output_node=self.is_output_node,
14861490
deprecated=self.is_deprecated,
14871491
experimental=self.is_experimental,
1492+
dev_only=self.is_dev_only,
14881493
api_node=self.is_api_node,
14891494
python_module=getattr(cls, "RELATIVE_PYTHON_MODULE", "nodes"),
14901495
price_badge=self.price_badge.as_dict(self.inputs) if self.price_badge is not None else None,
@@ -1519,6 +1524,7 @@ def get_v3_info(self, cls) -> NodeInfoV3:
15191524
output_node=self.is_output_node,
15201525
deprecated=self.is_deprecated,
15211526
experimental=self.is_experimental,
1527+
dev_only=self.is_dev_only,
15221528
api_node=self.is_api_node,
15231529
python_module=getattr(cls, "RELATIVE_PYTHON_MODULE", "nodes"),
15241530
price_badge=self.price_badge.as_dict(self.inputs) if self.price_badge is not None else None,
@@ -1791,6 +1797,14 @@ def DEPRECATED(cls): # noqa
17911797
cls.GET_SCHEMA()
17921798
return cls._DEPRECATED
17931799

1800+
_DEV_ONLY = None
1801+
@final
1802+
@classproperty
1803+
def DEV_ONLY(cls): # noqa
1804+
if cls._DEV_ONLY is None:
1805+
cls.GET_SCHEMA()
1806+
return cls._DEV_ONLY
1807+
17941808
_API_NODE = None
17951809
@final
17961810
@classproperty
@@ -1893,6 +1907,8 @@ def GET_SCHEMA(cls) -> Schema:
18931907
cls._EXPERIMENTAL = schema.is_experimental
18941908
if cls._DEPRECATED is None:
18951909
cls._DEPRECATED = schema.is_deprecated
1910+
if cls._DEV_ONLY is None:
1911+
cls._DEV_ONLY = schema.is_dev_only
18961912
if cls._API_NODE is None:
18971913
cls._API_NODE = schema.is_api_node
18981914
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)