Dynamic widget visibility for ComfyUI nodes via simple metadata
Project description
comfy-dynamic-widgets
A Python library that enables conditional widget visibility in ComfyUI nodes via simple metadata.
Installation
pip install comfy-dynamic-widgets
Usage
For Node Authors
Add visible_when metadata to widget definitions:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"backend": (["option_a", "option_b", "option_c"], {"default": "option_a"}),
},
"optional": {
"param_for_a": ("FLOAT", {
"default": 0.1,
"visible_when": {"backend": ["option_a"]},
}),
"param_for_b_and_c": ("INT", {
"default": 10,
"visible_when": {"backend": ["option_b", "option_c"]},
}),
}
}
For Custom Node Package Authors
In your prestartup_script.py:
import json
import os
def generate_widget_mappings():
try:
from comfy_dynamic_widgets import scan_all_nodes, generate_mappings
configs = scan_all_nodes()
if not configs:
return
mappings = generate_mappings(configs)
output_path = os.path.join(
os.path.dirname(__file__), "web", "js", "mappings.json"
)
with open(output_path, "w") as f:
json.dump(mappings, f, indent=2)
except ImportError:
print("comfy-dynamic-widgets not installed")
generate_widget_mappings()
Copy the dynamic_widgets.js from this package to your web/js/ folder and update the mappings path.
API
scan_all_nodes() -> dict
Scans all registered ComfyUI nodes and extracts visible_when metadata.
generate_mappings(configs: dict) -> dict
Transforms node visibility configs into a JS-friendly JSON format.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file comfy_dynamic_widgets-0.0.8.tar.gz.
File metadata
- Download URL: comfy_dynamic_widgets-0.0.8.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0be14474646b37d6c894649f2c51740439e870ea028ae192190e4b409e02b61
|
|
| MD5 |
b630c5df62b0b2ae6a9ac9d40281d292
|
|
| BLAKE2b-256 |
898a6feb3f418365fecf90567c0efec82295173b438b32188aee7c5a69f3f797
|
Provenance
The following attestation bundles were made for comfy_dynamic_widgets-0.0.8.tar.gz:
Publisher:
publish.yml on PozzettiAndrea/comfy-dynamic-widgets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comfy_dynamic_widgets-0.0.8.tar.gz -
Subject digest:
b0be14474646b37d6c894649f2c51740439e870ea028ae192190e4b409e02b61 - Sigstore transparency entry: 868459406
- Sigstore integration time:
-
Permalink:
PozzettiAndrea/comfy-dynamic-widgets@a9cad16581bbe48e5910af29f2f68941ac028d05 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PozzettiAndrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9cad16581bbe48e5910af29f2f68941ac028d05 -
Trigger Event:
push
-
Statement type:
File details
Details for the file comfy_dynamic_widgets-0.0.8-py3-none-any.whl.
File metadata
- Download URL: comfy_dynamic_widgets-0.0.8-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
affca7a62647c44d93829826fd35a240f5c788a0b6a950d0f556fada4eea3da4
|
|
| MD5 |
12327f95060fdad1f0b18732712a64ae
|
|
| BLAKE2b-256 |
5f62d124727e5c1fc2427db20868ed6a8944bbb731c796db5054466267e5d98f
|
Provenance
The following attestation bundles were made for comfy_dynamic_widgets-0.0.8-py3-none-any.whl:
Publisher:
publish.yml on PozzettiAndrea/comfy-dynamic-widgets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
comfy_dynamic_widgets-0.0.8-py3-none-any.whl -
Subject digest:
affca7a62647c44d93829826fd35a240f5c788a0b6a950d0f556fada4eea3da4 - Sigstore transparency entry: 868459408
- Sigstore integration time:
-
Permalink:
PozzettiAndrea/comfy-dynamic-widgets@a9cad16581bbe48e5910af29f2f68941ac028d05 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/PozzettiAndrea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a9cad16581bbe48e5910af29f2f68941ac028d05 -
Trigger Event:
push
-
Statement type: