Scriptable nodes for ComfyUI with code execution capabilities
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Balazs Horvath 2d8daecc86 Add tunnel pattern and ScriptableImage debugging notes to EARTHBOUND_PATTERNS.md
- Add Pattern 13: Rotozoomer Tunnel Loop (1800 frames @ 640x480)
- Add ScriptableImage compatibility notes
- Add debugging section for animation issues
- Document torch.sin() vs sin() requirement
2026-04-18 02:23:21 +02:00
docs Add tunnel pattern and ScriptableImage debugging notes to EARTHBOUND_PATTERNS.md 2026-04-18 02:23:21 +02:00
nodes Add tunnel pattern and ScriptableImage debugging notes to EARTHBOUND_PATTERNS.md 2026-04-18 02:23:21 +02:00
__init__.py Initial commit: Scriptable nodes for ComfyUI with code execution capabilities 2026-04-18 00:15:03 +02:00
README.md Initial commit: Scriptable nodes for ComfyUI with code execution capabilities 2026-04-18 00:15:03 +02:00
requirements.txt Initial commit: Scriptable nodes for ComfyUI with code execution capabilities 2026-04-18 00:15:03 +02:00

ComfyUI_Scriptable

Scriptable nodes for ComfyUI with remote code execution and animation support.

⚠️ Security Warning

This extension uses exec() to execute user-provided Python scripts.

This is intentionally designed for local development and experimentation only. DO NOT use this extension in production or expose it to public networks.

This extension will NOT be submitted to the ComfyUI Registry as it violates the security standards prohibiting eval/exec calls [1].

Features

  • Scriptable execution: Run user Python scripts to generate ComfyUI data
  • Multiple node types: String, Image, Noise, Latent, Mask, Conditioning, Text, Empty Latent
  • Animation support: Create animated GIFs and video frames with numpy
  • CodeMirror integration: Syntax-highlighted code editor (requires ComfyUI_CodeMirror)
  • Security layers: Network exposure detection, configuration control, optional sandbox mode

Installation

cd /path/to/ComfyUI/custom_nodes
git clone <repository-url> ComfyUI_Scriptable

Configuration

Environment Variables

# Disable scriptable nodes (default: enabled)
export COMFYUI_SCRIPTABLE_NODES_ENABLED=0

# Allow remote execution (DANGEROUS - default: disabled)
export COMFYUI_ALLOW_REMOTE_EXECUTION=1

Config File

Create config.yaml in the extension directory:

scriptable_nodes:
  enabled: true
  allow_remote_execution: false
  enable_io_helpers: false
  sandbox_mode: false

Node Types

ScriptableString

Generate dynamic strings from Python scripts.

Inputs: string_in, seed, index, enable_io_helpers, script Outputs: output_string, output_string_2

Example:

output_string = f"quality seed {seed}, variation {index}"

ScriptableImage

Generate images from Python scripts with animation support.

Inputs: width, height, seed, enable_io_helpers, script Outputs: image

Animation Example:

import numpy as np

frames = []
for t in range(30):
    plasma = np.sin(X + t/5) + np.sin(Y + t/5)
    rgb = (plasma * 255).astype(np.uint8)
    frames.append(rgb)

output_image = create_animation(frames, mode='gif', duration=100)

ScriptableNoise

Generate noise tensors from Python scripts.

Inputs: width, height, seed, script Outputs: noise

ScriptableLatent

Generate latent representations from Python scripts.

Inputs: width, height, batch_size, seed, script Outputs: latent

ScriptableMask

Generate masks from Python scripts.

Inputs: width, height, seed, script Outputs: mask

ScriptableConditioning

Generate conditioning from Python scripts.

Inputs: conditioning_in, seed, script Outputs: conditioning

ScriptableText

Generate text from Python scripts.

Inputs: text_in, seed, script Outputs: text

ScriptableEmptyLatent

Generate empty latent with custom parameters.

Inputs: width, height, batch_size, seed, script Outputs: latent

Animation Guide

See docs/ANIMATION_GUIDE.md for detailed animation examples including:

  • Plasma effects
  • Perlin noise fractals
  • Mandelbrot zoom
  • Sine wave interference
  • Recursive patterns

Security Model

See docs/SECURITY.md for detailed security information including:

  • Why this extension cannot be in the ComfyUI Registry
  • Security layers and protection mechanisms
  • Safe vs unsafe usage scenarios
  • Security best practices
  • Incident response procedures

Architecture

See docs/ARCHITECTURE.md for:

  • System architecture diagrams
  • Node type details
  • Helper injection patterns
  • Integration with ComfyUI_CodeMirror
  • Migration strategy

CodeMirror Integration

This extension leverages ComfyUI_CodeMirror for syntax-highlighted code editing.

Requirements:

  • Install ComfyUI_CodeMirror in your custom_nodes directory
  • All scriptable nodes automatically get syntax highlighting
  • Graceful fallback to default textarea if CodeMirror unavailable

Helper Injection

Standard Helpers (Always Available)

  • torch: PyTorch
  • np: NumPy
  • random: Python random
  • json: JSON encoding/decoding
  • re: Regular expressions

Optional I/O Helpers (enable_io_helpers=True)

  • get_output_dir(): Get ComfyUI output directory
  • get_input_dir(): Get ComfyUI input directory
  • get_temp_dir(): Get temporary directory
  • save_tensor(tensor, path): Save tensor to file
  • load_tensor(path): Load tensor from file

Animation Helpers (ScriptableImage only)

  • create_animation(frames, mode, duration, loop): Create animation
  • PIL: Pillow image library

Migration from WolfSigmas/WolfBypass

Scriptable nodes have been completely moved from ComfyUI_WolfSigmas and ComfyUI_WolfBypass to this extension.

Migrated nodes:

  • WolfScriptableString → ScriptableString
  • WolfScriptableImage → ScriptableImage (with animation support)
  • WolfScriptableNoise → ScriptableNoise
  • WolfScriptableLatent → ScriptableLatent
  • WolfScriptableMask → ScriptableMask
  • WolfScriptableConditioning → ScriptableConditioning
  • WolfScriptableText → ScriptableText
  • WolfScriptableEmptyLatent → ScriptableEmptyLatent
  • WolfSimpleScriptableEmptyLatent → ScriptableEmptyLatent

Not migrated (complex/specialized):

  • WolfScriptableLatentFlux2 (Flux-specific)
  • Script evaluator nodes (3 types: WolfSigmaScriptEvaluator, WolfSamplerScriptEvaluator, WolfSimpleSamplerScriptEvaluator)
  • LoraLoaderWolfBlocksScriptable (tightly coupled to WolfBypass internals)

The old nodes have been removed from WolfSigmas and WolfBypass. Install ComfyUI_Scriptable to use scriptable node functionality.

Citations

[1] ComfyUI Registry Standards - eval/exec Calls Policy https://docs.comfy.org/registry/standards

[2] Python Pillow - Creating Animated GIFs https://www.tutorialspoint.com/python_pillow/python_pillow_creating_animated_gifs.htm

[3] array2gif PyPI - NumPy to GIF Conversion https://pypi.org/project/array2gif/

License

MIT