Skip to content
Merged
Show file tree
Hide file tree
Changes from 232 commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
4480ed4
Initial prototyping on v3 classes
Kosinkadink May 26, 2025
880f756
More progress on V3 definition
Kosinkadink May 27, 2025
96c2e38
Add V3-to-V1 compatibility on early V3 node definition and node_info …
Kosinkadink May 29, 2025
5f0e04e
Temporarily adding nodes_v3_test.py file to comfy_extras for testing/…
Kosinkadink May 29, 2025
0400497
Merge branch 'master' into v3-definition
Kosinkadink May 30, 2025
937d2d5
Fixed 'display' serialization for Float/IntergerInput, some commented…
Kosinkadink May 31, 2025
8b331c5
Made proper None checks in V1 translation class properties for ComfyN…
Kosinkadink May 31, 2025
de86d8e
Attempting to simplify node list definition in a python file via NODE…
Kosinkadink May 31, 2025
8642757
Made V3 NODES_LIST work properly
Kosinkadink May 31, 2025
0d185b7
Created and handled NodeOutput class to be the return value of v3 nod…
Kosinkadink Jun 1, 2025
5060385
Merge branch 'master' into v3-definition
Kosinkadink Jun 1, 2025
f46dc03
Add some missing options to ComboInput
Kosinkadink Jun 3, 2025
94e6119
Merge branch 'master' into v3-definition
Kosinkadink Jun 3, 2025
50da98b
Merge branch 'master' into v3-definition
Kosinkadink Jun 4, 2025
1fb1bad
Some node changes to compare v1 and v3
Kosinkadink Jun 5, 2025
a7f515e
Fixed missing self
Kosinkadink Jun 5, 2025
d79a3cf
Changed execute instance method to EXECUTE class method, added counte…
Kosinkadink Jun 5, 2025
2197b6c
Renamed 'EXECUTE' class method to 'execute'
Kosinkadink Jun 5, 2025
70d2bbf
Try out adding Type class var to IO_V3 to help with type hints
Kosinkadink Jun 10, 2025
2873aaf
Replaced 'behavior' with 'optional'; unlikely there will be anything …
Kosinkadink Jun 10, 2025
6854864
Added some missing type defs, starting work on a revision (v3_01) to …
Kosinkadink Jun 12, 2025
cf7312d
Small refactoring to make iterating on V3 schema faster without needi…
Kosinkadink Jun 13, 2025
54e0d6b
Add comfytype decorator, convert all relevant v3_01 types to follow n…
Kosinkadink Jun 13, 2025
ef04c46
Progress on state management mocking and hidden values in v3
Kosinkadink Jun 17, 2025
1711e44
Added new Custom and ComfyTypeIO helpers, use ComfyTypeIO class to si…
Kosinkadink Jun 17, 2025
1ef0693
Merge branch 'master' into v3-definition
Kosinkadink Jun 17, 2025
38721fd
Added hidden and state to passed-in clone of node class
Kosinkadink Jun 18, 2025
f9aec12
Refactored v3 code so that v3_01 becomes v3, v3_01 is deleted since n…
Kosinkadink Jun 19, 2025
11d8776
Renamed Hidden->HiddenHolder, HiddenEnum->Hidden for ease of usage, c…
Kosinkadink Jun 19, 2025
ef3f458
Added multitype support for Widget Inputs via the types argument, Mul…
Kosinkadink Jun 19, 2025
fe9a47a
Added V3 LoRA Loader node for test purposes, made NodeStateLocal more…
Kosinkadink Jun 19, 2025
002e16a
Added 'not_idempotent' support for SchemaV3
Kosinkadink Jun 19, 2025
aac91ca
Added extra_dict to InputV3/WidgetInputV3 for custom node/widget expa…
Kosinkadink Jun 19, 2025
b52154f
Added initial schema validation
Kosinkadink Jun 19, 2025
6cf5db5
Small refactor of V3TestNode
Kosinkadink Jun 19, 2025
6d64658
Added get_value and set_value to NodeState, small cleanup
Kosinkadink Jun 26, 2025
6ef4ad2
Merge branch 'master' into v3-definition-wip
Kosinkadink Jun 26, 2025
aefd845
Multitype refactor progress
Kosinkadink Jun 26, 2025
86de88f
Merge branch 'master' into v3-definition
Kosinkadink Jun 27, 2025
5330904
Merge branch 'master' into v3-definition-wip
Kosinkadink Jun 27, 2025
fce43e1
Merge pull request #8706 from comfyanonymous/v3-definition-wip
Kosinkadink Jun 27, 2025
cef73c7
Fix recognizing ComfyNodeV3 class by using issubclass, removed overri…
Kosinkadink Jun 27, 2025
ba857bd
Added simple Type defs to ComfyTypes in io.py
Kosinkadink Jun 27, 2025
d0c0774
Defined TypedDict hints for Latent, Conditioning, and Audio types
Kosinkadink Jun 27, 2025
0122bc4
Added missing type definitions to v3 (present in core code)
Kosinkadink Jun 28, 2025
f4ece67
Replaced io_type with direct strings instead of using node_typing.py'…
Kosinkadink Jun 28, 2025
1ae7e7a
Updated some Conditioning docstrings
Kosinkadink Jun 28, 2025
1ad8a72
Merge pull request #8718 from comfyanonymous/v3-definition-wip
Kosinkadink Jun 28, 2025
2999212
Moved ui preview-related classes out of io.py and into ui.py, refacto…
Kosinkadink Jun 28, 2025
0e7ff98
Introduced Resources to ComfyNodeV3
Kosinkadink Jun 28, 2025
3758c65
Extracted resources to separate file
Kosinkadink Jun 28, 2025
aff5271
Merge pull request #8724 from comfyanonymous/v3-definition-wip
Kosinkadink Jun 28, 2025
18a7207
Mock AutogrowDynamic type
Kosinkadink Jul 4, 2025
a86fddc
Fixed MultiCombo, confirmed VALIDATE_INPUTS, IS_CHANGED works
Kosinkadink Jul 9, 2025
936bf6b
Add metadata to image previews, add a finalize function on SchemaV3 t…
Kosinkadink Jul 9, 2025
82e6eea
Support validate_inputs for v3 replacing VALIDATE_INPUTS, support che…
Kosinkadink Jul 9, 2025
56ccfea
Add fingerprint_inputs support (V3's IS_CHANGED)
Kosinkadink Jul 9, 2025
904dc06
Add force_input support to certain WidgetInputV3 inputs
Kosinkadink Jul 9, 2025
cc68880
Moved force_input arg to be before extra_dict to fix
Kosinkadink Jul 9, 2025
2b9ff52
Merge pull request #8846 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 9, 2025
3aa2d19
Merge branch 'master' into v3-definition
Kosinkadink Jul 9, 2025
5f91e29
Merge branch 'v3-definition' of https://github.com/comfyanonymous/Com…
Kosinkadink Jul 9, 2025
36770c1
migrate load and save images nodes to v3 schema (rebased)
bigcat88 Jul 8, 2025
1eb1a44
migrate PreviewImage node to V3
bigcat88 Jul 8, 2025
fefb24c
fixes, corrections; ported MaskPreview, WebcamCapture and LoadImageOu…
bigcat88 Jul 9, 2025
8f0621c
IS_CHANGED->fingerprint_inputs , VALIDATE_INPUTS->validate_inputs
bigcat88 Jul 9, 2025
982f4d6
removed "prepare_class_clone" modification
bigcat88 Jul 10, 2025
e197556
removed widgetType from serialization
bigcat88 Jul 10, 2025
a6bcb18
Fixed missing comma in init_builtin_extra_nodes after merge
Kosinkadink Jul 10, 2025
7521ff7
Merge pull request #8850 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 10, 2025
965d2f9
use options key, remove get_io_type_V1 serialization
bigcat88 Jul 10, 2025
d8b91bb
put V1 nodes back
bigcat88 Jul 10, 2025
19bb231
Merge pull request #8833 from bigcat88/v3-load-save-nodes-replacement
Kosinkadink Jul 10, 2025
2b5bd2a
Set widgetType only when doing MultiType
Kosinkadink Jul 10, 2025
fe2cade
Remove input display_names on nodes where the inputs already have the…
Kosinkadink Jul 10, 2025
5423a4f
Made id on static Outputs optional, still required on DynamicOutput
Kosinkadink Jul 10, 2025
5ee63e2
Renamed 'node' to 'cls' in PreviewImage/Mask
Kosinkadink Jul 10, 2025
f51ebfb
V3 nodes: stable cascade
bigcat88 Jul 11, 2025
a7e9956
Merge pull request #8872 from bigcat88/v3-stable-sascade-nodes
Kosinkadink Jul 11, 2025
eabd053
Revert "V3 nodes: stable cascade" (#8873)
comfyanonymous Jul 11, 2025
21c9d7b
V3 controlnet nodes: ControlNetApply, SetUnionControlNetType, Control…
bigcat88 Jul 11, 2025
af781cb
Reapply "V3 nodes: stable cascade" (#8873)
bigcat88 Jul 11, 2025
926a2b1
Merge pull request #8879 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 11, 2025
0be2ab6
Merge remote-tracking branch 'origin/v3-definition' into v3-definition
bigcat88 Jul 12, 2025
c09213e
V3 StableCascade nodes: use io.NodeOutput; adjust code style
bigcat88 Jul 12, 2025
535faa8
V3 ControlNet nodes: use io.NodeOutput; adjust code style
bigcat88 Jul 12, 2025
1e36e7f
V3 Nodes: make generic upload parameters for io.Combo.Input
bigcat88 Jul 12, 2025
8f7e273
Merge pull request #8883 from bigcat88/v3/io/uploadtype
Kosinkadink Jul 14, 2025
139025f
Create ComfyTypeI that only has as an input, improved hints on Boolea…
Kosinkadink Jul 14, 2025
f74f410
Merge pull request #8876 from bigcat88/v3/nodes_controlnet
Kosinkadink Jul 14, 2025
fad1b90
Merge pull request #8877 from bigcat88/v3/nodes/stable-cascade
Kosinkadink Jul 14, 2025
c9e0368
Changed how a node class is cloned and locked for execution, added EX…
Kosinkadink Jul 14, 2025
039a64b
Merge branch 'v3-definition' into v3-definition-wip
Kosinkadink Jul 14, 2025
a19ca62
Renamed prepare_class_clone to PREPARE_CLASS_CLONE
Kosinkadink Jul 14, 2025
371e204
Merge pull request #8900 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 14, 2025
a580176
V3 Nodes: refactor ComfyNodeV3 class; use of ui.SavedResult; ported S…
bigcat88 Jul 14, 2025
79098e9
V3 Nodes: refactor check for fingerprint_inputs and check_lazy_status
bigcat88 Jul 14, 2025
4294dfc
Merge pull request #8905 from bigcat88/v3/nodes/save-animated-wemp-png
Kosinkadink Jul 14, 2025
ac05d9a
V3 Nodes: LoadAudio and PreviewAudio
bigcat88 Jul 13, 2025
b17cc99
V3 Nodes: Load,Save,Vae audio nodes; sort imports; ruff
bigcat88 Jul 15, 2025
f687f8a
Merge pull request #8891 from bigcat88/v3/nodes/audio
Kosinkadink Jul 15, 2025
c196dd5
V3: primitive nodes; additional ruff rules for V3 nodes
bigcat88 Jul 15, 2025
8d9e4c7
Merge pull request #8919 from bigcat88/v3/nodes/primitive
Kosinkadink Jul 15, 2025
d99f778
Added ComfyNodeInternal to comfy_api.internal that will contain class…
Kosinkadink Jul 15, 2025
59e2d47
Merge branch 'v3-definition' into v3-definition-wip
Kosinkadink Jul 15, 2025
119f5a8
V3: images nodes
bigcat88 Jul 16, 2025
d673706
Merge pull request #8923 from bigcat88/v3/nodes/nodes_images
Kosinkadink Jul 16, 2025
4263d6f
Add dynamicPrompts to String.Input
Kosinkadink Jul 16, 2025
751c57c
Merge branch 'v3-definition' into v3-definition-wip
Kosinkadink Jul 16, 2025
8beead7
Merge pull request #8927 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 16, 2025
c3334ae
V3: renamed DEFINE_SCHEMA to define_schema
bigcat88 Jul 16, 2025
106bc9b
V3: PreviewAny node
bigcat88 Jul 16, 2025
d703ba9
V3: AceStepAudio nodes
bigcat88 Jul 16, 2025
205611c
Merge pull request #8929 from bigcat88/v3/nodes/preview-any
Kosinkadink Jul 16, 2025
5c94199
V3: Mask nodes
bigcat88 Jul 16, 2025
a8f1981
Merge pull request #8933 from bigcat88/v3/nodes/mask-nodes
Kosinkadink Jul 16, 2025
326a259
V3: 4 more converted files (starting with A)
bigcat88 Jul 17, 2025
3aceeab
Merge pull request #8943 from bigcat88/v3/nodes/nodes_a
Kosinkadink Jul 17, 2025
b99e3d1
Removed V1/V3 from as_dict and get_io_type functions on Inputs/Output…
Kosinkadink Jul 17, 2025
ab98b65
Separate ComfyNodeV3 into an internal base class and one that only ha…
Kosinkadink Jul 17, 2025
f8b7170
Merge pull request #8951 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 17, 2025
95289b3
Moved helper functions into internal.__init__.py instead of in io.hel…
Kosinkadink Jul 18, 2025
e431868
Satisfy ruff
Kosinkadink Jul 18, 2025
bf12dcc
Reference is_class from internal in execution.py
Kosinkadink Jul 18, 2025
bc6b011
Merge pull request #8952 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 18, 2025
9eda706
V3: 7 more nodes
bigcat88 Jul 18, 2025
18ed598
converted extra nodes files starting with "f,g"
bigcat88 Jul 18, 2025
2a77933
converted ImageRebatch, LatentRebatch, DifferentialDiffusion
bigcat88 Jul 18, 2025
de0901b
Merge pull request #8953 from bigcat88/v3/nodes/c-part1
Kosinkadink Jul 18, 2025
fd9c34a
Merge branch 'master' into v3-definition - async v3 nodes do not curr…
Kosinkadink Jul 18, 2025
780c3ea
ComfyAPI Core v0.0.2
guill Jul 16, 2025
b6a4a4c
Support async for v3's execute function, still need to test validate_…
Kosinkadink Jul 18, 2025
36e8277
v3: converted nodes_video
bigcat88 Jul 19, 2025
9e37b54
v3: converted nodes_wan.py
bigcat88 Jul 19, 2025
edc8f06
v3: small nodes(pag, perpneg, morph, optimsteps)
bigcat88 Jul 19, 2025
638096f
v3: converted nodes_latent.py
bigcat88 Jul 19, 2025
b196fb9
v3: converted nodes_lt.py
bigcat88 Jul 19, 2025
1de63e8
Merge pull request #8966 from bigcat88/v3/nodes/some-small-nodes
Kosinkadink Jul 20, 2025
87e72fc
Merge pull request #8968 from bigcat88/v3/nodes/latent-and-lt
Kosinkadink Jul 20, 2025
96d317b
Add is_experimental to v3 test sleep node
Kosinkadink Jul 20, 2025
a7c59dc
Removed state from ComfyNodeV3
Kosinkadink Jul 20, 2025
517be3d
Merge pull request #8972 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 20, 2025
f15c63c
removed `id` from outputs
bigcat88 Jul 20, 2025
45363ad
v3: removed "id" from Output nodes
bigcat88 Jul 20, 2025
aae6088
v3: refactoring of image saving code
bigcat88 Jul 20, 2025
5afcca1
Merge pull request #8974 from bigcat88/v3/nodes/refactor-image-save
Kosinkadink Jul 22, 2025
6a77eb1
Merge pull request #8964 from bigcat88/v3/nodes/video-save
Kosinkadink Jul 22, 2025
cf4ba27
Respond to PR feedback
guill Jul 22, 2025
d673124
Fix Python 3.9 errors
guill Jul 22, 2025
8c03ff0
Fixed super() calls not working from within v3's execute function due…
Kosinkadink Jul 22, 2025
27734d9
Merge pull request #9010 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 22, 2025
4a461b6
Fix missing backward compatibility proxy
guill Jul 23, 2025
7f8c51e
v3 nodes: sd3, selfattent, s4_4xupscale, skiplayer
bigcat88 Jul 21, 2025
54bf034
use fixed super(), remove use of TorchDictFolderFilename
bigcat88 Jul 23, 2025
941dea9
Merge pull request #8986 from bigcat88/v3/nodes/nodes-part1-s-letter
Kosinkadink Jul 23, 2025
333d942
refactored Preview/Save of images
bigcat88 Jul 23, 2025
bed60d6
refactored Preview/Save of audios
bigcat88 Jul 23, 2025
9208b4a
converted to V3 schema
bigcat88 Jul 23, 2025
e374ee1
Merge pull request #9016 from bigcat88/v3/preview-refactor
Kosinkadink Jul 23, 2025
ce1d30e
Merge pull request #9019 from bigcat88/v3/nodes/extras-8-files
Kosinkadink Jul 23, 2025
b561dfe
Removed NumberDisplay.color, as it does not exist in the frontend
Kosinkadink Jul 23, 2025
c6dcf7a
Merge pull request #9025 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 23, 2025
a9f5554
Remove unnecessary **kwargs in io.py
Kosinkadink Jul 23, 2025
b0f7317
Renamed SchemaV3 to Schema
Kosinkadink Jul 23, 2025
d984cee
Renamed ComfyNodeV3 to ComfyNode, renamed ComfyNodeInternal to _Comfy…
Kosinkadink Jul 23, 2025
6adaf6c
Renamed ComfyType to _ComfyType
Kosinkadink Jul 23, 2025
ddb84a3
Renamed IO_V3 to _IO_V3
Kosinkadink Jul 23, 2025
32c46c0
Merge pull request #9028 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 23, 2025
2e6ed6a
Added enable_expand toggle on Schema and corresponding enforcement in…
Kosinkadink Jul 23, 2025
f672515
Merge pull request #9030 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 23, 2025
e5cac06
Merge branch 'master' into v3-definition
Kosinkadink Jul 23, 2025
7ef18d5
Remove leftover v3 state code in execution.py
Kosinkadink Jul 24, 2025
7d71072
Begin porting io, ui, and resources to be compatible with versioned C…
Kosinkadink Jul 24, 2025
991de5f
converted nodes files starting with "l" letter
bigcat88 Jul 24, 2025
b4d9a27
converted nodes files starting with "h" letter
bigcat88 Jul 24, 2025
487ec28
converted last nodes for "u" and "v" letters
bigcat88 Jul 24, 2025
2ea2bc2
converted nodes files starting with "t" letter
bigcat88 Jul 24, 2025
66cd515
apply changes from https://github.com/comfyanonymous/ComfyUI/pull/9015
bigcat88 Jul 24, 2025
9300301
Merge branch 'master' into v3-definition
Kosinkadink Jul 24, 2025
f569823
pass "id" in Schema inputs as an arg instead of kwarg
bigcat88 Jul 24, 2025
c3d9243
adjusted input parameters of ui.PreviewUI3D
bigcat88 Jul 24, 2025
b2e564c
Merge pull request #9034 from bigcat88/v3/nodes/h-l-letters
Kosinkadink Jul 24, 2025
3a8286b
Refactored io.py, ui.py, and resources.py to expose themselves on v3/…
Kosinkadink Jul 24, 2025
9bd3faa
Merge branch 'v3-definition' into v3-definition-wip
Kosinkadink Jul 24, 2025
dacd0e9
Complete merge - needed to expose some of the new classes in _io.py's…
Kosinkadink Jul 24, 2025
56aae3e
Remove v3_01, didnt meant to commit that
Kosinkadink Jul 24, 2025
d3a62a4
Renamed InputV3, WidgetInputV3, OutputV3 to Input, WidgetInput, and O…
Kosinkadink Jul 24, 2025
44afeab
Abstracted out NodeOutput into _NodeOutputInternal in execution.py
Kosinkadink Jul 24, 2025
9d44cbf
Removed dynamic type mocks from v3 definition, since were only used a…
Kosinkadink Jul 25, 2025
a998a3c
Prepare a mock ComboDynamic scaffolding for future
Kosinkadink Jul 25, 2025
ed95d60
Merge pull request #9036 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 25, 2025
c52b5dc
Merge branch 'js/core-api-framework' into v3-definition-wip
Kosinkadink Jul 25, 2025
9b5a44c
Moved comfy_api.v3 stuff onto comfy_api.latest
Kosinkadink Jul 25, 2025
00c4679
Satisfy ruff by sorting imports
Kosinkadink Jul 25, 2025
631916d
Merge pull request #9037 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 25, 2025
a4253f4
Fixed some docstrings
Kosinkadink Jul 25, 2025
5a8c426
converted 6 more files
bigcat88 Jul 25, 2025
4c83303
sync changes from #8989
bigcat88 Jul 25, 2025
40abe96
converted nodes_custom_sampler.py
bigcat88 Jul 25, 2025
675e9fd
restore nodes order as it in the V1 version for smaller git diff
bigcat88 Jul 25, 2025
918ca7f
restore nodes order as it in the V1 version for smaller git diff (1)
bigcat88 Jul 25, 2025
e55b540
restore nodes order as it in the V1 version for smaller git diff (2)
bigcat88 Jul 25, 2025
de54491
restore nodes order as it in the V1 version for smaller git diff (3)
bigcat88 Jul 25, 2025
31b1bc2
restore nodes order as it in the V1 version for smaller git diff (4)
bigcat88 Jul 25, 2025
b007125
Merge pull request #9050 from bigcat88/v3/nodes/last-extra-nodes
Kosinkadink Jul 25, 2025
b45a110
Reorganize types a bit
guill Jul 25, 2025
689db36
Remove the need for `--generate-api-stubs`
guill Jul 25, 2025
b6754d9
Fix generated stubs differing by Python version
guill Jul 26, 2025
2f0cc45
Fix ruff formatting issues
guill Jul 26, 2025
320f4be
Merge branch 'v3-definition' into v3-definition-wip
Kosinkadink Jul 26, 2025
1415219
Make io, ui, and resources available in comfy_api.v0_0_2
Kosinkadink Jul 26, 2025
b365fb4
Revert accidentally merged change to nodes_v3_test.py
Kosinkadink Jul 26, 2025
b341c96
Merge PR #9068 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 26, 2025
9a3d02e
Merge branch 'js/core-api-framework' into v3-definition
Kosinkadink Jul 26, 2025
930f8d9
Merge branch 'master' into v3-definition
Kosinkadink Jul 29, 2025
e9a9762
Create a `ComfyExtension` class for future growth
guill Jul 29, 2025
0247b7b
Merge branch 'master' into v3-definition
Kosinkadink Jul 30, 2025
9177cfd
Removed v3 extras nodes - will live in v3-nodes branch until needed
Kosinkadink Jul 30, 2025
82fd2c8
Merge pull request #9118 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 30, 2025
bd367c8
Removed v3 resources - needs more time to cook
Kosinkadink Jul 30, 2025
2aa853d
Satisfy ruff
Kosinkadink Jul 30, 2025
fafe53e
Merge pull request #9119 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 30, 2025
babd7bb
Adding TYPE_CHECKING ifs into _io.py to try to clean up failing CI
Kosinkadink Jul 30, 2025
ccfa2a8
Moved ExecutionBlocker to graph_utils.py, maintained backwards compat…
Kosinkadink Jul 30, 2025
6405730
Merge pull request #9120 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 30, 2025
1d72917
Merge branch 'v3-definition' into js/extension-api-example
Kosinkadink Jul 31, 2025
7a522e4
Merge pull request #9103 from guill/js/extension-api-example
Kosinkadink Jul 31, 2025
f90beb7
Fix ComfyExtension registration not working
Kosinkadink Jul 31, 2025
006a898
Removed nodes_v1_test.py, removed both v1/v3 test nodes from being at…
Kosinkadink Jul 31, 2025
22cbb96
Merge pull request #9124 from comfyanonymous/v3-definition-wip
Kosinkadink Jul 31, 2025
040e062
Removed nodes_v3_test.py
Kosinkadink Jul 31, 2025
65fcf9a
Remove pyproject.toml changes - should be done in separate PR
Kosinkadink Jul 31, 2025
698c80b
Remove commented out UILatents class, will be added back in later whe…
Kosinkadink Jul 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions comfy_api/internal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,146 @@
register_versions as register_versions,
get_all_versions as get_all_versions,
)

import asyncio
from dataclasses import asdict
from typing import Callable, Optional


def first_real_override(cls: type, name: str, *, base: type=None) -> Optional[Callable]:
"""Return the *callable* override of `name` visible on `cls`, or None if every
implementation up to (and including) `base` is the placeholder defined on `base`.

If base is not provided, it will assume cls has a GET_BASE_CLASS
"""
if base is None:
if not hasattr(cls, "GET_BASE_CLASS"):
raise ValueError("base is required if cls does not have a GET_BASE_CLASS; is this a valid ComfyNode subclass?")
base = cls.GET_BASE_CLASS()
base_attr = getattr(base, name, None)
if base_attr is None:
return None
base_func = base_attr.__func__
for c in cls.mro(): # NodeB, NodeA, ComfyNode, object …
if c is base: # reached the placeholder – we're done
break
if name in c.__dict__: # first class that *defines* the attr
func = getattr(c, name).__func__
if func is not base_func: # real override
return getattr(cls, name) # bound to *cls*
return None


class _ComfyNodeInternal:
"""Class that all V3-based APIs inherit from for ComfyNode.

This is intended to only be referenced within execution.py, as it has to handle all V3 APIs going forward."""
@classmethod
def GET_NODE_INFO_V1(cls):
...


class _NodeOutputInternal:
"""Class that all V3-based APIs inherit from for NodeOutput.

This is intended to only be referenced within execution.py, as it has to handle all V3 APIs going forward."""
...


def as_pruned_dict(dataclass_obj):
'''Return dict of dataclass object with pruned None values.'''
return prune_dict(asdict(dataclass_obj))

def prune_dict(d: dict):
return {k: v for k,v in d.items() if v is not None}


def is_class(obj):
'''
Returns True if is a class type.
Returns False if is a class instance.
'''
return isinstance(obj, type)


def copy_class(cls: type) -> type:
'''
Copy a class and its attributes.
'''
if cls is None:
return None
cls_dict = {
k: v for k, v in cls.__dict__.items()
if k not in ('__dict__', '__weakref__', '__module__', '__doc__')
}
# new class
new_cls = type(
cls.__name__,
(cls,),
cls_dict
)
# metadata preservation
new_cls.__module__ = cls.__module__
new_cls.__doc__ = cls.__doc__
return new_cls


class classproperty(object):
def __init__(self, f):
self.f = f
def __get__(self, obj, owner):
return self.f(owner)


# NOTE: this was ai generated and validated by hand
def shallow_clone_class(cls, new_name=None):
'''
Shallow clone a class while preserving super() functionality.
'''
new_name = new_name or f"{cls.__name__}Clone"
# Include the original class in the bases to maintain proper inheritance
new_bases = (cls,) + cls.__bases__
return type(new_name, new_bases, dict(cls.__dict__))

# NOTE: this was ai generated and validated by hand
def lock_class(cls):
'''
Lock a class so that its top-levelattributes cannot be modified.
'''
# Locked instance __setattr__
def locked_instance_setattr(self, name, value):
raise AttributeError(
f"Cannot set attribute '{name}' on immutable instance of {type(self).__name__}"
)
# Locked metaclass
class LockedMeta(type(cls)):
def __setattr__(cls_, name, value):
raise AttributeError(
f"Cannot modify class attribute '{name}' on locked class '{cls_.__name__}'"
)
# Rebuild class with locked behavior
locked_dict = dict(cls.__dict__)
locked_dict['__setattr__'] = locked_instance_setattr

return LockedMeta(cls.__name__, cls.__bases__, locked_dict)


def make_locked_method_func(type_obj, func, class_clone):
"""
Returns a function that, when called with **inputs, will execute:
getattr(type_obj, func).__func__(lock_class(class_clone), **inputs)

Supports both synchronous and asynchronous methods.
"""
locked_class = lock_class(class_clone)
method = getattr(type_obj, func).__func__

# Check if the original method is async
if asyncio.iscoroutinefunction(method):
async def wrapped_async_func(**inputs):
return await method(locked_class, **inputs)
return wrapped_async_func
else:
def wrapped_func(**inputs):
return method(locked_class, **inputs)
return wrapped_func
18 changes: 18 additions & 0 deletions comfy_api/latest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import Type, TYPE_CHECKING
from comfy_api.internal import ComfyAPIBase
from comfy_api.internal.singleton import ProxiedSingleton
from comfy_api.internal.async_to_sync import create_sync_class
from comfy_api.latest._input import ImageInput, AudioInput, MaskInput, LatentInput, VideoInput
from comfy_api.latest._input_impl import VideoFromFile, VideoFromComponents
from comfy_api.latest._util import VideoCodec, VideoContainer, VideoComponents
from comfy_api.latest._io import _IO as io #noqa: F401
from comfy_api.latest._ui import _UI as ui #noqa: F401
# from comfy_api.latest._resources import _RESOURCES as resources #noqa: F401
from comfy_execution.utils import get_executing_context
from comfy_execution.progress import get_progress_state, PreviewImageTuple
from PIL import Image
Expand Down Expand Up @@ -72,6 +76,19 @@ async def set_progress(

execution: Execution

class ComfyExtension(ABC):
async def on_load(self) -> None:
"""
Called when an extension is loaded.
This should be used to initialize any global resources neeeded by the extension.
"""

@abstractmethod
async def get_node_list(self) -> list[type[io.ComfyNode]]:
"""
Returns a list of nodes that this extension provides.
"""

class Input:
Image = ImageInput
Audio = AudioInput
Expand Down Expand Up @@ -103,4 +120,5 @@ class Types:
"Input",
"InputImpl",
"Types",
"ComfyExtension",
]
Loading
Loading