From aa0fe4fa3d90b4751d04ab70a5d3a19cb1dd8af1 Mon Sep 17 00:00:00 2001 From: Chris Dumas Date: Tue, 21 Jul 2026 10:43:24 +0000 Subject: [PATCH] Initial DumasNodes seed --- .gitignore | 4 ++++ LICENSE | 21 +++++++++++++++++ README.md | 41 ++++++++++++++++++++++++++++++++++ __init__.py | 3 +++ dumas_json_nodes.py | 32 ++++++++++++++++++++++++++ pyproject.toml | 13 +++++++++++ tests/test_dumas_json_nodes.py | 23 +++++++++++++++++++ 7 files changed, 137 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 __init__.py create mode 100644 dumas_json_nodes.py create mode 100644 pyproject.toml create mode 100644 tests/test_dumas_json_nodes.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..406eb48 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +*.py[cod] +*.egg-info/ +.pytest_cache/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c4a84a0 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..868a6e9 --- /dev/null +++ b/README.md @@ -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. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..1c19a98 --- /dev/null +++ b/__init__.py @@ -0,0 +1,3 @@ +from .dumas_json_nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS + +__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"] diff --git a/dumas_json_nodes.py b/dumas_json_nodes.py new file mode 100644 index 0000000..9025149 --- /dev/null +++ b/dumas_json_nodes.py @@ -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", +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..513e256 --- /dev/null +++ b/pyproject.toml @@ -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 = "" diff --git a/tests/test_dumas_json_nodes.py b/tests/test_dumas_json_nodes.py new file mode 100644 index 0000000..be9222c --- /dev/null +++ b/tests/test_dumas_json_nodes.py @@ -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()