From 651dc240fc259e9ecf7cd8144f6b6c6cc2e07879 Mon Sep 17 00:00:00 2001 From: Antonio Cordero Balcazar Date: Sun, 17 May 2026 16:11:12 +0200 Subject: [PATCH] * Bump version. * PromptPostProcessorSelectVariableComfyUINode: exceptions on invalid values. --- ppp_comfyui.py | 16 ++++++++-------- pyproject.toml | 2 +- scripts/ppp_script.py | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ppp_comfyui.py b/ppp_comfyui.py index 3cfeb2a..79450c2 100644 --- a/ppp_comfyui.py +++ b/ppp_comfyui.py @@ -1,3 +1,6 @@ +if __name__ == "__main__": + raise SystemExit("This script must be run from ComfyUI") + import logging import os from pathlib import Path @@ -14,9 +17,6 @@ from ppp_utils import escape_single_quotes from ppp_wildcards import PPPWildcards from ppp_enmappings import PPPExtraNetworkMappings -if __name__ == "__main__": - raise SystemExit("This script must be run from ComfyUI") - def _resolve_wildcards_folders(override: str = "") -> list[Path]: """Return the resolved list of wildcard folder paths.""" @@ -849,13 +849,13 @@ class PromptPostProcessorSelectVariableComfyUINode: variables: dict[str, Any], name: str, ): - value = "" if variables: if name == "": - value = "\n".join(f"{k}: {v}" for k, v in variables.items()) - elif name in variables: - value = variables[name] - return (value,) + return ("\n".join(f"{k}: {v}" for k, v in variables.items()),) + if name in variables: + return (variables[name],) + raise ValueError(f"Variable '{name}' not found in the input variables") + raise ValueError("No variables provided to select from") class PromptPostProcessorWildcardConcatComfyUINode: diff --git a/pyproject.toml b/pyproject.toml index 83ee573..0197849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "sd-webui-prompt-postprocessor" description = "Stable Diffusion WebUI & ComfyUI extension to post-process the prompt. Features include: wildcards, sending content from the prompt to the negative prompt, variables, model detection, extranetwork mapping, cleanup." -version = "3.1.0" +version = "3.2.0" license = { file = "LICENSE.txt" } dependencies = ["lark", "numpy", "pyyaml", "pydantic"] requires-python = ">=3.10" diff --git a/scripts/ppp_script.py b/scripts/ppp_script.py index 40d991e..afbf2a1 100644 --- a/scripts/ppp_script.py +++ b/scripts/ppp_script.py @@ -15,6 +15,7 @@ from modules.processing import StableDiffusionProcessing # type: ignore from modules.shared import opts # type: ignore from modules.paths import models_path # type: ignore import gradio as gr # type: ignore + from ppp import PromptPostProcessor from ppp_classes import IFWILDCARDS_CHOICES, ONWARNING_CHOICES, SUPPORTED_APPS, SUPPORTED_APPS_NAMES, PPPStateOptions from ppp_logging import DEBUG_LEVEL, PromptPostProcessorLogFactory, log