Skip to content

Commit 79e1d44

Browse files
bigcat88adlerfaulkner
authored andcommitted
fix(v3,api-nodes): V3 schema typing; corrected Pika API nodes (comfyanonymous#10265)
1 parent d533bad commit 79e1d44

File tree

8 files changed

+310
-313
lines changed

8 files changed

+310
-313
lines changed

comfy_api/latest/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from comfy_api.latest._input import ImageInput, AudioInput, MaskInput, LatentInput, VideoInput
99
from comfy_api.latest._input_impl import VideoFromFile, VideoFromComponents
1010
from comfy_api.latest._util import VideoCodec, VideoContainer, VideoComponents
11-
from comfy_api.latest._io import _IO as io #noqa: F401
12-
from comfy_api.latest._ui import _UI as ui #noqa: F401
11+
from . import _io as io
12+
from . import _ui as ui
1313
# from comfy_api.latest._resources import _RESOURCES as resources #noqa: F401
1414
from comfy_execution.utils import get_executing_context
1515
from comfy_execution.progress import get_progress_state, PreviewImageTuple
@@ -114,11 +114,16 @@ class Types:
114114
ComfyAPISync: Type[comfy_api.latest.generated.ComfyAPISyncStub.ComfyAPISyncStub]
115115
ComfyAPISync = create_sync_class(ComfyAPI_latest)
116116

117+
comfy_io = io # create the new alias for io
118+
117119
__all__ = [
118120
"ComfyAPI",
119121
"ComfyAPISync",
120122
"Input",
121123
"InputImpl",
122124
"Types",
123125
"ComfyExtension",
126+
"io",
127+
"comfy_io",
128+
"ui",
124129
]

comfy_api/latest/_input/video_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22
from abc import ABC, abstractmethod
3-
from typing import Optional, Union
3+
from typing import Optional, Union, IO
44
import io
55
import av
66
from comfy_api.util import VideoContainer, VideoCodec, VideoComponents
@@ -23,7 +23,7 @@ def get_components(self) -> VideoComponents:
2323
@abstractmethod
2424
def save_to(
2525
self,
26-
path: str,
26+
path: Union[str, IO[bytes]],
2727
format: VideoContainer = VideoContainer.AUTO,
2828
codec: VideoCodec = VideoCodec.AUTO,
2929
metadata: Optional[dict] = None

comfy_api/latest/_io.py

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,78 +1582,78 @@ def as_dict(self) -> dict:
15821582
...
15831583

15841584

1585-
class _IO:
1586-
FolderType = FolderType
1587-
UploadType = UploadType
1588-
RemoteOptions = RemoteOptions
1589-
NumberDisplay = NumberDisplay
1590-
1591-
comfytype = staticmethod(comfytype)
1592-
Custom = staticmethod(Custom)
1593-
Input = Input
1594-
WidgetInput = WidgetInput
1595-
Output = Output
1596-
ComfyTypeI = ComfyTypeI
1597-
ComfyTypeIO = ComfyTypeIO
1598-
#---------------------------------
1585+
__all__ = [
1586+
"FolderType",
1587+
"UploadType",
1588+
"RemoteOptions",
1589+
"NumberDisplay",
1590+
1591+
"comfytype",
1592+
"Custom",
1593+
"Input",
1594+
"WidgetInput",
1595+
"Output",
1596+
"ComfyTypeI",
1597+
"ComfyTypeIO",
15991598
# Supported Types
1600-
Boolean = Boolean
1601-
Int = Int
1602-
Float = Float
1603-
String = String
1604-
Combo = Combo
1605-
MultiCombo = MultiCombo
1606-
Image = Image
1607-
WanCameraEmbedding = WanCameraEmbedding
1608-
Webcam = Webcam
1609-
Mask = Mask
1610-
Latent = Latent
1611-
Conditioning = Conditioning
1612-
Sampler = Sampler
1613-
Sigmas = Sigmas
1614-
Noise = Noise
1615-
Guider = Guider
1616-
Clip = Clip
1617-
ControlNet = ControlNet
1618-
Vae = Vae
1619-
Model = Model
1620-
ClipVision = ClipVision
1621-
ClipVisionOutput = ClipVisionOutput
1622-
AudioEncoder = AudioEncoder
1623-
AudioEncoderOutput = AudioEncoderOutput
1624-
StyleModel = StyleModel
1625-
Gligen = Gligen
1626-
UpscaleModel = UpscaleModel
1627-
Audio = Audio
1628-
Video = Video
1629-
SVG = SVG
1630-
LoraModel = LoraModel
1631-
LossMap = LossMap
1632-
Voxel = Voxel
1633-
Mesh = Mesh
1634-
Hooks = Hooks
1635-
HookKeyframes = HookKeyframes
1636-
TimestepsRange = TimestepsRange
1637-
LatentOperation = LatentOperation
1638-
FlowControl = FlowControl
1639-
Accumulation = Accumulation
1640-
Load3DCamera = Load3DCamera
1641-
Load3D = Load3D
1642-
Load3DAnimation = Load3DAnimation
1643-
Photomaker = Photomaker
1644-
Point = Point
1645-
FaceAnalysis = FaceAnalysis
1646-
BBOX = BBOX
1647-
SEGS = SEGS
1648-
AnyType = AnyType
1649-
MultiType = MultiType
1650-
#---------------------------------
1651-
HiddenHolder = HiddenHolder
1652-
Hidden = Hidden
1653-
NodeInfoV1 = NodeInfoV1
1654-
NodeInfoV3 = NodeInfoV3
1655-
Schema = Schema
1656-
ComfyNode = ComfyNode
1657-
NodeOutput = NodeOutput
1658-
add_to_dict_v1 = staticmethod(add_to_dict_v1)
1659-
add_to_dict_v3 = staticmethod(add_to_dict_v3)
1599+
"Boolean",
1600+
"Int",
1601+
"Float",
1602+
"String",
1603+
"Combo",
1604+
"MultiCombo",
1605+
"Image",
1606+
"WanCameraEmbedding",
1607+
"Webcam",
1608+
"Mask",
1609+
"Latent",
1610+
"Conditioning",
1611+
"Sampler",
1612+
"Sigmas",
1613+
"Noise",
1614+
"Guider",
1615+
"Clip",
1616+
"ControlNet",
1617+
"Vae",
1618+
"Model",
1619+
"ClipVision",
1620+
"ClipVisionOutput",
1621+
"AudioEncoder",
1622+
"AudioEncoderOutput",
1623+
"StyleModel",
1624+
"Gligen",
1625+
"UpscaleModel",
1626+
"Audio",
1627+
"Video",
1628+
"SVG",
1629+
"LoraModel",
1630+
"LossMap",
1631+
"Voxel",
1632+
"Mesh",
1633+
"Hooks",
1634+
"HookKeyframes",
1635+
"TimestepsRange",
1636+
"LatentOperation",
1637+
"FlowControl",
1638+
"Accumulation",
1639+
"Load3DCamera",
1640+
"Load3D",
1641+
"Load3DAnimation",
1642+
"Photomaker",
1643+
"Point",
1644+
"FaceAnalysis",
1645+
"BBOX",
1646+
"SEGS",
1647+
"AnyType",
1648+
"MultiType",
1649+
# Other classes
1650+
"HiddenHolder",
1651+
"Hidden",
1652+
"NodeInfoV1",
1653+
"NodeInfoV3",
1654+
"Schema",
1655+
"ComfyNode",
1656+
"NodeOutput",
1657+
"add_to_dict_v1",
1658+
"add_to_dict_v3",
1659+
]

comfy_api/latest/_ui.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,16 @@ def as_dict(self):
449449
return {"text": (self.value,)}
450450

451451

452-
class _UI:
453-
SavedResult = SavedResult
454-
SavedImages = SavedImages
455-
SavedAudios = SavedAudios
456-
ImageSaveHelper = ImageSaveHelper
457-
AudioSaveHelper = AudioSaveHelper
458-
PreviewImage = PreviewImage
459-
PreviewMask = PreviewMask
460-
PreviewAudio = PreviewAudio
461-
PreviewVideo = PreviewVideo
462-
PreviewUI3D = PreviewUI3D
463-
PreviewText = PreviewText
452+
__all__ = [
453+
"SavedResult",
454+
"SavedImages",
455+
"SavedAudios",
456+
"ImageSaveHelper",
457+
"AudioSaveHelper",
458+
"PreviewImage",
459+
"PreviewMask",
460+
"PreviewAudio",
461+
"PreviewVideo",
462+
"PreviewUI3D",
463+
"PreviewText",
464+
]

comfy_api_nodes/apinode_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def tensor_to_bytesio(
269269
mime_type: Target image MIME type (e.g., 'image/png', 'image/jpeg', 'image/webp', 'video/mp4').
270270
271271
Returns:
272-
Named BytesIO object containing the image data.
272+
Named BytesIO object containing the image data, with pointer set to the start of buffer.
273273
"""
274274
if not mime_type:
275275
mime_type = "image/png"

0 commit comments

Comments
 (0)