Initial DumasNodes seed
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.egg-info/
|
||||||
|
.pytest_cache/
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Chris Dumas
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
41
README.md
Normal file
41
README.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# DumasNodes
|
||||||
|
|
||||||
|
`DumasNodes` is a ComfyUI custom-node pack for generic utility workflows under the Dumas brand. The repo starts by replicating the JSON string parsing helper from [`a-und-b/ComfyUI_JSON_Helper`](https://github.com/a-und-b/ComfyUI_JSON_Helper) and rebadging it into a reusable `Dumas` namespace.
|
||||||
|
|
||||||
|
## Included Nodes
|
||||||
|
|
||||||
|
- `Dumas JSON String to Object`
|
||||||
|
- Converts a JSON string into a JSON object so downstream nodes can consume structured data.
|
||||||
|
- Lives in the `Dumas/JSON` category.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. Change into your ComfyUI custom nodes directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/ComfyUI/custom_nodes
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Clone this repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.dumas.ddns.net/chris.dumas/DumasNodes.git
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Restart ComfyUI.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Add `Dumas JSON String to Object` anywhere you need to bridge plain-text JSON output into structured JSON input.
|
||||||
|
|
||||||
|
## Roadmap
|
||||||
|
|
||||||
|
This repo is intended to grow into a broader set of Dumas-branded generic utility nodes, including JSON helpers and adjacent data-manipulation tools.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
The first node is derived from the upstream `ComfyUI_JSON_Helper` project by `a-und-b`, then repackaged and branded for the Dumas node collection.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT.
|
||||||
3
__init__.py
Normal file
3
__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from .dumas_json_nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||||
|
|
||||||
|
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
|
||||||
32
dumas_json_nodes.py
Normal file
32
dumas_json_nodes.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class DumasJSONStringToObjectNode:
|
||||||
|
CATEGORY = "Dumas/JSON"
|
||||||
|
RETURN_TYPES = ("JSON",)
|
||||||
|
FUNCTION = "convert_string_to_json"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"json_string": ("STRING", {"multiline": True}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def convert_string_to_json(self, json_string):
|
||||||
|
try:
|
||||||
|
json_object = json.loads(json_string)
|
||||||
|
return (json_object,)
|
||||||
|
except json.JSONDecodeError as exc:
|
||||||
|
print(f"[DumasNodes] Error decoding JSON: {exc}")
|
||||||
|
return (None,)
|
||||||
|
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {
|
||||||
|
"DumasJSONStringToObject": DumasJSONStringToObjectNode,
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"DumasJSONStringToObject": "Dumas JSON String to Object",
|
||||||
|
}
|
||||||
13
pyproject.toml
Normal file
13
pyproject.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[project]
|
||||||
|
name = "dumasnodes"
|
||||||
|
description = "Dumas-branded generic utility nodes for ComfyUI, starting with JSON helpers."
|
||||||
|
version = "0.1.0"
|
||||||
|
license = { file = "LICENSE" }
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Repository = "https://git.dumas.ddns.net/chris.dumas/DumasNodes"
|
||||||
|
|
||||||
|
[tool.comfy]
|
||||||
|
PublisherId = "chris-dumas"
|
||||||
|
DisplayName = "DumasNodes"
|
||||||
|
Icon = ""
|
||||||
23
tests/test_dumas_json_nodes.py
Normal file
23
tests/test_dumas_json_nodes.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
|
from dumas_json_nodes import DumasJSONStringToObjectNode
|
||||||
|
|
||||||
|
|
||||||
|
class DumasJSONStringToObjectNodeTests(unittest.TestCase):
|
||||||
|
def test_parses_valid_json(self):
|
||||||
|
node = DumasJSONStringToObjectNode()
|
||||||
|
|
||||||
|
result = node.convert_string_to_json('{"name":"Dumas","count":2}')
|
||||||
|
|
||||||
|
self.assertEqual(result, ({"name": "Dumas", "count": 2},))
|
||||||
|
|
||||||
|
def test_returns_none_for_invalid_json(self):
|
||||||
|
node = DumasJSONStringToObjectNode()
|
||||||
|
|
||||||
|
result = node.convert_string_to_json('{"name":')
|
||||||
|
|
||||||
|
self.assertEqual(result, (None,))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user