Releases: Chaoses-Ib/ComfyScript
ComfyScript v0.7.0a1
Note
To install this pre-release from PyPI (instead of a local git repository), --pre option is needed: pip install -U --pre comfy-script[default]
-
Transpiler: Support formatting node inputs as keyword arguments (#119, @longredzhong)
The default behavior is changed to format as keyword arguments if there are more than 2 inputs, for example:
model, clip, vae = CheckpointLoaderSimple('v1-5-pruned-emaonly.ckpt') conditioning = CLIPTextEncode('beautiful scenery nature glass bottle landscape, , purple galaxy bottle,', clip) conditioning2 = CLIPTextEncode('text, watermark', clip) latent = EmptyLatentImage(width=512, height=512, batch_size=1) latent = KSampler(model=model, seed=156680208700286, steps=20, cfg=8, sampler_name='euler', scheduler='normal', positive=conditioning, negative=conditioning2, latent_image=latent, denoise=1) image = VAEDecode(latent, vae) SaveImage(image, 'ComfyUI')
CLI usage:
--args [pos|pos2orkwd|kwd] Format node inputs as positional or keyword arguments. [default: Pos2OrKwd]
e.g.
python -m comfy_script.transpile --args kwd workflow.json -
Runtime:
util: Addconcat_latents,load_latent_from_path,save_latent_and_get_path(#118,#29)For example:
# For print queue.watch_display(False) with Workflow(): latent = EmptyLatentImage(batch_size=4) latent_path = util.save_latent_and_get_path(latent) print(latent_path) with Workflow(): latent = util.load_latent_from_path(latent_path) # Do something with the latent, for example: SaveLatent(latent, 'latents/loaded')
ComfyScript v0.6.1
- fix(runtime,client): event loop closed on Python 3.12+ (#117)
ComfyScript v0.6.0: Simpler to use
Note
ComfyScript is a Python frontend and library for ComfyUI. See README for details and examples.
New features
-
Python 3.14 support
(Solara UI doesn't support Python 3.14 yet: widgetti/solara#1108)
-
Runtime
-
Add
utilmodule with some utlity functions (#29,#47,#76)get_int,get_float,get_strandget_imagesconcat_imagessave_imageandsave_image_cwdsave_image_and_get_pathsandload_image_from_paths
For example:
latent = KSampler(...) image = VAEDecode(latent, vae) images = util.get_images(image) # `images` is of type `list[PIL.Image.Image]`
-
Add
nodemodule withnodesandgetproperties (#17, #30, #59)See
utilmodule for examples. -
Virtual mode
-
Using loaded comfyui if inside comfyui (#104)
-
Share comfyui package context vars by default
Docs
-
Installation
-
Update installing only ComfyScript package (#3,#115,#95)
Install/update ComfyScript:
python -m pip install -U "comfy-script[default]"Save and run the following code to test (e.g.
python examples/runtime.py):from comfy_script.runtime import * # ComfyUI server/path # or: load(r'path/to/ComfyUI') load('http://127.0.0.1:8188/') from comfy_script.runtime.nodes import * with Workflow(wait=True): image = EmptyImage() images = util.get_images(image, save=True)
Or without installing Python, directly use ComfyScript with uv:
uv run examples/uv.py
examples/uv.py:# /// script # requires-python = ">=3.9" # dependencies = [ # "comfy-script[default]", # ] # /// from comfy_script.runtime import * load('http://127.0.0.1:8188/') from comfy_script.runtime.nodes import * with Workflow(wait=True): image = EmptyImage() images = util.get_images(image, save=True)
-
Add installing with ComfyUI & uv venv
-
Add VS Code Notebook kernel list troubleshooting
-
-
Transpiler: Update usage
If you installed ComfyScript outside of ComfyUI, you can still use the transpiler by:
- CLI
Or without installing ComfyScript, directly with uv:
python -m comfy_script.transpile "workflow.json" --api http://127.0.0.1:8188/uvx --from "comfy-script[default]" python -m comfy_script.transpile "workflow.json" --api http://127.0.0.1:8188/
- Python code
- Jupyter Notebook / web: MetadataViewer
- CLI
-
Runtime
- Add docs for
Workflowcontext manager
- Add docs for
-
Images: Add metadata (#19)
-
Models
-
Examples
-
Add projects using this library and some examples (#108)
- CarbBot: Simple Discord Bot for interfacing with ComfyUI and/or the Stability AI API for text2image generation using the SDXL model
- comfy-character-app: A ComfyUI and ComfyScript Gradio-based app for generating characters using a multi-step process.
- io_comfyui: Let Blender work with ComfyUI by ComfyScript.
- Mea comfy wrap: Simple script for wraping comfy ui workflows for future usage as a micro services with gRPC interface
- the-searcher-SD: proof of concept of a tool to enhance likeness of subjects in SDXL
- Randomize_ComfyScript: Randomizer script for ComfyUI using ComfyScript
Changes
-
cliextra (optional dependencies) is now enabled by defaultclickis ~100KB. You can still disable this if you like.
Fixes
- Runtime
main.serveris no longer the server instance (#86)- ComfyUI
LogInterceptorbreaks Jupyter Notebook - redirect
__main__.__file__toComfyUI/main.py(#89) - Node/output type namespace confusion (#22)
- Virtual mode
- Real mode
- comfyui package breaks cli_args
- comfyui package
LogInterceptorbreaks Jupyter Notebook too - comfyui package
receive_all_progress_notificationsis readonly now (#65)
- Transpiler
- Nodes
- Update
ComfyUI_Ib_CustomNodesto fixPILToImageandPILToMask(#83)
- Update
v0.5.1
Docs
- Installation: Add Comfy-Cli and Modal example (#68, #69, @the-dream-machine)
- Models: Add example code to list all checkpoints (#65, #69)
Fixes
- Runtime: comfyui package not load comfyui-legacy nodes (all additional nodes) (#68)
v0.5.0: Previews, CivitAI nodes, ImageViewer and MetadataViewer
Note
ComfyScript is a Python frontend and library for ComfyUI. See README for details and examples.
New features
-
Runtime
-
Add node preview display and callbacks (#36) (experimental)
Example usage from @ambocclusion:
325685398-57d92290-eefb-49b2-80e8-ceefd76425c1.mp4
-
Show progress bar by tqdm instead of custom
print() -
Virtual mode:
when_empty()accepts callback without args (#48) -
Real mode: Add support for node cache (#34) (experimental)
-
Docs
- Add troubleshooting for type stubs not working (#44)
- Add retrieving images examples (#64, #36)
- Update
ComfyUIArgsdocs (#64)
-
-
Transpiler
-
Support converting workflow JSON to runnable scripts via CLI (#43)
Usage:
python -m comfy_script.transpile "tests\transpile\default.json" --runtime > script.py
-
Add settings for hook (#27, #38, #42)
settings.toml:[transpile.hook] # When ComfyScript is installed as custom nodes, `SaveImage` and similar nodes will be hooked to automatically save the script as the image's metadata. The script will also be printed to the terminal. # To disable a feature, change its value to `false`. save_script = true print_script = true # Use workflows in API format instead of web UI format when possible. # Web UI format contains more information, but may also contain some UI-only virtual nodes (e.g. custom Reroute, PrimitiveNode, Note nodes) that cannot be properly transpiled. API format has better compatibility at the cost of less readable output. prefer_api_format = false
These settings can also be overriden by environment variables and Python code, see
settings.example.tomlfor details.
-
-
Nodes: Add civitai_comfy_nodes to load checkpoints/loras from CivitAI
Examples:
model, clip, vae = CivitAICheckpointLoader('101055@128078') model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055?modelVersionId=128078') model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055/sd-xl?modelVersionId=128078') model, clip = CivitAILoraLoader(model, clip, '350450@391994', strength_clip=1, strength_model=1) model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450?modelVersionId=391994', strength_clip=1, strength_model=1) model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450/sdxl-lightning-lora-2step?modelVersionId=391994', strength_clip=1, strength_model=1)
-
UI
-
ipywidgets: Add ImageViewer (#51)
A simple image viewer that can display multiple images with optional titles.
-
Solara: Add MetadataViewer (#49)
A widget for viewing the metadata of an image generated by ComfyScript / ComfyUI / Stable Diffusion web UI. Workflow JSON files are supported too, including both the web UI format and the API format.
-
-
Docs
- Add installation troubleshooting (#41)
- Bump comfyui package tested version (#65)
Changes
-
Runtime: Virtual mode: Arguments of
queue.watch_display()are changed (#36, #52)Before:
def watch_display(self, display_node: bool = True, display_task: bool = True): ... queue.watch_display(False, False)
Now:
def watch_display(self, all: bool | None = None, *, preview: bool | None = None, output: bool | None = None, task: bool | None = None): ... queue.watch_display(False) # or: queue.watch_display(preview=False, output=False, task=False)
Fixes
v0.5.0a5
v0.5.0a4
New features
-
Runtime: Show progress bar by tqdm instead of custom
print() -
Nodes: Add civitai_comfy_nodes to load checkpoints/loras from CivitAI
Examples:
model, clip, vae = CivitAICheckpointLoader('101055@128078') model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055?modelVersionId=128078') model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055/sd-xl?modelVersionId=128078') model, clip = CivitAILoraLoader(model, clip, '350450@391994', strength_clip=1, strength_model=1) model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450?modelVersionId=391994', strength_clip=1, strength_model=1) model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450/sdxl-lightning-lora-2step?modelVersionId=391994', strength_clip=1, strength_model=1)


