Pyobjects/Set Remove
Drop one item from a Python set in ComfyUI
- py_set
- item
- SET
Set Remove (SetRemoveNode) is Set Add's mirror image: hand it a SET and an item, and it hands back the set without that item. If the item was never in the set, nothing breaks - you just get the same set back unchanged, which is the well-behaved version of Python's set.discard() rather than the error-if-missing set.remove(). That distinction matters in a graph context where you often don't know for certain whether a given value made it in.
Part of aria1th's ComfyUI-LogicUtils - the Illustrious XL trainer's side-project utility pack, which ports a fair chunk of Python's built-ins (math, string/list randomization, and this full set-algebra family) straight into node form. It's low-profile; you won't find much written about it outside its own README, which is itself pretty thin.
How it works
Functionally it's py_set - {item}, returned as a new SET. Like the rest of this node family it doesn't rely on you tracking in-place mutation - the output is the state after removal, and that's what you wire forward. Typical use: you've built up a "candidates" set with a chain of Set Add nodes, and now you want to knock out one you've already processed or explicitly excluded, without rebuilding the whole thing from a filtered string.
Inputs and outputs
py_set(SET, required) - the set to remove from.item(any type, required) - the value to remove, if present.- Output:
SET- the set withitemgone (or unchanged if it wasn't a member to begin with).
How to install it
Via ComfyUI Manager: search "ComfyUI-LogicUtils", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/aria1th/ComfyUI-LogicUtils
then restart. It's a plain Python set op - no models, no VRAM, no meaningful runtime cost.
Common issues & troubleshooting
"Missing node type" loading a workflow. Use ComfyUI Manager's "Install Missing Custom Nodes" to pull in the whole pack from the graph rather than chasing SetRemoveNode down individually.
Startup import errors. Per the README, the pack's own dependency auto-installer is opt-in: set COMFYUI_LOGICUTILS_AUTO_INSTALL=1 before launching ComfyUI to let it install what it needs, or COMFYUI_LOGICUTILS_SKIP_INSTALL=1 to turn the hook off if that's what's misbehaving. SetRemoveNode itself has no external dependency, so an import failure here is a symptom from elsewhere in the pack, not this node.
"Item not removed, set looks the same." That's the expected no-op behavior when the item was never a member - not an error. If you need to know whether removal actually changed anything (as opposed to just getting a clean result either way), you'd have to compare set sizes before and after yourself; the node doesn't surface that as a separate output.
Downstream node won't accept the output. SET is a LogicUtils-only type. Route it through Set to List before handing it to anything in ComfyUI core or another pack that expects a plain LIST.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| py_set | SET | — | |
| item | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SET | SET | — |