mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-25 05:40:15 +08:00
use comfyui.custom_nodes as the plugin entrypoint and fix the protocol
This commit is contained in:
parent
e9365c4678
commit
3a56b15bc2
@ -15,7 +15,7 @@ except:
|
|||||||
custom_nodes = None
|
custom_nodes = None
|
||||||
from .package_typing import ExportedNodes
|
from .package_typing import ExportedNodes
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from pkg_resources import resource_filename
|
from pkg_resources import resource_filename, iter_entry_points
|
||||||
|
|
||||||
_comfy_nodes = ExportedNodes()
|
_comfy_nodes = ExportedNodes()
|
||||||
|
|
||||||
@ -85,10 +85,19 @@ def import_all_nodes_in_workspace() -> ExportedNodes:
|
|||||||
ExportedNodes())
|
ExportedNodes())
|
||||||
custom_nodes_mappings = ExportedNodes()
|
custom_nodes_mappings = ExportedNodes()
|
||||||
if custom_nodes is not None:
|
if custom_nodes is not None:
|
||||||
custom_nodes_mappings = _import_and_enumerate_nodes_in_module(custom_nodes, print_import_times=True)
|
custom_nodes_mappings.update(_import_and_enumerate_nodes_in_module(custom_nodes, print_import_times=True))
|
||||||
|
|
||||||
# don't allow custom nodes to overwrite base nodes
|
# load from entrypoints
|
||||||
custom_nodes_mappings -= base_and_extra
|
for entry_point in iter_entry_points(group='comfyui.custom_nodes'):
|
||||||
|
# Load the module associated with the current entry point
|
||||||
|
module = entry_point.load()
|
||||||
|
|
||||||
|
# Ensure that what we've loaded is indeed a module
|
||||||
|
if isinstance(module, types.ModuleType):
|
||||||
|
custom_nodes_mappings.update(
|
||||||
|
_import_and_enumerate_nodes_in_module(module, print_import_times=True))
|
||||||
|
# don't allow custom nodes to overwrite base nodes
|
||||||
|
custom_nodes_mappings -= base_and_extra
|
||||||
|
|
||||||
_comfy_nodes.update(base_and_extra + custom_nodes_mappings)
|
_comfy_nodes.update(base_and_extra + custom_nodes_mappings)
|
||||||
return _comfy_nodes
|
return _comfy_nodes
|
||||||
|
|||||||
@ -10,12 +10,12 @@ class CustomNode(Protocol):
|
|||||||
def INPUT_TYPES(cls) -> dict: ...
|
def INPUT_TYPES(cls) -> dict: ...
|
||||||
|
|
||||||
RETURN_TYPES: ClassVar[typing.Sequence[str]]
|
RETURN_TYPES: ClassVar[typing.Sequence[str]]
|
||||||
RETURN_NAMES: ClassVar[Tuple[str]] = None
|
RETURN_NAMES: typing.Optional[ClassVar[Tuple[str]]]
|
||||||
OUTPUT_IS_LIST: ClassVar[Tuple[bool]] = None
|
OUTPUT_IS_LIST: typing.Optional[ClassVar[typing.Sequence[bool]]]
|
||||||
INPUT_IS_LIST: ClassVar[bool] = None
|
INPUT_IS_LIST: typing.Optional[ClassVar[bool]]
|
||||||
FUNCTION: ClassVar[str]
|
FUNCTION: ClassVar[str]
|
||||||
CATEGORY: ClassVar[str]
|
CATEGORY: ClassVar[str]
|
||||||
OUTPUT_NODE: ClassVar[bool] = None
|
OUTPUT_NODE: typing.Optional[ClassVar[bool]]
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
1
setup.py
1
setup.py
@ -156,7 +156,6 @@ package_data = ['sd1_tokenizer/*', '**/*.json', '**/*.yaml']
|
|||||||
if not is_editable:
|
if not is_editable:
|
||||||
package_data.append('web/**/*')
|
package_data.append('web/**/*')
|
||||||
setup(
|
setup(
|
||||||
# "comfy"
|
|
||||||
name=package_name,
|
name=package_name,
|
||||||
description="",
|
description="",
|
||||||
author="",
|
author="",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user