Skip to content

Commit

Permalink
Remove types for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed Jan 3, 2025
1 parent 7c1ef08 commit c160786
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 0 additions & 4 deletions {{cookiecutter.project_slug}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ git push

An example custom node is located in [node.py](src/{{cookiecutter.project_slug}}/nodes.py). To learn more, read the [docs](https://docs.comfy.org/essentials/custom_node_overview).

## Type Hints
ComfyUI exposes types that are very helpful when developing custom nodes.

> 💡 **Hint:** To get the types in your modern IDE, you need to add your ComfyUI directory to the include paths. This repo has a [settings.json](.vscode/settings.json) with a template that you can use. Replace the ComfyUI path with your own.

## Tests

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from comfy.comfy_types import IO, ComfyNodeABC, InputTypeDict
from inspect import cleandoc
class Example(ComfyNodeABC):
class Example:
"""
A example node
Expand Down Expand Up @@ -33,7 +32,7 @@ def __init__(self):
pass

@classmethod
def INPUT_TYPES(s) -> InputTypeDict:
def INPUT_TYPES(s):
"""
Return a dictionary which contains config for all input fields.
Some types (string): "MODEL", "VAE", "CLIP", "CONDITIONING", "LATENT", "IMAGE", "INT", "STRING", "FLOAT".
Expand All @@ -50,30 +49,30 @@ def INPUT_TYPES(s) -> InputTypeDict:
"""
return {
"required": {
"image": (IO.IMAGE, { "tooltip": "This is an image"}),
"int_field": (IO.INT, {
"image": ("Image", { "tooltip": "This is an image"}),
"int_field": ("INT", {
"default": 0,
"min": 0, #Minimum value
"max": 4096, #Maximum value
"step": 64, #Slider's step
"display": "number" # Cosmetic only: display as "number" or "slider"
}),
"float_field": (IO.FLOAT, {
"float_field": ("FLOAT", {
"default": 1.0,
"min": 0.0,
"max": 10.0,
"step": 0.01,
"round": 0.001, #The value represeting the precision to round to, will be set to the step value by default. Can be set to False to disable rounding.
"display": "number"}),
"print_to_screen": (["enable", "disable"],),
"string_field": (IO.STRING, {
"string_field": ("STRING", {
"multiline": False, #True if you want the field to look like the one on the ClipTextEncode node
"default": "Hello World!"
}),
},
}

RETURN_TYPES = (IO.IMAGE,)
RETURN_TYPES = ("IMAGE",)
#RETURN_NAMES = ("image_output_name",)
DESCRIPTION = cleandoc(__doc__)
FUNCTION = "test"
Expand Down

0 comments on commit c160786

Please sign in to comment.