yijin928 commited on
Commit
199be0d
·
1 Parent(s): bb2f43d

deleted unused libraries

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. custom_nodes/ComfyUI-to-Python-Extension/.github/workflows/publish.yml +0 -21
  2. custom_nodes/ComfyUI-to-Python-Extension/.gitignore +0 -147
  3. custom_nodes/ComfyUI-to-Python-Extension/LICENSE +0 -21
  4. custom_nodes/ComfyUI-to-Python-Extension/README.md +0 -212
  5. custom_nodes/ComfyUI-to-Python-Extension/__init__.py +0 -58
  6. custom_nodes/ComfyUI-to-Python-Extension/__pycache__/__init__.cpython-312.pyc +0 -0
  7. custom_nodes/ComfyUI-to-Python-Extension/__pycache__/comfyui_to_python.cpython-312.pyc +0 -0
  8. custom_nodes/ComfyUI-to-Python-Extension/__pycache__/comfyui_to_python_utils.cpython-312.pyc +0 -0
  9. custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python.py +0 -641
  10. custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python_utils.py +0 -106
  11. custom_nodes/ComfyUI-to-Python-Extension/images/SDXL-UI-Example.PNG +0 -0
  12. custom_nodes/ComfyUI-to-Python-Extension/images/SDXL-UI-Example.jpg +0 -0
  13. custom_nodes/ComfyUI-to-Python-Extension/images/comfyui_to_python_banner.png +0 -0
  14. custom_nodes/ComfyUI-to-Python-Extension/images/dev_mode_options.PNG +0 -0
  15. custom_nodes/ComfyUI-to-Python-Extension/images/dev_mode_options.jpg +0 -0
  16. custom_nodes/ComfyUI-to-Python-Extension/images/save_as_script.png +0 -0
  17. custom_nodes/ComfyUI-to-Python-Extension/install.py +0 -20
  18. custom_nodes/ComfyUI-to-Python-Extension/js/save-as-script.js +0 -111
  19. custom_nodes/ComfyUI-to-Python-Extension/pyproject.toml +0 -15
  20. custom_nodes/ComfyUI-to-Python-Extension/requirements.txt +0 -1
  21. custom_nodes/comfyui-manager/.cache/.cache_directory +0 -0
  22. custom_nodes/comfyui-manager/.github/workflows/publish.yml +0 -21
  23. custom_nodes/comfyui-manager/.github/workflows/ruff.yml +0 -23
  24. custom_nodes/comfyui-manager/.gitignore +0 -20
  25. custom_nodes/comfyui-manager/LICENSE.txt +0 -674
  26. custom_nodes/comfyui-manager/README.md +0 -340
  27. custom_nodes/comfyui-manager/__init__.py +0 -18
  28. custom_nodes/comfyui-manager/__pycache__/__init__.cpython-312.pyc +0 -0
  29. custom_nodes/comfyui-manager/__pycache__/prestartup_script.cpython-312.pyc +0 -0
  30. custom_nodes/comfyui-manager/alter-list.json +0 -224
  31. custom_nodes/comfyui-manager/channels.list.template +0 -6
  32. custom_nodes/comfyui-manager/check.bat +0 -21
  33. custom_nodes/comfyui-manager/check.sh +0 -43
  34. custom_nodes/comfyui-manager/cm-cli.py +0 -1243
  35. custom_nodes/comfyui-manager/cm-cli.sh +0 -2
  36. custom_nodes/comfyui-manager/components/.gitignore +0 -2
  37. custom_nodes/comfyui-manager/custom-node-list.json +0 -0
  38. custom_nodes/comfyui-manager/docs/en/cm-cli.md +0 -146
  39. custom_nodes/comfyui-manager/docs/en/use_aria2.md +0 -40
  40. custom_nodes/comfyui-manager/docs/ko/cm-cli.md +0 -149
  41. custom_nodes/comfyui-manager/extension-node-map.json +0 -0
  42. custom_nodes/comfyui-manager/extras.json +0 -26
  43. custom_nodes/comfyui-manager/git_helper.py +0 -509
  44. custom_nodes/comfyui-manager/github-stats.json +0 -0
  45. custom_nodes/comfyui-manager/glob/__pycache__/cm_global.cpython-312.pyc +0 -0
  46. custom_nodes/comfyui-manager/glob/__pycache__/cnr_utils.cpython-312.pyc +0 -0
  47. custom_nodes/comfyui-manager/glob/__pycache__/git_utils.cpython-312.pyc +0 -0
  48. custom_nodes/comfyui-manager/glob/__pycache__/manager_core.cpython-312.pyc +0 -0
  49. custom_nodes/comfyui-manager/glob/__pycache__/manager_downloader.cpython-312.pyc +0 -0
  50. custom_nodes/comfyui-manager/glob/__pycache__/manager_server.cpython-312.pyc +0 -0
custom_nodes/ComfyUI-to-Python-Extension/.github/workflows/publish.yml DELETED
@@ -1,21 +0,0 @@
1
- name: Publish to Comfy registry
2
- on:
3
- workflow_dispatch:
4
- push:
5
- branches:
6
- - main
7
- paths:
8
- - "pyproject.toml"
9
-
10
- jobs:
11
- publish-node:
12
- name: Publish Custom Node to registry
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Check out code
16
- uses: actions/checkout@v4
17
- - name: Publish Custom Node
18
- uses: Comfy-Org/publish-node-action@main
19
- with:
20
- ## Add your own personal access token to your Github Repository secrets and reference it here.
21
- personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/.gitignore DELETED
@@ -1,147 +0,0 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject some infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- .hypothesis/
50
- .pytest_cache/
51
-
52
- # Translations
53
- *.mo
54
- *.pot
55
-
56
- # Django stuff:
57
- *.log
58
- local_settings.py
59
- db.sqlite3
60
- db.sqlite3-journal
61
-
62
- # Flask stuff:
63
- instance/
64
- .webassets-cache
65
-
66
- # Scrapy stuff:
67
- .scrapy
68
-
69
- # Sphinx documentation
70
- docs/_build/
71
-
72
- # PyBuilder
73
- target/
74
-
75
- # Jupyter Notebook
76
- .ipynb_checkpoints
77
-
78
- # IPython
79
- profile_default/
80
- ipython_config.py
81
-
82
- # pyenv
83
- .python-version
84
-
85
- # pipenv
86
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
87
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
88
- # having no cross-platform support, pipenv may install dependencies that don’t work, or not
89
- # install all needed dependencies.
90
- #Pipfile.lock
91
-
92
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow
93
- __pypackages__/
94
-
95
- # Celery stuff
96
- celerybeat-schedule
97
- celerybeat.pid
98
-
99
- # SageMath parsed files
100
- *.sage.py
101
-
102
- # Environments
103
- .env
104
- .venv
105
- env/
106
- venv/
107
- ENV/
108
- env.bak/
109
- venv.bak/
110
-
111
- # Spyder project settings
112
- .spyderproject
113
- .spyproject
114
-
115
- # Rope project settings
116
- .ropeproject
117
-
118
- # mkdocs documentation
119
- /site
120
-
121
- # mypy
122
- .mypy_cache/
123
- .dmypy.json
124
- dmypy.json
125
-
126
- # Pyre type checker
127
- .pyre/
128
-
129
- # pytype static type analyzer
130
- .pytype/
131
-
132
- # Cython debug symbols
133
- cython_debug/
134
-
135
- # JetBrains IDE
136
- .idea/
137
-
138
- # VS Code settings
139
- .vscode/
140
-
141
- # Data files
142
- *.csv
143
- *.dat
144
- *.log
145
- *.sql
146
- *.sqlite
147
- *.xml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2023 Peyton DeNiro
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/README.md DELETED
@@ -1,212 +0,0 @@
1
- ## ComfyUI-to-Python-Extension
2
- ![banner](images/comfyui_to_python_banner.png)
3
-
4
- The `ComfyUI-to-Python-Extension` is a powerful tool that translates [ComfyUI](https://github.com/comfyanonymous/ComfyUI) workflows into executable Python code. Designed to bridge the gap between ComfyUI's visual interface and Python's programming environment, this script facilitates the seamless transition from design to code execution. Whether you're a data scientist, a software developer, or an AI enthusiast, this tool streamlines the process of implementing ComfyUI workflows in Python.
5
-
6
- **Convert this:**
7
-
8
- ![SDXL UI Example](images/SDXL-UI-Example.jpg)
9
-
10
-
11
- **To this:**
12
-
13
- ```
14
- import random
15
- import torch
16
- import sys
17
-
18
- sys.path.append("../")
19
- from nodes import (
20
- VAEDecode,
21
- KSamplerAdvanced,
22
- EmptyLatentImage,
23
- SaveImage,
24
- CheckpointLoaderSimple,
25
- CLIPTextEncode,
26
- )
27
-
28
-
29
- def main():
30
- with torch.inference_mode():
31
- checkpointloadersimple = CheckpointLoaderSimple()
32
- checkpointloadersimple_4 = checkpointloadersimple.load_checkpoint(
33
- ckpt_name="sd_xl_base_1.0.safetensors"
34
- )
35
-
36
- emptylatentimage = EmptyLatentImage()
37
- emptylatentimage_5 = emptylatentimage.generate(
38
- width=1024, height=1024, batch_size=1
39
- )
40
-
41
- cliptextencode = CLIPTextEncode()
42
- cliptextencode_6 = cliptextencode.encode(
43
- text="evening sunset scenery blue sky nature, glass bottle with a galaxy in it",
44
- clip=checkpointloadersimple_4[1],
45
- )
46
-
47
- cliptextencode_7 = cliptextencode.encode(
48
- text="text, watermark", clip=checkpointloadersimple_4[1]
49
- )
50
-
51
- checkpointloadersimple_12 = checkpointloadersimple.load_checkpoint(
52
- ckpt_name="sd_xl_refiner_1.0.safetensors"
53
- )
54
-
55
- cliptextencode_15 = cliptextencode.encode(
56
- text="evening sunset scenery blue sky nature, glass bottle with a galaxy in it",
57
- clip=checkpointloadersimple_12[1],
58
- )
59
-
60
- cliptextencode_16 = cliptextencode.encode(
61
- text="text, watermark", clip=checkpointloadersimple_12[1]
62
- )
63
-
64
- ksampleradvanced = KSamplerAdvanced()
65
- vaedecode = VAEDecode()
66
- saveimage = SaveImage()
67
-
68
- for q in range(10):
69
- ksampleradvanced_10 = ksampleradvanced.sample(
70
- add_noise="enable",
71
- noise_seed=random.randint(1, 2**64),
72
- steps=25,
73
- cfg=8,
74
- sampler_name="euler",
75
- scheduler="normal",
76
- start_at_step=0,
77
- end_at_step=20,
78
- return_with_leftover_noise="enable",
79
- model=checkpointloadersimple_4[0],
80
- positive=cliptextencode_6[0],
81
- negative=cliptextencode_7[0],
82
- latent_image=emptylatentimage_5[0],
83
- )
84
-
85
- ksampleradvanced_11 = ksampleradvanced.sample(
86
- add_noise="disable",
87
- noise_seed=random.randint(1, 2**64),
88
- steps=25,
89
- cfg=8,
90
- sampler_name="euler",
91
- scheduler="normal",
92
- start_at_step=20,
93
- end_at_step=10000,
94
- return_with_leftover_noise="disable",
95
- model=checkpointloadersimple_12[0],
96
- positive=cliptextencode_15[0],
97
- negative=cliptextencode_16[0],
98
- latent_image=ksampleradvanced_10[0],
99
- )
100
-
101
- vaedecode_17 = vaedecode.decode(
102
- samples=ksampleradvanced_11[0], vae=checkpointloadersimple_12[2]
103
- )
104
-
105
- saveimage_19 = saveimage.save_images(
106
- filename_prefix="ComfyUI", images=vaedecode_17[0]
107
- )
108
-
109
-
110
- if __name__ == "__main__":
111
- main()
112
- ```
113
- ## Potential Use Cases
114
- - Streamlining the process for creating a lean app or pipeline deployment that uses a ComfyUI workflow
115
- - Creating programmatic experiments for various prompt/parameter values
116
- - Creating large queues for image generation (For example, you could adjust the script to generate 1000 images without clicking ctrl+enter 1000 times)
117
- - Easily expanding or iterating on your architecture in Python once a foundational workflow is in place in the GUI
118
-
119
- ## V1.3.0 Release Notes
120
- - Generate .py file directly from the ComfyUI Web App
121
-
122
- ![Save As Script](images/save_as_script.png)
123
-
124
- ## V1.2.1 Release Notes
125
- - Dynamically change `comfyui_to_python.py` parameters with CLI arguments
126
- - Hotfix to handle nodes that accept kwargs.
127
-
128
- ## V1.2.0 Release Notes
129
- - Updates to adhere to latest changes from `ComfyUI`
130
-
131
- ## V1.0.0 Release Notes
132
- - **Use all the custom nodes!**
133
- - Custom nodes are now supported. If you run into any issues with code execution, first ensure that the each node works as expected in the GUI. If it works in the GUI, but not in the generated script, please submit an issue.
134
-
135
-
136
- ## Installation
137
-
138
-
139
- 1. Navigate to your `ComfyUI/custom_nodes` directory
140
-
141
- 2. Clone this repo
142
- ```bash
143
- git clone https://github.com/pydn/ComfyUI-to-Python-Extension.git
144
- ```
145
-
146
- After cloning the repo, your `ComfyUI` directory should look like this:
147
- ```
148
- /comfy
149
- /comfy_extras
150
- /custom_nodes
151
- --/ComfyUI-to-Python-Extension
152
- /input
153
- /models
154
- /output
155
- /script_examples
156
- /web
157
- .gitignore
158
- LICENSE
159
- README.md
160
- comfyui_screenshot.png
161
- cuda_mollac.py
162
- execution.py
163
- extra_model_paths.yaml.example
164
- folder_paths.py
165
- latent_preview.py
166
- main.py
167
- nodes.py
168
- requirements.txt
169
- server.py
170
- ```
171
-
172
- ## Web App Use
173
- 1. Launch ComfyUI
174
-
175
- 2. Load your favorite workflow and click `Save As Script`
176
-
177
- ![Save As Script](images/save_as_script.png)
178
-
179
- 3. Type your desired file name into the pop up screen.
180
-
181
- 4. Move .py file from your downloads folder to your `ComfyUI` directory.
182
-
183
- 5. Now you can execute the newly created .py file to generate images without launching a server.
184
-
185
- ## CLI Usage
186
- 1. Navigate to the `ComfyUI-to-Python-Extension` folder and install requirements
187
- ```bash
188
- pip install -r requirements.txt
189
- ```
190
-
191
- 2. Launch ComfyUI, click the gear icon over `Queue Prompt`, then check `Enable Dev mode Options`. **THE SCRIPT WILL NOT WORK IF YOU DO NOT ENABLE THIS OPTION!**
192
-
193
- ![Enable Dev Mode Options](images/dev_mode_options.jpg)
194
-
195
- 3. Load up your favorite workflows, then click the newly enabled `Save (API Format)` button under Queue Prompt
196
-
197
- 4. Move the downloaded .json workflow file to your `ComfyUI/ComfyUI-to-Python-Extension` folder
198
-
199
- 5. If needed, add arguments when executing `comfyui_to_python.py` to update the default `input_file` and `output_file` to match your .json workflow file and desired .py file name. By default, the script will look for a file called `workflow_api.json`. You can also update the `queue_size` variable to your desired number of images that you want to generate in a single script execution. By default, the scripts will generate 10 images. Run `python comfyui_to_python.py --help` for more details.
200
-
201
- 6a. Run the script with default arguments:
202
- ```bash
203
- python comfyui_to_python.py
204
- ```
205
- 6b. Run the script with optional arguments:
206
- ```bash
207
- python comfyui_to_python.py --input_file "workflow_api (2).json" --output_file my_workflow.py --queue_size 100
208
- ```
209
-
210
- 7. After running `comfyui_to_python.py`, a new .py file will be created in the current working directory. If you made no changes, look for `workflow_api.py`.
211
-
212
- 8. Now you can execute the newly created .py file to generate images without launching a server.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/__init__.py DELETED
@@ -1,58 +0,0 @@
1
- import sys
2
- import os
3
-
4
- from io import StringIO
5
-
6
- import traceback
7
-
8
- from aiohttp import web
9
-
10
- ext_dir = os.path.dirname(__file__)
11
- sys.path.append(ext_dir)
12
-
13
- try:
14
- import black
15
- except ImportError:
16
- print("Unable to import requirements for ComfyUI-SaveAsScript.")
17
- print("Installing...")
18
-
19
- import importlib
20
-
21
- spec = importlib.util.spec_from_file_location(
22
- "impact_install", os.path.join(os.path.dirname(__file__), "install.py")
23
- )
24
- impact_install = importlib.util.module_from_spec(spec)
25
- spec.loader.exec_module(impact_install)
26
-
27
- print("Successfully installed. Hopefully, at least.")
28
-
29
- # Prevent reimporting of custom nodes
30
- os.environ["RUNNING_IN_COMFYUI"] = "TRUE"
31
-
32
- from comfyui_to_python import ComfyUItoPython
33
-
34
- sys.path.append(os.path.dirname(os.path.dirname(ext_dir)))
35
-
36
- import server
37
-
38
- WEB_DIRECTORY = "js"
39
- NODE_CLASS_MAPPINGS = {}
40
-
41
-
42
- @server.PromptServer.instance.routes.post("/saveasscript")
43
- async def save_as_script(request):
44
- try:
45
- data = await request.json()
46
- name = data["name"]
47
- workflow = data["workflow"]
48
-
49
- sio = StringIO()
50
- ComfyUItoPython(workflow=workflow, output_file=sio)
51
-
52
- sio.seek(0)
53
- data = sio.read()
54
-
55
- return web.Response(text=data, status=200)
56
- except Exception as e:
57
- traceback.print_exc()
58
- return web.Response(text=str(e), status=500)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/__pycache__/__init__.cpython-312.pyc DELETED
Binary file (2.84 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/__pycache__/comfyui_to_python.cpython-312.pyc DELETED
Binary file (24.8 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/__pycache__/comfyui_to_python_utils.cpython-312.pyc DELETED
Binary file (4.25 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python.py DELETED
@@ -1,641 +0,0 @@
1
- import copy
2
- import glob
3
- import inspect
4
- import json
5
- import os
6
- import random
7
- import sys
8
- import re
9
- from typing import Dict, List, Any, Callable, Tuple, TextIO
10
- from argparse import ArgumentParser
11
-
12
- import black
13
-
14
-
15
- from comfyui_to_python_utils import (
16
- import_custom_nodes,
17
- find_path,
18
- add_comfyui_directory_to_sys_path,
19
- add_extra_model_paths,
20
- get_value_at_index,
21
- )
22
-
23
- add_comfyui_directory_to_sys_path()
24
- from nodes import NODE_CLASS_MAPPINGS
25
-
26
-
27
- DEFAULT_INPUT_FILE = "workflow_api.json"
28
- DEFAULT_OUTPUT_FILE = "workflow_api.py"
29
- DEFAULT_QUEUE_SIZE = 10
30
-
31
-
32
- class FileHandler:
33
- """Handles reading and writing files.
34
-
35
- This class provides methods to read JSON data from an input file and write code to an output file.
36
- """
37
-
38
- @staticmethod
39
- def read_json_file(file_path: str | TextIO, encoding: str = "utf-8") -> dict:
40
- """
41
- Reads a JSON file and returns its contents as a dictionary.
42
-
43
- Args:
44
- file_path (str): The path to the JSON file.
45
-
46
- Returns:
47
- dict: The contents of the JSON file as a dictionary.
48
-
49
- Raises:
50
- FileNotFoundError: If the file is not found, it lists all JSON files in the directory of the file path.
51
- ValueError: If the file is not a valid JSON.
52
- """
53
-
54
- if hasattr(file_path, "read"):
55
- return json.load(file_path)
56
- with open(file_path, "r", encoding="utf-8") as file:
57
- data = json.load(file)
58
- return data
59
-
60
- @staticmethod
61
- def write_code_to_file(file_path: str | TextIO, code: str) -> None:
62
- """Write the specified code to a Python file.
63
-
64
- Args:
65
- file_path (str): The path to the Python file.
66
- code (str): The code to write to the file.
67
-
68
- Returns:
69
- None
70
- """
71
- if isinstance(file_path, str):
72
- # Extract directory from the filename
73
- directory = os.path.dirname(file_path)
74
-
75
- # If the directory does not exist, create it
76
- if directory and not os.path.exists(directory):
77
- os.makedirs(directory)
78
-
79
- # Save the code to a .py file
80
- with open(file_path, "w", encoding="utf-8") as file:
81
- file.write(code)
82
- else:
83
- file_path.write(code)
84
-
85
-
86
- class LoadOrderDeterminer:
87
- """Determine the load order of each key in the provided dictionary.
88
-
89
- This class places the nodes without node dependencies first, then ensures that any node whose
90
- result is used in another node will be added to the list in the order it should be executed.
91
-
92
- Attributes:
93
- data (Dict): The dictionary for which to determine the load order.
94
- node_class_mappings (Dict): Mappings of node classes.
95
- """
96
-
97
- def __init__(self, data: Dict, node_class_mappings: Dict):
98
- """Initialize the LoadOrderDeterminer with the given data and node class mappings.
99
-
100
- Args:
101
- data (Dict): The dictionary for which to determine the load order.
102
- node_class_mappings (Dict): Mappings of node classes.
103
- """
104
- self.data = data
105
- self.node_class_mappings = node_class_mappings
106
- self.visited = {}
107
- self.load_order = []
108
- self.is_special_function = False
109
-
110
- def determine_load_order(self) -> List[Tuple[str, Dict, bool]]:
111
- """Determine the load order for the given data.
112
-
113
- Returns:
114
- List[Tuple[str, Dict, bool]]: A list of tuples representing the load order.
115
- """
116
- self._load_special_functions_first()
117
- self.is_special_function = False
118
- for key in self.data:
119
- if key not in self.visited:
120
- self._dfs(key)
121
- return self.load_order
122
-
123
- def _dfs(self, key: str) -> None:
124
- """Depth-First Search function to determine the load order.
125
-
126
- Args:
127
- key (str): The key from which to start the DFS.
128
-
129
- Returns:
130
- None
131
- """
132
- # Mark the node as visited.
133
- self.visited[key] = True
134
- inputs = self.data[key]["inputs"]
135
- # Loop over each input key.
136
- for input_key, val in inputs.items():
137
- # If the value is a list and the first item in the list has not been visited yet,
138
- # then recursively apply DFS on the dependency.
139
- if isinstance(val, list) and val[0] not in self.visited:
140
- self._dfs(val[0])
141
- # Add the key and its corresponding data to the load order list.
142
- self.load_order.append((key, self.data[key], self.is_special_function))
143
-
144
- def _load_special_functions_first(self) -> None:
145
- """Load functions without dependencies, loaderes, and encoders first.
146
-
147
- Returns:
148
- None
149
- """
150
- # Iterate over each key in the data to check for loader keys.
151
- for key in self.data:
152
- class_def = self.node_class_mappings[self.data[key]["class_type"]]()
153
- # Check if the class is a loader class or meets specific conditions.
154
- if (
155
- class_def.CATEGORY == "loaders"
156
- or class_def.FUNCTION in ["encode"]
157
- or not any(
158
- isinstance(val, list) for val in self.data[key]["inputs"].values()
159
- )
160
- ):
161
- self.is_special_function = True
162
- # If the key has not been visited, perform a DFS from that key.
163
- if key not in self.visited:
164
- self._dfs(key)
165
-
166
-
167
- class CodeGenerator:
168
- """Generates Python code for a workflow based on the load order.
169
-
170
- Attributes:
171
- node_class_mappings (Dict): Mappings of node classes.
172
- base_node_class_mappings (Dict): Base mappings of node classes.
173
- """
174
-
175
- def __init__(self, node_class_mappings: Dict, base_node_class_mappings: Dict):
176
- """Initialize the CodeGenerator with given node class mappings.
177
-
178
- Args:
179
- node_class_mappings (Dict): Mappings of node classes.
180
- base_node_class_mappings (Dict): Base mappings of node classes.
181
- """
182
- self.node_class_mappings = node_class_mappings
183
- self.base_node_class_mappings = base_node_class_mappings
184
-
185
- def generate_workflow(
186
- self,
187
- load_order: List,
188
- queue_size: int = 10,
189
- ) -> str:
190
- """Generate the execution code based on the load order.
191
-
192
- Args:
193
- load_order (List): A list of tuples representing the load order.
194
- queue_size (int): The number of photos that will be created by the script.
195
-
196
- Returns:
197
- str: Generated execution code as a string.
198
- """
199
- # Create the necessary data structures to hold imports and generated code
200
- import_statements, executed_variables, special_functions_code, code = (
201
- set(["NODE_CLASS_MAPPINGS"]),
202
- {},
203
- [],
204
- [],
205
- )
206
- # This dictionary will store the names of the objects that we have already initialized
207
- initialized_objects = {}
208
-
209
- custom_nodes = False
210
- # Loop over each dictionary in the load order list
211
- for idx, data, is_special_function in load_order:
212
- # Generate class definition and inputs from the data
213
- inputs, class_type = data["inputs"], data["class_type"]
214
- input_types = self.node_class_mappings[class_type].INPUT_TYPES()
215
- class_def = self.node_class_mappings[class_type]()
216
-
217
- # If required inputs are not present, skip the node as it will break the code if passed through to the script
218
- missing_required_variable = False
219
- if "required" in input_types.keys():
220
- for required in input_types["required"]:
221
- if required not in inputs.keys():
222
- missing_required_variable = True
223
- if missing_required_variable:
224
- continue
225
-
226
- # If the class hasn't been initialized yet, initialize it and generate the import statements
227
- if class_type not in initialized_objects:
228
- # No need to use preview image nodes since we are executing the script in a terminal
229
- if class_type == "PreviewImage":
230
- continue
231
-
232
- class_type, import_statement, class_code = self.get_class_info(
233
- class_type
234
- )
235
- initialized_objects[class_type] = self.clean_variable_name(class_type)
236
- if class_type in self.base_node_class_mappings.keys():
237
- import_statements.add(import_statement)
238
- if class_type not in self.base_node_class_mappings.keys():
239
- custom_nodes = True
240
- special_functions_code.append(class_code)
241
-
242
- # Get all possible parameters for class_def
243
- class_def_params = self.get_function_parameters(
244
- getattr(class_def, class_def.FUNCTION)
245
- )
246
- no_params = class_def_params is None
247
-
248
- # Remove any keyword arguments from **inputs if they are not in class_def_params
249
- inputs = {
250
- key: value
251
- for key, value in inputs.items()
252
- if no_params or key in class_def_params
253
- }
254
- # Deal with hidden variables
255
- if (
256
- "hidden" in input_types.keys()
257
- and "unique_id" in input_types["hidden"].keys()
258
- ):
259
- inputs["unique_id"] = random.randint(1, 2**64)
260
- elif class_def_params is not None:
261
- if "unique_id" in class_def_params:
262
- inputs["unique_id"] = random.randint(1, 2**64)
263
-
264
- # Create executed variable and generate code
265
- executed_variables[idx] = f"{self.clean_variable_name(class_type)}_{idx}"
266
- inputs = self.update_inputs(inputs, executed_variables)
267
-
268
- if is_special_function:
269
- special_functions_code.append(
270
- self.create_function_call_code(
271
- initialized_objects[class_type],
272
- class_def.FUNCTION,
273
- executed_variables[idx],
274
- is_special_function,
275
- **inputs,
276
- )
277
- )
278
- else:
279
- code.append(
280
- self.create_function_call_code(
281
- initialized_objects[class_type],
282
- class_def.FUNCTION,
283
- executed_variables[idx],
284
- is_special_function,
285
- **inputs,
286
- )
287
- )
288
-
289
- # Generate final code by combining imports and code, and wrap them in a main function
290
- final_code = self.assemble_python_code(
291
- import_statements, special_functions_code, code, queue_size, custom_nodes
292
- )
293
-
294
- return final_code
295
-
296
- def create_function_call_code(
297
- self,
298
- obj_name: str,
299
- func: str,
300
- variable_name: str,
301
- is_special_function: bool,
302
- **kwargs,
303
- ) -> str:
304
- """Generate Python code for a function call.
305
-
306
- Args:
307
- obj_name (str): The name of the initialized object.
308
- func (str): The function to be called.
309
- variable_name (str): The name of the variable that the function result should be assigned to.
310
- is_special_function (bool): Determines the code indentation.
311
- **kwargs: The keyword arguments for the function.
312
-
313
- Returns:
314
- str: The generated Python code.
315
- """
316
- args = ", ".join(self.format_arg(key, value) for key, value in kwargs.items())
317
-
318
- # Generate the Python code
319
- code = f"{variable_name} = {obj_name}.{func}({args})\n"
320
-
321
- # If the code contains dependencies and is not a loader or encoder, indent the code because it will be placed inside
322
- # of a for loop
323
- if not is_special_function:
324
- code = f"\t{code}"
325
-
326
- return code
327
-
328
- def format_arg(self, key: str, value: any) -> str:
329
- """Formats arguments based on key and value.
330
-
331
- Args:
332
- key (str): Argument key.
333
- value (any): Argument value.
334
-
335
- Returns:
336
- str: Formatted argument as a string.
337
- """
338
- if key == "noise_seed" or key == "seed":
339
- return f"{key}=random.randint(1, 2**64)"
340
- elif isinstance(value, str):
341
- value = value.replace("\n", "\\n").replace('"', "'")
342
- return f'{key}="{value}"'
343
- elif isinstance(value, dict) and "variable_name" in value:
344
- return f'{key}={value["variable_name"]}'
345
- return f"{key}={value}"
346
-
347
- def assemble_python_code(
348
- self,
349
- import_statements: set,
350
- speical_functions_code: List[str],
351
- code: List[str],
352
- queue_size: int,
353
- custom_nodes=False,
354
- ) -> str:
355
- """Generates the final code string.
356
-
357
- Args:
358
- import_statements (set): A set of unique import statements.
359
- speical_functions_code (List[str]): A list of special functions code strings.
360
- code (List[str]): A list of code strings.
361
- queue_size (int): Number of photos that will be generated by the script.
362
- custom_nodes (bool): Whether to include custom nodes in the code.
363
-
364
- Returns:
365
- str: Generated final code as a string.
366
- """
367
- # Get the source code of the utils functions as a string
368
- func_strings = []
369
- for func in [
370
- get_value_at_index,
371
- find_path,
372
- add_comfyui_directory_to_sys_path,
373
- add_extra_model_paths,
374
- ]:
375
- func_strings.append(f"\n{inspect.getsource(func)}")
376
- # Define static import statements required for the script
377
- static_imports = (
378
- [
379
- "import os",
380
- "import random",
381
- "import sys",
382
- "from typing import Sequence, Mapping, Any, Union",
383
- "import torch",
384
- ]
385
- + func_strings
386
- + ["\n\nadd_comfyui_directory_to_sys_path()\nadd_extra_model_paths()\n"]
387
- )
388
- # Check if custom nodes should be included
389
- if custom_nodes:
390
- static_imports.append(f"\n{inspect.getsource(import_custom_nodes)}\n")
391
- custom_nodes = "import_custom_nodes()\n\t"
392
- else:
393
- custom_nodes = ""
394
- # Create import statements for node classes
395
- imports_code = [
396
- f"from nodes import {', '.join([class_name for class_name in import_statements])}"
397
- ]
398
- # Assemble the main function code, including custom nodes if applicable
399
- main_function_code = (
400
- "def main():\n\t"
401
- + f"{custom_nodes}with torch.inference_mode():\n\t\t"
402
- + "\n\t\t".join(speical_functions_code)
403
- + f"\n\n\t\tfor q in range({queue_size}):\n\t\t"
404
- + "\n\t\t".join(code)
405
- )
406
- # Concatenate all parts to form the final code
407
- final_code = "\n".join(
408
- static_imports
409
- + imports_code
410
- + ["", main_function_code, "", 'if __name__ == "__main__":', "\tmain()"]
411
- )
412
- # Format the final code according to PEP 8 using the Black library
413
- final_code = black.format_str(final_code, mode=black.Mode())
414
-
415
- return final_code
416
-
417
- def get_class_info(self, class_type: str) -> Tuple[str, str, str]:
418
- """Generates and returns necessary information about class type.
419
-
420
- Args:
421
- class_type (str): Class type.
422
-
423
- Returns:
424
- Tuple[str, str, str]: Updated class type, import statement string, class initialization code.
425
- """
426
- import_statement = class_type
427
- variable_name = self.clean_variable_name(class_type)
428
- if class_type in self.base_node_class_mappings.keys():
429
- class_code = f"{variable_name} = {class_type.strip()}()"
430
- else:
431
- class_code = f'{variable_name} = NODE_CLASS_MAPPINGS["{class_type}"]()'
432
-
433
- return class_type, import_statement, class_code
434
-
435
- @staticmethod
436
- def clean_variable_name(class_type: str) -> str:
437
- """
438
- Remove any characters from variable name that could cause errors running the Python script.
439
-
440
- Args:
441
- class_type (str): Class type.
442
-
443
- Returns:
444
- str: Cleaned variable name with no special characters or spaces
445
- """
446
- # Convert to lowercase and replace spaces with underscores
447
- clean_name = class_type.lower().strip().replace("-", "_").replace(" ", "_")
448
-
449
- # Remove characters that are not letters, numbers, or underscores
450
- clean_name = re.sub(r"[^a-z0-9_]", "", clean_name)
451
-
452
- # Ensure that it doesn't start with a number
453
- if clean_name[0].isdigit():
454
- clean_name = "_" + clean_name
455
-
456
- return clean_name
457
-
458
- def get_function_parameters(self, func: Callable) -> List:
459
- """Get the names of a function's parameters.
460
-
461
- Args:
462
- func (Callable): The function whose parameters we want to inspect.
463
-
464
- Returns:
465
- List: A list containing the names of the function's parameters.
466
- """
467
- signature = inspect.signature(func)
468
- parameters = {
469
- name: param.default if param.default != param.empty else None
470
- for name, param in signature.parameters.items()
471
- }
472
- catch_all = any(
473
- param.kind == inspect.Parameter.VAR_KEYWORD
474
- for param in signature.parameters.values()
475
- )
476
- return list(parameters.keys()) if not catch_all else None
477
-
478
- def update_inputs(self, inputs: Dict, executed_variables: Dict) -> Dict:
479
- """Update inputs based on the executed variables.
480
-
481
- Args:
482
- inputs (Dict): Inputs dictionary to update.
483
- executed_variables (Dict): Dictionary storing executed variable names.
484
-
485
- Returns:
486
- Dict: Updated inputs dictionary.
487
- """
488
- for key in inputs.keys():
489
- if (
490
- isinstance(inputs[key], list)
491
- and inputs[key][0] in executed_variables.keys()
492
- ):
493
- inputs[key] = {
494
- "variable_name": f"get_value_at_index({executed_variables[inputs[key][0]]}, {inputs[key][1]})"
495
- }
496
- return inputs
497
-
498
-
499
- class ComfyUItoPython:
500
- """Main workflow to generate Python code from a workflow_api.json file.
501
-
502
- Attributes:
503
- input_file (str): Path to the input JSON file.
504
- output_file (str): Path to the output Python file.
505
- queue_size (int): The number of photos that will be created by the script.
506
- node_class_mappings (Dict): Mappings of node classes.
507
- base_node_class_mappings (Dict): Base mappings of node classes.
508
- """
509
-
510
- def __init__(
511
- self,
512
- workflow: str = "",
513
- input_file: str = "",
514
- output_file: str | TextIO = "",
515
- queue_size: int = 1,
516
- node_class_mappings: Dict = NODE_CLASS_MAPPINGS,
517
- needs_init_custom_nodes: bool = False,
518
- ):
519
- """Initialize the ComfyUItoPython class with the given parameters. Exactly one of workflow or input_file must be specified.
520
- Args:
521
- workflow (str): The workflow's JSON.
522
- input_file (str): Path to the input JSON file.
523
- output_file (str | TextIO): Path to the output file or a file-like object.
524
- queue_size (int): The number of times a workflow will be executed by the script. Defaults to 1.
525
- node_class_mappings (Dict): Mappings of node classes. Defaults to NODE_CLASS_MAPPINGS.
526
- needs_init_custom_nodes (bool): Whether to initialize custom nodes. Defaults to False.
527
- """
528
- if input_file and workflow:
529
- raise ValueError("Can't provide both input_file and workflow")
530
- elif not input_file and not workflow:
531
- raise ValueError("Needs input_file or workflow")
532
-
533
- if not output_file:
534
- raise ValueError("Needs output_file")
535
-
536
- self.workflow = workflow
537
- self.input_file = input_file
538
- self.output_file = output_file
539
- self.queue_size = queue_size
540
- self.node_class_mappings = node_class_mappings
541
- self.needs_init_custom_nodes = needs_init_custom_nodes
542
-
543
- self.base_node_class_mappings = copy.deepcopy(self.node_class_mappings)
544
- self.execute()
545
-
546
- def execute(self):
547
- """Execute the main workflow to generate Python code.
548
-
549
- Returns:
550
- None
551
- """
552
- # Step 1: Import all custom nodes if we need to
553
- if self.needs_init_custom_nodes:
554
- import_custom_nodes()
555
- else:
556
- # If they're already imported, we don't know which nodes are custom nodes, so we need to import all of them
557
- self.base_node_class_mappings = {}
558
-
559
- # Step 2: Read JSON data from the input file
560
- if self.input_file:
561
- data = FileHandler.read_json_file(self.input_file)
562
- else:
563
- data = json.loads(self.workflow)
564
-
565
- # Step 3: Determine the load order
566
- load_order_determiner = LoadOrderDeterminer(data, self.node_class_mappings)
567
- load_order = load_order_determiner.determine_load_order()
568
-
569
- # Step 4: Generate the workflow code
570
- code_generator = CodeGenerator(
571
- self.node_class_mappings, self.base_node_class_mappings
572
- )
573
- generated_code = code_generator.generate_workflow(
574
- load_order, queue_size=self.queue_size
575
- )
576
-
577
- # Step 5: Write the generated code to a file
578
- FileHandler.write_code_to_file(self.output_file, generated_code)
579
-
580
- print(f"Code successfully generated and written to {self.output_file}")
581
-
582
-
583
- def run(
584
- input_file: str = DEFAULT_INPUT_FILE,
585
- output_file: str = DEFAULT_OUTPUT_FILE,
586
- queue_size: int = DEFAULT_QUEUE_SIZE,
587
- ) -> None:
588
- """Generate Python code from a ComfyUI workflow_api.json file.
589
-
590
- Args:
591
- input_file (str): Path to the input JSON file. Defaults to "workflow_api.json".
592
- output_file (str): Path to the output Python file.
593
- Defaults to "workflow_api.py".
594
- queue_size (int): The number of times a workflow will be executed by the script.
595
- Defaults to 1.
596
-
597
- Returns:
598
- None
599
- """
600
- ComfyUItoPython(
601
- input_file=input_file,
602
- output_file=output_file,
603
- queue_size=queue_size,
604
- needs_init_custom_nodes=True,
605
- )
606
-
607
-
608
- def main() -> None:
609
- """Main function to generate Python code from a ComfyUI workflow_api.json file."""
610
- parser = ArgumentParser(
611
- description="Generate Python code from a ComfyUI workflow_api.json file."
612
- )
613
- parser.add_argument(
614
- "-f",
615
- "--input_file",
616
- type=str,
617
- help="path to the input JSON file",
618
- default=DEFAULT_INPUT_FILE,
619
- )
620
- parser.add_argument(
621
- "-o",
622
- "--output_file",
623
- type=str,
624
- help="path to the output Python file",
625
- default=DEFAULT_OUTPUT_FILE,
626
- )
627
- parser.add_argument(
628
- "-q",
629
- "--queue_size",
630
- type=int,
631
- help="number of times the workflow will be executed by default",
632
- default=DEFAULT_QUEUE_SIZE,
633
- )
634
- pargs = parser.parse_args()
635
- run(**vars(pargs))
636
- print("Done.")
637
-
638
-
639
- if __name__ == "__main__":
640
- """Run the main function."""
641
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/comfyui_to_python_utils.py DELETED
@@ -1,106 +0,0 @@
1
- import os
2
- from typing import Sequence, Mapping, Any, Union
3
- import sys
4
-
5
-
6
- def import_custom_nodes() -> None:
7
- """Find all custom nodes in the custom_nodes folder and add those node objects to NODE_CLASS_MAPPINGS
8
-
9
- This function sets up a new asyncio event loop, initializes the PromptServer,
10
- creates a PromptQueue, and initializes the custom nodes.
11
- """
12
- import asyncio
13
- import execution
14
- from nodes import init_extra_nodes
15
- import server
16
-
17
- # Creating a new event loop and setting it as the default loop
18
- loop = asyncio.new_event_loop()
19
- asyncio.set_event_loop(loop)
20
-
21
- # Creating an instance of PromptServer with the loop
22
- server_instance = server.PromptServer(loop)
23
- execution.PromptQueue(server_instance)
24
-
25
- # Initializing custom nodes
26
- init_extra_nodes()
27
-
28
-
29
- def find_path(name: str, path: str = None) -> str:
30
- """
31
- Recursively looks at parent folders starting from the given path until it finds the given name.
32
- Returns the path as a Path object if found, or None otherwise.
33
- """
34
- # If no path is given, use the current working directory
35
- if path is None:
36
- path = os.getcwd()
37
-
38
- # Check if the current directory contains the name
39
- if name in os.listdir(path):
40
- path_name = os.path.join(path, name)
41
- print(f"{name} found: {path_name}")
42
- return path_name
43
-
44
- # Get the parent directory
45
- parent_directory = os.path.dirname(path)
46
-
47
- # If the parent directory is the same as the current directory, we've reached the root and stop the search
48
- if parent_directory == path:
49
- return None
50
-
51
- # Recursively call the function with the parent directory
52
- return find_path(name, parent_directory)
53
-
54
-
55
- def add_comfyui_directory_to_sys_path() -> None:
56
- """
57
- Add 'ComfyUI' to the sys.path
58
- """
59
- comfyui_path = find_path("ComfyUI")
60
- if comfyui_path is not None and os.path.isdir(comfyui_path):
61
- sys.path.append(comfyui_path)
62
- print(f"'{comfyui_path}' added to sys.path")
63
-
64
-
65
- def add_extra_model_paths() -> None:
66
- """
67
- Parse the optional extra_model_paths.yaml file and add the parsed paths to the sys.path.
68
- """
69
- try:
70
- from main import load_extra_path_config
71
- except ImportError:
72
- print(
73
- "Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
74
- )
75
- from utils.extra_config import load_extra_path_config
76
-
77
- extra_model_paths = find_path("extra_model_paths.yaml")
78
-
79
- if extra_model_paths is not None:
80
- load_extra_path_config(extra_model_paths)
81
- else:
82
- print("Could not find the extra_model_paths config file.")
83
-
84
-
85
- def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
86
- """Returns the value at the given index of a sequence or mapping.
87
-
88
- If the object is a sequence (like list or string), returns the value at the given index.
89
- If the object is a mapping (like a dictionary), returns the value at the index-th key.
90
-
91
- Some return a dictionary, in these cases, we look for the "results" key
92
-
93
- Args:
94
- obj (Union[Sequence, Mapping]): The object to retrieve the value from.
95
- index (int): The index of the value to retrieve.
96
-
97
- Returns:
98
- Any: The value at the given index.
99
-
100
- Raises:
101
- IndexError: If the index is out of bounds for the object and the object is not a mapping.
102
- """
103
- try:
104
- return obj[index]
105
- except KeyError:
106
- return obj["result"][index]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/images/SDXL-UI-Example.PNG DELETED
Binary file (838 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/images/SDXL-UI-Example.jpg DELETED
Binary file (37.2 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/images/comfyui_to_python_banner.png DELETED
Binary file (729 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/images/dev_mode_options.PNG DELETED
Binary file (90.7 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/images/dev_mode_options.jpg DELETED
Binary file (52.7 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/images/save_as_script.png DELETED
Binary file (58.9 kB)
 
custom_nodes/ComfyUI-to-Python-Extension/install.py DELETED
@@ -1,20 +0,0 @@
1
- import os
2
- import sys
3
-
4
- from subprocess import Popen, check_output, PIPE
5
-
6
- requirements = open(os.path.join(os.path.dirname(__file__), "requirements.txt")).read().split("\n")
7
-
8
- installed_packages = check_output(
9
- [sys.executable, "-m", "pip", "list"],
10
- universal_newlines=True
11
- ).split("\n")
12
-
13
- installed_packages = set([package.split(" ")[0].lower() for package in installed_packages if package.strip()])
14
-
15
- for requirement in requirements:
16
- if requirement.lower() not in installed_packages:
17
- print(f"Installing requirements...")
18
- Popen([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], stdout=PIPE, stderr=PIPE, cwd=os.path.dirname(__file__)).communicate()
19
- print(f"Installed.")
20
- break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/js/save-as-script.js DELETED
@@ -1,111 +0,0 @@
1
- import { app } from "../../scripts/app.js";
2
- import { api } from "../../scripts/api.js";
3
- import { $el } from "../../scripts/ui.js";
4
-
5
- app.registerExtension({
6
- name: "Comfy.SaveAsScript",
7
- init() {
8
- $el("style", {
9
- parent: document.head,
10
- });
11
- },
12
- async setup() {
13
- function savePythonScript() {
14
- var filename = prompt("Save script as:");
15
- if(filename === undefined || filename === null || filename === "") {
16
- return
17
- }
18
-
19
- app.graphToPrompt().then(async (p) => {
20
- const json = JSON.stringify({name: filename + ".json", workflow: JSON.stringify(p.output, null, 2)}, null, 2); // convert the data to a JSON string
21
- var response = await api.fetchApi(`/saveasscript`, { method: "POST", body: json });
22
- if(response.status == 200) {
23
- const blob = new Blob([await response.text()], {type: "text/python;charset=utf-8"});
24
- const url = URL.createObjectURL(blob);
25
- if(!filename.endsWith(".py")) {
26
- filename += ".py";
27
- }
28
-
29
- const a = $el("a", {
30
- href: url,
31
- download: filename,
32
- style: {display: "none"},
33
- parent: document.body,
34
- });
35
- a.click();
36
- setTimeout(function () {
37
- a.remove();
38
- window.URL.revokeObjectURL(url);
39
- }, 0);
40
- }
41
- });
42
- }
43
-
44
- const menu = document.querySelector(".comfy-menu");
45
- const separator = document.createElement("hr");
46
-
47
- separator.style.margin = "20px 0";
48
- separator.style.width = "100%";
49
- menu.append(separator);
50
-
51
- const saveButton = document.createElement("button");
52
- saveButton.textContent = "Save as Script";
53
- saveButton.onclick = () => savePythonScript();
54
- menu.append(saveButton);
55
-
56
-
57
- // Also load to new style menu
58
- const dropdownMenu = document.querySelectorAll(".p-menubar-submenu ")[0];
59
- // Get submenu items
60
- const listItems = dropdownMenu.querySelectorAll("li");
61
- let newSetsize = listItems.length;
62
-
63
- const separatorMenu = document.createElement("li");
64
- separatorMenu.setAttribute("id", "pv_id_8_0_" + (newSetsize - 1).toString());
65
- separatorMenu.setAttribute("class", "p-menubar-separator");
66
- separatorMenu.setAttribute("role", "separator");
67
- separatorMenu.setAttribute("data-pc-section", "separator");
68
-
69
- dropdownMenu.append(separatorMenu);
70
-
71
- // Adjust list items within to increase setsize
72
- listItems.forEach((item) => {
73
- // First check if it's a separator
74
- if(item.getAttribute("data-pc-section") !== "separator") {
75
- item.setAttribute("aria-setsize", newSetsize);
76
- }
77
- });
78
-
79
- console.log(newSetsize);
80
-
81
- // Here's the format of list items
82
- const saveButtonText = document.createElement("li");
83
- saveButtonText.setAttribute("id", "pv_id_8_0_" + newSetsize.toString());
84
- saveButtonText.setAttribute("class", "p-menubar-item relative");
85
- saveButtonText.setAttribute("role", "menuitem");
86
- saveButtonText.setAttribute("aria-label", "Save as Script");
87
- saveButtonText.setAttribute("aria-level", "2");
88
- saveButtonText.setAttribute("aria-setsize", newSetsize.toString());
89
- saveButtonText.setAttribute("aria-posinset", newSetsize.toString());
90
- saveButtonText.setAttribute("data-pc-section", "item");
91
- saveButtonText.setAttribute("data-p-active", "false");
92
- saveButtonText.setAttribute("data-p-focused", "false");
93
-
94
- saveButtonText.innerHTML = `
95
- <div class="p-menubar-item-content" data-pc-section="itemcontent">
96
- <a class="p-menubar-item-link" tabindex="-1" aria-hidden="true" data-pc-section="itemlink" target="_blank">
97
- <span class="p-menubar-item-icon pi pi-book"></span>
98
- <span class="p-menubar-item-label">Save as Script</span>
99
- </a>
100
- </div>
101
- `
102
-
103
- saveButtonText.onclick = () => savePythonScript();
104
-
105
- dropdownMenu.append(saveButtonText);
106
-
107
-
108
-
109
- console.log("SaveAsScript loaded");
110
- }
111
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/pyproject.toml DELETED
@@ -1,15 +0,0 @@
1
- [project]
2
- name = "comfyui-to-python-extension"
3
- description = "This custom node allows you to generate pure python code from your ComfyUI workflow with the click of a button. Great for rapid experimentation or production deployment."
4
- version = "1.3.0"
5
- license = "LICENSE"
6
- dependencies = ["black"]
7
-
8
- [project.urls]
9
- Repository = "https://github.com/pydn/ComfyUI-to-Python-Extension"
10
- # Used by Comfy Registry https://comfyregistry.org
11
-
12
- [tool.comfy]
13
- PublisherId = "pydn"
14
- DisplayName = "ComfyUI-to-Python-Extension"
15
- Icon = ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/ComfyUI-to-Python-Extension/requirements.txt DELETED
@@ -1 +0,0 @@
1
- black
 
 
custom_nodes/comfyui-manager/.cache/.cache_directory DELETED
File without changes
custom_nodes/comfyui-manager/.github/workflows/publish.yml DELETED
@@ -1,21 +0,0 @@
1
- name: Publish to Comfy registry
2
- on:
3
- workflow_dispatch:
4
- push:
5
- branches:
6
- - main-blocked
7
- paths:
8
- - "pyproject.toml"
9
-
10
- jobs:
11
- publish-node:
12
- name: Publish Custom Node to registry
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Check out code
16
- uses: actions/checkout@v4
17
- - name: Publish Custom Node
18
- uses: Comfy-Org/publish-node-action@main
19
- with:
20
- ## Add your own personal access token to your Github Repository secrets and reference it here.
21
- personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/.github/workflows/ruff.yml DELETED
@@ -1,23 +0,0 @@
1
- name: Python Linting
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- ruff:
7
- name: Run Ruff
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - name: Checkout repository
12
- uses: actions/checkout@v4
13
-
14
- - name: Set up Python
15
- uses: actions/setup-python@v2
16
- with:
17
- python-version: 3.x
18
-
19
- - name: Install Ruff
20
- run: pip install ruff
21
-
22
- - name: Run Ruff
23
- run: ruff check .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- __pycache__/
2
- .idea/
3
- .vscode/
4
- .history/
5
- *.code-workspace
6
- .tmp
7
- .cache
8
- config.ini
9
- snapshots/**
10
- startup-scripts/**
11
- .openart_key
12
- .youml
13
- matrix_auth
14
- channels.list
15
- comfyworkflows_sharekey
16
- github-stats-cache.json
17
- pip_overrides.json
18
- *.json
19
- check2.sh
20
- /venv/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/LICENSE.txt DELETED
@@ -1,674 +0,0 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
- Preamble
9
-
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
12
-
13
- The licenses for most software and other practical works are designed
14
- to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
- share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
21
-
22
- When we speak of free software, we are referring to freedom, not
23
- price. Our General Public Licenses are designed to make sure that you
24
- have the freedom to distribute copies of free software (and charge for
25
- them if you wish), that you receive source code or can get it if you
26
- want it, that you can change the software or use pieces of it in new
27
- free programs, and that you know you can do these things.
28
-
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
67
-
68
- The precise terms and conditions for copying, distribution and
69
- modification follow.
70
-
71
- TERMS AND CONDITIONS
72
-
73
- 0. Definitions.
74
-
75
- "This License" refers to version 3 of the GNU General Public License.
76
-
77
- "Copyright" also means copyright-like laws that apply to other kinds of
78
- works, such as semiconductor masks.
79
-
80
- "The Program" refers to any copyrightable work licensed under this
81
- License. Each licensee is addressed as "you". "Licensees" and
82
- "recipients" may be individuals or organizations.
83
-
84
- To "modify" a work means to copy from or adapt all or part of the work
85
- in a fashion requiring copyright permission, other than the making of an
86
- exact copy. The resulting work is called a "modified version" of the
87
- earlier work or a work "based on" the earlier work.
88
-
89
- A "covered work" means either the unmodified Program or a work based
90
- on the Program.
91
-
92
- To "propagate" a work means to do anything with it that, without
93
- permission, would make you directly or secondarily liable for
94
- infringement under applicable copyright law, except executing it on a
95
- computer or modifying a private copy. Propagation includes copying,
96
- distribution (with or without modification), making available to the
97
- public, and in some countries other activities as well.
98
-
99
- To "convey" a work means any kind of propagation that enables other
100
- parties to make or receive copies. Mere interaction with a user through
101
- a computer network, with no transfer of a copy, is not conveying.
102
-
103
- An interactive user interface displays "Appropriate Legal Notices"
104
- to the extent that it includes a convenient and prominently visible
105
- feature that (1) displays an appropriate copyright notice, and (2)
106
- tells the user that there is no warranty for the work (except to the
107
- extent that warranties are provided), that licensees may convey the
108
- work under this License, and how to view a copy of this License. If
109
- the interface presents a list of user commands or options, such as a
110
- menu, a prominent item in the list meets this criterion.
111
-
112
- 1. Source Code.
113
-
114
- The "source code" for a work means the preferred form of the work
115
- for making modifications to it. "Object code" means any non-source
116
- form of a work.
117
-
118
- A "Standard Interface" means an interface that either is an official
119
- standard defined by a recognized standards body, or, in the case of
120
- interfaces specified for a particular programming language, one that
121
- is widely used among developers working in that language.
122
-
123
- The "System Libraries" of an executable work include anything, other
124
- than the work as a whole, that (a) is included in the normal form of
125
- packaging a Major Component, but which is not part of that Major
126
- Component, and (b) serves only to enable use of the work with that
127
- Major Component, or to implement a Standard Interface for which an
128
- implementation is available to the public in source code form. A
129
- "Major Component", in this context, means a major essential component
130
- (kernel, window system, and so on) of the specific operating system
131
- (if any) on which the executable work runs, or a compiler used to
132
- produce the work, or an object code interpreter used to run it.
133
-
134
- The "Corresponding Source" for a work in object code form means all
135
- the source code needed to generate, install, and (for an executable
136
- work) run the object code and to modify the work, including scripts to
137
- control those activities. However, it does not include the work's
138
- System Libraries, or general-purpose tools or generally available free
139
- programs which are used unmodified in performing those activities but
140
- which are not part of the work. For example, Corresponding Source
141
- includes interface definition files associated with source files for
142
- the work, and the source code for shared libraries and dynamically
143
- linked subprograms that the work is specifically designed to require,
144
- such as by intimate data communication or control flow between those
145
- subprograms and other parts of the work.
146
-
147
- The Corresponding Source need not include anything that users
148
- can regenerate automatically from other parts of the Corresponding
149
- Source.
150
-
151
- The Corresponding Source for a work in source code form is that
152
- same work.
153
-
154
- 2. Basic Permissions.
155
-
156
- All rights granted under this License are granted for the term of
157
- copyright on the Program, and are irrevocable provided the stated
158
- conditions are met. This License explicitly affirms your unlimited
159
- permission to run the unmodified Program. The output from running a
160
- covered work is covered by this License only if the output, given its
161
- content, constitutes a covered work. This License acknowledges your
162
- rights of fair use or other equivalent, as provided by copyright law.
163
-
164
- You may make, run and propagate covered works that you do not
165
- convey, without conditions so long as your license otherwise remains
166
- in force. You may convey covered works to others for the sole purpose
167
- of having them make modifications exclusively for you, or provide you
168
- with facilities for running those works, provided that you comply with
169
- the terms of this License in conveying all material for which you do
170
- not control copyright. Those thus making or running the covered works
171
- for you must do so exclusively on your behalf, under your direction
172
- and control, on terms that prohibit them from making any copies of
173
- your copyrighted material outside their relationship with you.
174
-
175
- Conveying under any other circumstances is permitted solely under
176
- the conditions stated below. Sublicensing is not allowed; section 10
177
- makes it unnecessary.
178
-
179
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
-
181
- No covered work shall be deemed part of an effective technological
182
- measure under any applicable law fulfilling obligations under article
183
- 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
- similar laws prohibiting or restricting circumvention of such
185
- measures.
186
-
187
- When you convey a covered work, you waive any legal power to forbid
188
- circumvention of technological measures to the extent such circumvention
189
- is effected by exercising rights under this License with respect to
190
- the covered work, and you disclaim any intention to limit operation or
191
- modification of the work as a means of enforcing, against the work's
192
- users, your or third parties' legal rights to forbid circumvention of
193
- technological measures.
194
-
195
- 4. Conveying Verbatim Copies.
196
-
197
- You may convey verbatim copies of the Program's source code as you
198
- receive it, in any medium, provided that you conspicuously and
199
- appropriately publish on each copy an appropriate copyright notice;
200
- keep intact all notices stating that this License and any
201
- non-permissive terms added in accord with section 7 apply to the code;
202
- keep intact all notices of the absence of any warranty; and give all
203
- recipients a copy of this License along with the Program.
204
-
205
- You may charge any price or no price for each copy that you convey,
206
- and you may offer support or warranty protection for a fee.
207
-
208
- 5. Conveying Modified Source Versions.
209
-
210
- You may convey a work based on the Program, or the modifications to
211
- produce it from the Program, in the form of source code under the
212
- terms of section 4, provided that you also meet all of these conditions:
213
-
214
- a) The work must carry prominent notices stating that you modified
215
- it, and giving a relevant date.
216
-
217
- b) The work must carry prominent notices stating that it is
218
- released under this License and any conditions added under section
219
- 7. This requirement modifies the requirement in section 4 to
220
- "keep intact all notices".
221
-
222
- c) You must license the entire work, as a whole, under this
223
- License to anyone who comes into possession of a copy. This
224
- License will therefore apply, along with any applicable section 7
225
- additional terms, to the whole of the work, and all its parts,
226
- regardless of how they are packaged. This License gives no
227
- permission to license the work in any other way, but it does not
228
- invalidate such permission if you have separately received it.
229
-
230
- d) If the work has interactive user interfaces, each must display
231
- Appropriate Legal Notices; however, if the Program has interactive
232
- interfaces that do not display Appropriate Legal Notices, your
233
- work need not make them do so.
234
-
235
- A compilation of a covered work with other separate and independent
236
- works, which are not by their nature extensions of the covered work,
237
- and which are not combined with it such as to form a larger program,
238
- in or on a volume of a storage or distribution medium, is called an
239
- "aggregate" if the compilation and its resulting copyright are not
240
- used to limit the access or legal rights of the compilation's users
241
- beyond what the individual works permit. Inclusion of a covered work
242
- in an aggregate does not cause this License to apply to the other
243
- parts of the aggregate.
244
-
245
- 6. Conveying Non-Source Forms.
246
-
247
- You may convey a covered work in object code form under the terms
248
- of sections 4 and 5, provided that you also convey the
249
- machine-readable Corresponding Source under the terms of this License,
250
- in one of these ways:
251
-
252
- a) Convey the object code in, or embodied in, a physical product
253
- (including a physical distribution medium), accompanied by the
254
- Corresponding Source fixed on a durable physical medium
255
- customarily used for software interchange.
256
-
257
- b) Convey the object code in, or embodied in, a physical product
258
- (including a physical distribution medium), accompanied by a
259
- written offer, valid for at least three years and valid for as
260
- long as you offer spare parts or customer support for that product
261
- model, to give anyone who possesses the object code either (1) a
262
- copy of the Corresponding Source for all the software in the
263
- product that is covered by this License, on a durable physical
264
- medium customarily used for software interchange, for a price no
265
- more than your reasonable cost of physically performing this
266
- conveying of source, or (2) access to copy the
267
- Corresponding Source from a network server at no charge.
268
-
269
- c) Convey individual copies of the object code with a copy of the
270
- written offer to provide the Corresponding Source. This
271
- alternative is allowed only occasionally and noncommercially, and
272
- only if you received the object code with such an offer, in accord
273
- with subsection 6b.
274
-
275
- d) Convey the object code by offering access from a designated
276
- place (gratis or for a charge), and offer equivalent access to the
277
- Corresponding Source in the same way through the same place at no
278
- further charge. You need not require recipients to copy the
279
- Corresponding Source along with the object code. If the place to
280
- copy the object code is a network server, the Corresponding Source
281
- may be on a different server (operated by you or a third party)
282
- that supports equivalent copying facilities, provided you maintain
283
- clear directions next to the object code saying where to find the
284
- Corresponding Source. Regardless of what server hosts the
285
- Corresponding Source, you remain obligated to ensure that it is
286
- available for as long as needed to satisfy these requirements.
287
-
288
- e) Convey the object code using peer-to-peer transmission, provided
289
- you inform other peers where the object code and Corresponding
290
- Source of the work are being offered to the general public at no
291
- charge under subsection 6d.
292
-
293
- A separable portion of the object code, whose source code is excluded
294
- from the Corresponding Source as a System Library, need not be
295
- included in conveying the object code work.
296
-
297
- A "User Product" is either (1) a "consumer product", which means any
298
- tangible personal property which is normally used for personal, family,
299
- or household purposes, or (2) anything designed or sold for incorporation
300
- into a dwelling. In determining whether a product is a consumer product,
301
- doubtful cases shall be resolved in favor of coverage. For a particular
302
- product received by a particular user, "normally used" refers to a
303
- typical or common use of that class of product, regardless of the status
304
- of the particular user or of the way in which the particular user
305
- actually uses, or expects or is expected to use, the product. A product
306
- is a consumer product regardless of whether the product has substantial
307
- commercial, industrial or non-consumer uses, unless such uses represent
308
- the only significant mode of use of the product.
309
-
310
- "Installation Information" for a User Product means any methods,
311
- procedures, authorization keys, or other information required to install
312
- and execute modified versions of a covered work in that User Product from
313
- a modified version of its Corresponding Source. The information must
314
- suffice to ensure that the continued functioning of the modified object
315
- code is in no case prevented or interfered with solely because
316
- modification has been made.
317
-
318
- If you convey an object code work under this section in, or with, or
319
- specifically for use in, a User Product, and the conveying occurs as
320
- part of a transaction in which the right of possession and use of the
321
- User Product is transferred to the recipient in perpetuity or for a
322
- fixed term (regardless of how the transaction is characterized), the
323
- Corresponding Source conveyed under this section must be accompanied
324
- by the Installation Information. But this requirement does not apply
325
- if neither you nor any third party retains the ability to install
326
- modified object code on the User Product (for example, the work has
327
- been installed in ROM).
328
-
329
- The requirement to provide Installation Information does not include a
330
- requirement to continue to provide support service, warranty, or updates
331
- for a work that has been modified or installed by the recipient, or for
332
- the User Product in which it has been modified or installed. Access to a
333
- network may be denied when the modification itself materially and
334
- adversely affects the operation of the network or violates the rules and
335
- protocols for communication across the network.
336
-
337
- Corresponding Source conveyed, and Installation Information provided,
338
- in accord with this section must be in a format that is publicly
339
- documented (and with an implementation available to the public in
340
- source code form), and must require no special password or key for
341
- unpacking, reading or copying.
342
-
343
- 7. Additional Terms.
344
-
345
- "Additional permissions" are terms that supplement the terms of this
346
- License by making exceptions from one or more of its conditions.
347
- Additional permissions that are applicable to the entire Program shall
348
- be treated as though they were included in this License, to the extent
349
- that they are valid under applicable law. If additional permissions
350
- apply only to part of the Program, that part may be used separately
351
- under those permissions, but the entire Program remains governed by
352
- this License without regard to the additional permissions.
353
-
354
- When you convey a copy of a covered work, you may at your option
355
- remove any additional permissions from that copy, or from any part of
356
- it. (Additional permissions may be written to require their own
357
- removal in certain cases when you modify the work.) You may place
358
- additional permissions on material, added by you to a covered work,
359
- for which you have or can give appropriate copyright permission.
360
-
361
- Notwithstanding any other provision of this License, for material you
362
- add to a covered work, you may (if authorized by the copyright holders of
363
- that material) supplement the terms of this License with terms:
364
-
365
- a) Disclaiming warranty or limiting liability differently from the
366
- terms of sections 15 and 16 of this License; or
367
-
368
- b) Requiring preservation of specified reasonable legal notices or
369
- author attributions in that material or in the Appropriate Legal
370
- Notices displayed by works containing it; or
371
-
372
- c) Prohibiting misrepresentation of the origin of that material, or
373
- requiring that modified versions of such material be marked in
374
- reasonable ways as different from the original version; or
375
-
376
- d) Limiting the use for publicity purposes of names of licensors or
377
- authors of the material; or
378
-
379
- e) Declining to grant rights under trademark law for use of some
380
- trade names, trademarks, or service marks; or
381
-
382
- f) Requiring indemnification of licensors and authors of that
383
- material by anyone who conveys the material (or modified versions of
384
- it) with contractual assumptions of liability to the recipient, for
385
- any liability that these contractual assumptions directly impose on
386
- those licensors and authors.
387
-
388
- All other non-permissive additional terms are considered "further
389
- restrictions" within the meaning of section 10. If the Program as you
390
- received it, or any part of it, contains a notice stating that it is
391
- governed by this License along with a term that is a further
392
- restriction, you may remove that term. If a license document contains
393
- a further restriction but permits relicensing or conveying under this
394
- License, you may add to a covered work material governed by the terms
395
- of that license document, provided that the further restriction does
396
- not survive such relicensing or conveying.
397
-
398
- If you add terms to a covered work in accord with this section, you
399
- must place, in the relevant source files, a statement of the
400
- additional terms that apply to those files, or a notice indicating
401
- where to find the applicable terms.
402
-
403
- Additional terms, permissive or non-permissive, may be stated in the
404
- form of a separately written license, or stated as exceptions;
405
- the above requirements apply either way.
406
-
407
- 8. Termination.
408
-
409
- You may not propagate or modify a covered work except as expressly
410
- provided under this License. Any attempt otherwise to propagate or
411
- modify it is void, and will automatically terminate your rights under
412
- this License (including any patent licenses granted under the third
413
- paragraph of section 11).
414
-
415
- However, if you cease all violation of this License, then your
416
- license from a particular copyright holder is reinstated (a)
417
- provisionally, unless and until the copyright holder explicitly and
418
- finally terminates your license, and (b) permanently, if the copyright
419
- holder fails to notify you of the violation by some reasonable means
420
- prior to 60 days after the cessation.
421
-
422
- Moreover, your license from a particular copyright holder is
423
- reinstated permanently if the copyright holder notifies you of the
424
- violation by some reasonable means, this is the first time you have
425
- received notice of violation of this License (for any work) from that
426
- copyright holder, and you cure the violation prior to 30 days after
427
- your receipt of the notice.
428
-
429
- Termination of your rights under this section does not terminate the
430
- licenses of parties who have received copies or rights from you under
431
- this License. If your rights have been terminated and not permanently
432
- reinstated, you do not qualify to receive new licenses for the same
433
- material under section 10.
434
-
435
- 9. Acceptance Not Required for Having Copies.
436
-
437
- You are not required to accept this License in order to receive or
438
- run a copy of the Program. Ancillary propagation of a covered work
439
- occurring solely as a consequence of using peer-to-peer transmission
440
- to receive a copy likewise does not require acceptance. However,
441
- nothing other than this License grants you permission to propagate or
442
- modify any covered work. These actions infringe copyright if you do
443
- not accept this License. Therefore, by modifying or propagating a
444
- covered work, you indicate your acceptance of this License to do so.
445
-
446
- 10. Automatic Licensing of Downstream Recipients.
447
-
448
- Each time you convey a covered work, the recipient automatically
449
- receives a license from the original licensors, to run, modify and
450
- propagate that work, subject to this License. You are not responsible
451
- for enforcing compliance by third parties with this License.
452
-
453
- An "entity transaction" is a transaction transferring control of an
454
- organization, or substantially all assets of one, or subdividing an
455
- organization, or merging organizations. If propagation of a covered
456
- work results from an entity transaction, each party to that
457
- transaction who receives a copy of the work also receives whatever
458
- licenses to the work the party's predecessor in interest had or could
459
- give under the previous paragraph, plus a right to possession of the
460
- Corresponding Source of the work from the predecessor in interest, if
461
- the predecessor has it or can get it with reasonable efforts.
462
-
463
- You may not impose any further restrictions on the exercise of the
464
- rights granted or affirmed under this License. For example, you may
465
- not impose a license fee, royalty, or other charge for exercise of
466
- rights granted under this License, and you may not initiate litigation
467
- (including a cross-claim or counterclaim in a lawsuit) alleging that
468
- any patent claim is infringed by making, using, selling, offering for
469
- sale, or importing the Program or any portion of it.
470
-
471
- 11. Patents.
472
-
473
- A "contributor" is a copyright holder who authorizes use under this
474
- License of the Program or a work on which the Program is based. The
475
- work thus licensed is called the contributor's "contributor version".
476
-
477
- A contributor's "essential patent claims" are all patent claims
478
- owned or controlled by the contributor, whether already acquired or
479
- hereafter acquired, that would be infringed by some manner, permitted
480
- by this License, of making, using, or selling its contributor version,
481
- but do not include claims that would be infringed only as a
482
- consequence of further modification of the contributor version. For
483
- purposes of this definition, "control" includes the right to grant
484
- patent sublicenses in a manner consistent with the requirements of
485
- this License.
486
-
487
- Each contributor grants you a non-exclusive, worldwide, royalty-free
488
- patent license under the contributor's essential patent claims, to
489
- make, use, sell, offer for sale, import and otherwise run, modify and
490
- propagate the contents of its contributor version.
491
-
492
- In the following three paragraphs, a "patent license" is any express
493
- agreement or commitment, however denominated, not to enforce a patent
494
- (such as an express permission to practice a patent or covenant not to
495
- sue for patent infringement). To "grant" such a patent license to a
496
- party means to make such an agreement or commitment not to enforce a
497
- patent against the party.
498
-
499
- If you convey a covered work, knowingly relying on a patent license,
500
- and the Corresponding Source of the work is not available for anyone
501
- to copy, free of charge and under the terms of this License, through a
502
- publicly available network server or other readily accessible means,
503
- then you must either (1) cause the Corresponding Source to be so
504
- available, or (2) arrange to deprive yourself of the benefit of the
505
- patent license for this particular work, or (3) arrange, in a manner
506
- consistent with the requirements of this License, to extend the patent
507
- license to downstream recipients. "Knowingly relying" means you have
508
- actual knowledge that, but for the patent license, your conveying the
509
- covered work in a country, or your recipient's use of the covered work
510
- in a country, would infringe one or more identifiable patents in that
511
- country that you have reason to believe are valid.
512
-
513
- If, pursuant to or in connection with a single transaction or
514
- arrangement, you convey, or propagate by procuring conveyance of, a
515
- covered work, and grant a patent license to some of the parties
516
- receiving the covered work authorizing them to use, propagate, modify
517
- or convey a specific copy of the covered work, then the patent license
518
- you grant is automatically extended to all recipients of the covered
519
- work and works based on it.
520
-
521
- A patent license is "discriminatory" if it does not include within
522
- the scope of its coverage, prohibits the exercise of, or is
523
- conditioned on the non-exercise of one or more of the rights that are
524
- specifically granted under this License. You may not convey a covered
525
- work if you are a party to an arrangement with a third party that is
526
- in the business of distributing software, under which you make payment
527
- to the third party based on the extent of your activity of conveying
528
- the work, and under which the third party grants, to any of the
529
- parties who would receive the covered work from you, a discriminatory
530
- patent license (a) in connection with copies of the covered work
531
- conveyed by you (or copies made from those copies), or (b) primarily
532
- for and in connection with specific products or compilations that
533
- contain the covered work, unless you entered into that arrangement,
534
- or that patent license was granted, prior to 28 March 2007.
535
-
536
- Nothing in this License shall be construed as excluding or limiting
537
- any implied license or other defenses to infringement that may
538
- otherwise be available to you under applicable patent law.
539
-
540
- 12. No Surrender of Others' Freedom.
541
-
542
- If conditions are imposed on you (whether by court order, agreement or
543
- otherwise) that contradict the conditions of this License, they do not
544
- excuse you from the conditions of this License. If you cannot convey a
545
- covered work so as to satisfy simultaneously your obligations under this
546
- License and any other pertinent obligations, then as a consequence you may
547
- not convey it at all. For example, if you agree to terms that obligate you
548
- to collect a royalty for further conveying from those to whom you convey
549
- the Program, the only way you could satisfy both those terms and this
550
- License would be to refrain entirely from conveying the Program.
551
-
552
- 13. Use with the GNU Affero General Public License.
553
-
554
- Notwithstanding any other provision of this License, you have
555
- permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
557
- combined work, and to convey the resulting work. The terms of this
558
- License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
562
-
563
- 14. Revised Versions of this License.
564
-
565
- The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
568
- address new problems or concerns.
569
-
570
- Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
572
- Public License "or any later version" applies to it, you have the
573
- option of following the terms and conditions either of that numbered
574
- version or of any later version published by the Free Software
575
- Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
577
- by the Free Software Foundation.
578
-
579
- If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
581
- public statement of acceptance of a version permanently authorizes you
582
- to choose that version for the Program.
583
-
584
- Later license versions may give you additional or different
585
- permissions. However, no additional obligations are imposed on any
586
- author or copyright holder as a result of your choosing to follow a
587
- later version.
588
-
589
- 15. Disclaimer of Warranty.
590
-
591
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
- APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
- HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
- OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
- PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
- IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
- ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
-
600
- 16. Limitation of Liability.
601
-
602
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
- THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
- USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
- DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
- PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
- EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
- SUCH DAMAGES.
611
-
612
- 17. Interpretation of Sections 15 and 16.
613
-
614
- If the disclaimer of warranty and limitation of liability provided
615
- above cannot be given local legal effect according to their terms,
616
- reviewing courts shall apply local law that most closely approximates
617
- an absolute waiver of all civil liability in connection with the
618
- Program, unless a warranty or assumption of liability accompanies a
619
- copy of the Program in return for a fee.
620
-
621
- END OF TERMS AND CONDITIONS
622
-
623
- How to Apply These Terms to Your New Programs
624
-
625
- If you develop a new program, and you want it to be of the greatest
626
- possible use to the public, the best way to achieve this is to make it
627
- free software which everyone can redistribute and change under these terms.
628
-
629
- To do so, attach the following notices to the program. It is safest
630
- to attach them to the start of each source file to most effectively
631
- state the exclusion of warranty; and each file should have at least
632
- the "copyright" line and a pointer to where the full notice is found.
633
-
634
- <one line to give the program's name and a brief idea of what it does.>
635
- Copyright (C) <year> <name of author>
636
-
637
- This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
640
- (at your option) any later version.
641
-
642
- This program is distributed in the hope that it will be useful,
643
- but WITHOUT ANY WARRANTY; without even the implied warranty of
644
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
646
-
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <https://www.gnu.org/licenses/>.
649
-
650
- Also add information on how to contact you by electronic and paper mail.
651
-
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- <program> Copyright (C) <year> <name of author>
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
663
-
664
- You should also get your employer (if you work as a programmer) or school,
665
- if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <https://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <https://www.gnu.org/licenses/why-not-lgpl.html>.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/README.md DELETED
@@ -1,340 +0,0 @@
1
- # ComfyUI Manager
2
-
3
- **ComfyUI-Manager** is an extension designed to enhance the usability of [ComfyUI](https://github.com/comfyanonymous/ComfyUI). It offers management functions to **install, remove, disable, and enable** various custom nodes of ComfyUI. Furthermore, this extension provides a hub feature and convenience functions to access a wide range of information within ComfyUI.
4
-
5
- ![menu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/dialog.jpg)
6
-
7
- ## NOTICE
8
- * V3.3.2: Overhauled. Officially supports [https://comfyregistry.org/](https://comfyregistry.org/).
9
- * You can see whole nodes info on [ComfyUI Nodes Info](https://ltdrdata.github.io/) page.
10
-
11
- ## Installation
12
-
13
- ### Installation[method1] (General installation method: ComfyUI-Manager only)
14
-
15
- To install ComfyUI-Manager in addition to an existing installation of ComfyUI, you can follow the following steps:
16
-
17
- 1. goto `ComfyUI/custom_nodes` dir in terminal(cmd)
18
- 2. `git clone https://github.com/ltdrdata/ComfyUI-Manager comfyui-manager`
19
- 3. Restart ComfyUI
20
-
21
-
22
- ### Installation[method2] (Installation for portable ComfyUI version: ComfyUI-Manager only)
23
- 1. install git
24
- - https://git-scm.com/download/win
25
- - standalone version
26
- - select option: use windows default console window
27
- 2. Download [scripts/install-manager-for-portable-version.bat](https://github.com/ltdrdata/ComfyUI-Manager/raw/main/scripts/install-manager-for-portable-version.bat) into installed `"ComfyUI_windows_portable"` directory
28
- - Don't click. Right click the link and use save as...
29
- 3. double click `install-manager-for-portable-version.bat` batch file
30
-
31
- ![portable-install](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/portable-install.jpg)
32
-
33
-
34
- ### Installation[method3] (Installation through comfy-cli: install ComfyUI and ComfyUI-Manager at once.)
35
- > RECOMMENDED: comfy-cli provides various features to manage ComfyUI from the CLI.
36
-
37
- * **prerequisite: python 3, git**
38
-
39
- Windows:
40
- ```commandline
41
- python -m venv venv
42
- venv\Scripts\activate
43
- pip install comfy-cli
44
- comfy install
45
- ```
46
-
47
- Linux/OSX:
48
- ```commandline
49
- python -m venv venv
50
- . venv/bin/activate
51
- pip install comfy-cli
52
- comfy install
53
- ```
54
- * See also: https://github.com/Comfy-Org/comfy-cli
55
-
56
-
57
- ### Installation[method4] (Installation for linux+venv: ComfyUI + ComfyUI-Manager)
58
-
59
- To install ComfyUI with ComfyUI-Manager on Linux using a venv environment, you can follow these steps:
60
- * **prerequisite: python-is-python3, python3-venv, git**
61
-
62
- 1. Download [scripts/install-comfyui-venv-linux.sh](https://github.com/ltdrdata/ComfyUI-Manager/raw/main/scripts/install-comfyui-venv-linux.sh) into empty install directory
63
- - Don't click. Right click the link and use save as...
64
- - ComfyUI will be installed in the subdirectory of the specified directory, and the directory will contain the generated executable script.
65
- 2. `chmod +x install-comfyui-venv-linux.sh`
66
- 3. `./install-comfyui-venv-linux.sh`
67
-
68
- ### Installation Precautions
69
- * **DO**: `ComfyUI-Manager` files must be accurately located in the path `ComfyUI/custom_nodes/comfyui-manager`
70
- * Installing in a compressed file format is not recommended.
71
- * **DON'T**: Decompress directly into the `ComfyUI/custom_nodes` location, resulting in the Manager contents like `__init__.py` being placed directly in that directory.
72
- * You have to remove all ComfyUI-Manager files from `ComfyUI/custom_nodes`
73
- * **DON'T**: In a form where decompression occurs in a path such as `ComfyUI/custom_nodes/ComfyUI-Manager/ComfyUI-Manager`.
74
- * **DON'T**: In a form where decompression occurs in a path such as `ComfyUI/custom_nodes/ComfyUI-Manager-main`.
75
- * In such cases, `ComfyUI-Manager` may operate, but it won't be recognized within `ComfyUI-Manager`, and updates cannot be performed. It also poses the risk of duplicate installations. Remove it and install properly via `git clone` method.
76
-
77
-
78
- You can execute ComfyUI by running either `./run_gpu.sh` or `./run_cpu.sh` depending on your system configuration.
79
-
80
- ## Colab Notebook
81
- This repository provides Colab notebooks that allow you to install and use ComfyUI, including ComfyUI-Manager. To use ComfyUI, [click on this link](https://colab.research.google.com/github/ltdrdata/ComfyUI-Manager/blob/main/notebooks/comfyui_colab_with_manager.ipynb).
82
- * Support for installing ComfyUI
83
- * Support for basic installation of ComfyUI-Manager
84
- * Support for automatically installing dependencies of custom nodes upon restarting Colab notebooks.
85
-
86
-
87
- ## How To Use
88
-
89
- 1. Click "Manager" button on main menu
90
-
91
- ![mainmenu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/topbar.jpg)
92
-
93
-
94
- 2. If you click on 'Install Custom Nodes' or 'Install Models', an installer dialog will open.
95
-
96
- ![menu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/dialog.jpg)
97
-
98
- * There are three DB modes: `DB: Channel (1day cache)`, `DB: Local`, and `DB: Channel (remote)`.
99
- * `Channel (1day cache)` utilizes Channel cache information with a validity period of one day to quickly display the list.
100
- * This information will be updated when there is no cache, when the cache expires, or when external information is retrieved through the Channel (remote).
101
- * Whenever you start ComfyUI anew, this mode is always set as the **default** mode.
102
- * `Local` uses information stored locally in ComfyUI-Manager.
103
- * This information will be updated only when you update ComfyUI-Manager.
104
- * For custom node developers, they should use this mode when registering their nodes in `custom-node-list.json` and testing them.
105
- * `Channel (remote)` retrieves information from the remote channel, always displaying the latest list.
106
- * In cases where retrieval is not possible due to network errors, it will forcibly use local information.
107
-
108
- * The ```Fetch Updates``` menu retrieves update data for custom nodes locally. Actual updates are applied by clicking the ```Update``` button in the ```Install Custom Nodes``` menu.
109
-
110
- 3. Click 'Install' or 'Try Install' button.
111
-
112
- ![node-install-dialog](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/custom-nodes.jpg)
113
-
114
- ![model-install-dialog](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/models.jpg)
115
-
116
- * Installed: This item is already installed.
117
- * Install: Clicking this button will install the item.
118
- * Try Install: This is a custom node of which installation information cannot be confirmed. Click the button to try installing it.
119
-
120
- * If a red background `Channel` indicator appears at the top, it means it is not the default channel. Since the amount of information held is different from the default channel, many custom nodes may not appear in this channel state.
121
- * Channel settings have a broad impact, affecting not only the node list but also all functions like "Update all."
122
- * Conflicted Nodes with a yellow background show a list of nodes conflicting with other extensions in the respective extension. This issue needs to be addressed by the developer, and users should be aware that due to these conflicts, some nodes may not function correctly and may need to be installed accordingly.
123
-
124
- 4. Share
125
- ![menu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/topbar.jpg) ![share](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/share.jpg)
126
-
127
- * You can share the workflow by clicking the Share button at the bottom of the main menu or selecting Share Output from the Context Menu of the Image node.
128
- * Currently, it supports sharing via [https://comfyworkflows.com/](https://comfyworkflows.com/),
129
- [https://openart.ai](https://openart.ai/workflows/dev), [https://youml.com](https://youml.com)
130
- as well as through the Matrix channel.
131
-
132
- ![menu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/share-setting.jpg)
133
-
134
- * Through the Share settings in the Manager menu, you can configure the behavior of the Share button in the Main menu or Share Output button on Context Menu.
135
- * `None`: hide from Main menu
136
- * `All`: Show a dialog where the user can select a title for sharing.
137
-
138
-
139
- ## Paths
140
- In `ComfyUI-Manager` V3.0 and later, configuration files and dynamically generated files are located under `<USER_DIRECTORY>/default/ComfyUI-Manager/`.
141
-
142
- * <USER_DIRECTORY>
143
- * If executed without any options, the path defaults to ComfyUI/user.
144
- * It can be set using --user-directory <USER_DIRECTORY>.
145
-
146
- * Basic config files: `<USER_DIRECTORY>/default/ComfyUI-Manager/config.ini`
147
- * Configurable channel lists: `<USER_DIRECTORY>/default/ComfyUI-Manager/channels.ini`
148
- * Configurable pip overrides: `<USER_DIRECTORY>/default/ComfyUI-Manager/pip_overrides.json`
149
- * Saved snapshot files: `<USER_DIRECTORY>/default/ComfyUI-Manager/snapshots`
150
- * Startup script files: `<USER_DIRECTORY>/default/ComfyUI-Manager/startup-scripts`
151
- * Component files: `<USER_DIRECTORY>/default/ComfyUI-Manager/components`
152
-
153
-
154
- ## `extra_model_paths.yaml` Configuration
155
- The following settings are applied based on the section marked as `is_default`.
156
-
157
- * `custom_nodes`: Path for installing custom nodes
158
- * Importing does not need to adhere to the path set as `is_default`, but this is the path where custom nodes are installed by the `ComfyUI Nodes Manager`.
159
- * `download_model_base`: Path for downloading models
160
-
161
-
162
- ## Snapshot-Manager
163
- * When you press `Save snapshot` or use `Update All` on `Manager Menu`, the current installation status snapshot is saved.
164
- * Snapshot file dir: `<USER_DIRECTORY>/default/ComfyUI-Manager/snapshots`
165
- * You can rename snapshot file.
166
- * Press the "Restore" button to revert to the installation status of the respective snapshot.
167
- * However, for custom nodes not managed by Git, snapshot support is incomplete.
168
- * When you press `Restore`, it will take effect on the next ComfyUI startup.
169
- * The selected snapshot file is saved in `<USER_DIRECTORY>/default/ComfyUI-Manager/startup-scripts/restore-snapshot.json`, and upon restarting ComfyUI, the snapshot is applied and then deleted.
170
-
171
- ![model-install-dialog](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/snapshot.jpg)
172
-
173
-
174
- ## cm-cli: command line tools for power user
175
- * A tool is provided that allows you to use the features of ComfyUI-Manager without running ComfyUI.
176
- * For more details, please refer to the [cm-cli documentation](docs/en/cm-cli.md).
177
-
178
-
179
- ## How to register your custom node into ComfyUI-Manager
180
-
181
- * Add an entry to `custom-node-list.json` located in the root of ComfyUI-Manager and submit a Pull Request.
182
- * NOTE: Before submitting the PR after making changes, please check `Use local DB` and ensure that the extension list loads without any issues in the `Install custom nodes` dialog. Occasionally, missing or extra commas can lead to JSON syntax errors.
183
- * The remaining JSON will be updated through scripts in the future, so you don't need to worry about it.
184
-
185
-
186
- ## Custom node support guide
187
-
188
- * https://docs.comfy.org/registry/overview
189
-
190
-
191
- * **Special purpose files** (optional)
192
- * `node_list.json` - When your custom nodes pattern of NODE_CLASS_MAPPINGS is not conventional, it is used to manually provide a list of nodes for reference. ([example](https://github.com/melMass/comfy_mtb/raw/main/node_list.json))
193
- * `requirements.txt` - When installing, this pip requirements will be installed automatically
194
- * `install.py` - When installing, it is automatically called
195
- * `uninstall.py` - When uninstalling, it is automatically called
196
- * `disable.py` - When disabled, it is automatically called
197
- * When installing a custom node setup `.js` file, it is recommended to write this script for disabling.
198
- * `enable.py` - When enabled, it is automatically called
199
- * **All scripts are executed from the root path of the corresponding custom node.**
200
-
201
-
202
- ## Component Sharing
203
- * **Copy & Paste**
204
- * [Demo Page](https://ltdrdata.github.io/component-demo/)
205
- * When pasting a component from the clipboard, it supports text in the following JSON format. (text/plain)
206
- ```
207
- {
208
- "kind": "ComfyUI Components",
209
- "timestamp": <current timestamp>,
210
- "components":
211
- {
212
- <component name>: <component nodedata>
213
- }
214
- }
215
- ```
216
- * `<current timestamp>` Ensure that the timestamp is always unique.
217
- * "components" should have the same structure as the content of the file stored in `<USER_DIRECTORY>/default/ComfyUI-Manager/components`.
218
- * `<component name>`: The name should be in the format `<prefix>::<node name>`.
219
- * `<compnent nodeata>`: In the nodedata of the group node.
220
- * `<version>`: Only two formats are allowed: `major.minor.patch` or `major.minor`. (e.g. `1.0`, `2.2.1`)
221
- * `<datetime>`: Saved time
222
- * `<packname>`: If the packname is not empty, the category becomes packname/workflow, and it is saved in the <packname>.pack file in `<USER_DIRECTORY>/default/ComfyUI-Manager/components`.
223
- * `<category>`: If there is neither a category nor a packname, it is saved in the components category.
224
- ```
225
- "version":"1.0",
226
- "datetime": 1705390656516,
227
- "packname": "mypack",
228
- "category": "util/pipe",
229
- ```
230
- * **Drag & Drop**
231
- * Dragging and dropping a `.pack` or `.json` file will add the corresponding components.
232
- * Example pack: [Impact.pack](misc/Impact.pack)
233
-
234
- * Dragging and dropping or pasting a single component will add a node. However, when adding multiple components, nodes will not be added.
235
-
236
-
237
- ## Support of missing nodes installation
238
-
239
- ![missing-menu](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/missing-menu.jpg)
240
-
241
- * When you click on the ```Install Missing Custom Nodes``` button in the menu, it displays a list of extension nodes that contain nodes not currently present in the workflow.
242
-
243
- ![missing-list](https://raw.githubusercontent.com/ltdrdata/ComfyUI-extension-tutorials/Main/ComfyUI-Manager/images/missing-list.jpg)
244
-
245
-
246
- ## Additional Feature
247
- * Logging to file feature
248
- * This feature is enabled by default and can be disabled by setting `file_logging = False` in the `config.ini`.
249
-
250
- * Fix node(recreate): When right-clicking on a node and selecting `Fix node (recreate)`, you can recreate the node. The widget's values are reset, while the connections maintain those with the same names.
251
- * It is used to correct errors in nodes of old workflows created before, which are incompatible with the version changes of custom nodes.
252
-
253
- * Double-Click Node Title: You can set the double click behavior of nodes in the ComfyUI-Manager menu.
254
- * `Copy All Connections`, `Copy Input Connections`: Double-clicking a node copies the connections of the nearest node.
255
- * This action targets the nearest node within a straight-line distance of 1000 pixels from the center of the node.
256
- * In the case of `Copy All Connections`, it duplicates existing outputs, but since it does not allow duplicate connections, the existing output connections of the original node are disconnected.
257
- * This feature copies only the input and output that match the names.
258
-
259
- * `Possible Input Connections`: It connects all outputs that match the closest type within the specified range.
260
- * This connection links to the closest outputs among the nodes located on the left side of the target node.
261
-
262
- * `Possible(left) + Copy(right)`: When you Double-Click on the left half of the title, it operates as `Possible Input Connections`, and when you Double-Click on the right half, it operates as `Copy All Connections`.
263
-
264
- * Prevent downgrade of specific packages
265
- * List the package names in the `downgrade_blacklist` section of the `config.ini` file, separating them with commas.
266
- * e.g
267
- ```
268
- downgrade_blacklist = diffusers, kornia
269
- ```
270
-
271
- * Custom pip mapping
272
- * When you create the `pip_overrides.json` file, it changes the installation of specific pip packages to installations defined by the user.
273
- * Please refer to the `pip_overrides.json.template` file.
274
-
275
- * Use `aria2` as downloader
276
- * [howto](docs/en/use_aria2.md)
277
-
278
- * If you add the item `skip_migration_check = True` to `config.ini`, it will not check whether there are nodes that can be migrated at startup.
279
- * This option can be used if performance issues occur in a Colab+GDrive environment.
280
-
281
- ## Scanner
282
- When you run the `scan.sh` script:
283
-
284
- * It updates the `extension-node-map.json`.
285
- * To do this, it pulls or clones the custom nodes listed in `custom-node-list.json` into `~/.tmp/default`.
286
- * To skip this step, add the `--skip-update` option.
287
- * If you want to specify a different path instead of `~/.tmp/default`, run `python scanner.py [path]` directly instead of `scan.sh`.
288
-
289
- * It updates the `github-stats.json`.
290
- * This uses the GitHub API, so set your token with `export GITHUB_TOKEN=your_token_here` to avoid quickly reaching the rate limit and malfunctioning.
291
- * To skip this step, add the `--skip-update-stat` option.
292
-
293
- * The `--skip-all` option applies both `--skip-update` and `--skip-stat-update`.
294
-
295
-
296
- ## Troubleshooting
297
- * If your `git.exe` is installed in a specific location other than system git, please install ComfyUI-Manager and run ComfyUI. Then, specify the path including the file name in `git_exe = ` in the `<USER_DIRECTORY>/default/ComfyUI-Manager/config.ini` file that is generated.
298
- * If updating ComfyUI-Manager itself fails, please go to the **ComfyUI-Manager** directory and execute the command `git update-ref refs/remotes/origin/main a361cc1 && git fetch --all && git pull`.
299
- * If you encounter the error message `Overlapped Object has pending operation at deallocation on Comfyui Manager load` under Windows
300
- * Edit `config.ini` file: add `windows_selector_event_loop_policy = True`
301
- * if `SSL: CERTIFICATE_VERIFY_FAILED` error is occured.
302
- * Edit `config.ini` file: add `bypass_ssl = True`
303
-
304
- ## Security policy
305
- * Edit `config.ini` file: add `security_level = <LEVEL>`
306
- * `strong`
307
- * doesn't allow `high` and `middle` level risky feature
308
- * `normal`
309
- * doesn't allow `high` level risky feature
310
- * `middle` level risky feature is available
311
- * `normal-`
312
- * doesn't allow `high` level risky feature if `--listen` is specified and not starts with `127.`
313
- * `middle` level risky feature is available
314
- * `weak`
315
- * all feature is available
316
-
317
- * `high` level risky features
318
- * `Install via git url`, `pip install`
319
- * Installation of custom nodes registered not in the `default channel`.
320
- * Fix custom nodes
321
-
322
- * `middle` level risky features
323
- * Uninstall/Update
324
- * Installation of custom nodes registered in the `default channel`.
325
- * Restore/Remove Snapshot
326
- * Restart
327
-
328
- * `low` level risky features
329
- * Update ComfyUI
330
-
331
-
332
- # Disclaimer
333
-
334
- * This extension simply provides the convenience of installing custom nodes and does not guarantee their proper functioning.
335
-
336
-
337
- ## Credit
338
- ComfyUI/[ComfyUI](https://github.com/comfyanonymous/ComfyUI) - A powerful and modular stable diffusion GUI.
339
-
340
- **And, for all ComfyUI custom node developers**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/__init__.py DELETED
@@ -1,18 +0,0 @@
1
- import os
2
- import sys
3
-
4
- cli_mode_flag = os.path.join(os.path.dirname(__file__), '.enable-cli-only-mode')
5
-
6
- if not os.path.exists(cli_mode_flag):
7
- sys.path.append(os.path.join(os.path.dirname(__file__), "glob"))
8
- import manager_server # noqa: F401
9
- import share_3rdparty # noqa: F401
10
- WEB_DIRECTORY = "js"
11
- else:
12
- print("\n[ComfyUI-Manager] !! cli-only-mode is enabled !!\n")
13
-
14
- NODE_CLASS_MAPPINGS = {}
15
- __all__ = ['NODE_CLASS_MAPPINGS']
16
-
17
-
18
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/__pycache__/__init__.cpython-312.pyc DELETED
Binary file (987 Bytes)
 
custom_nodes/comfyui-manager/__pycache__/prestartup_script.cpython-312.pyc DELETED
Binary file (36.1 kB)
 
custom_nodes/comfyui-manager/alter-list.json DELETED
@@ -1,224 +0,0 @@
1
- {
2
- "items": [
3
- {
4
- "id":"https://github.com/Fannovel16/comfyui_controlnet_aux",
5
- "tags":"controlnet",
6
- "description": "This extension provides preprocessor nodes for using controlnet."
7
- },
8
- {
9
- "id":"https://github.com/comfyanonymous/ComfyUI_experiments",
10
- "tags":"Dynamic Thresholding, DT, CFG, controlnet, reference only",
11
- "description": "This experimental nodes contains a 'Reference Only' node and a 'ModelSamplerTonemapNoiseTest' node corresponding to the 'Dynamic Threshold'."
12
- },
13
- {
14
- "id":"https://github.com/ltdrdata/ComfyUI-Impact-Pack",
15
- "tags":"ddetailer, adetailer, ddsd, DD, loopback scaler, prompt, wildcard, dynamic prompt",
16
- "description": "To implement the feature of automatically detecting faces and enhancing details, various detection nodes and detailers provided by the Impact Pack can be applied. Similarly to Loopback Scaler, it also provides various custom workflows that can apply Ksampler while gradually scaling up."
17
- },
18
- {
19
- "id":"https://github.com/ltdrdata/ComfyUI-Inspire-Pack",
20
- "tags":"lora block weight, effective block analyzer, lbw, variation seed",
21
- "description": "The Inspire Pack provides the functionality of Lora Block Weight, Variation Seed."
22
- },
23
- {
24
- "id":"https://github.com/biegert/ComfyUI-CLIPSeg/raw/main/custom_nodes/clipseg.py",
25
- "tags":"ddsd",
26
- "description": "This extension provides a feature that generates segment masks on an image using a text prompt. When used in conjunction with Impact Pack, it enables applications such as DDSD."
27
- },
28
- {
29
- "id":"https://github.com/BadCafeCode/masquerade-nodes-comfyui",
30
- "tags":"ddetailer",
31
- "description": "This extension is a less feature-rich and well-maintained alternative to Impact Pack, but it has fewer dependencies and may be easier to install on abnormal configurations. The author recommends trying Impact Pack first."
32
- },
33
- {
34
- "id":"https://github.com/BlenderNeko/ComfyUI_Cutoff",
35
- "tags":"cutoff",
36
- "description": "By using this extension, prompts like 'blue hair' can be prevented from interfering with other prompts by blocking the attribute 'blue' from being used in prompts other than 'hair'."
37
- },
38
- {
39
- "id":"https://github.com/BlenderNeko/ComfyUI_ADV_CLIP_emb",
40
- "tags":"prompt, weight",
41
- "description": "There are differences in the processing methods of prompts, such as weighting and scheduling, between A1111 and ComfyUI. With this extension, various settings can be used to implement prompt processing methods similar to A1111. As this feature is also integrated into ComfyUI Cutoff, please download the Cutoff extension if you plan to use it in conjunction with Cutoff."
42
- },
43
- {
44
- "id":"https://github.com/shiimizu/ComfyUI_smZNodes",
45
- "tags":"prompt, weight",
46
- "description": "There are differences in the processing methods of prompts, such as weighting and scheduling, between A1111 and ComfyUI. This extension helps to reproduce the same embedding as A1111."
47
- },
48
- {
49
- "id":"https://github.com/BlenderNeko/ComfyUI_Noise",
50
- "tags":"img2img alt, random",
51
- "description": "The extension provides an unsampler that reverses the sampling process, allowing for a function similar to img2img alt to be implemented. Furthermore, ComfyUI uses CPU's Random instead of GPU's Random for better reproducibility compared to A1111. This extension provides the ability to use GPU's Random for Latent Noise. However, since GPU's Random may vary depending on the GPU model, reproducibility on different devices cannot be guaranteed."
52
- },
53
- {
54
- "id":"https://github.com/BlenderNeko/ComfyUI_SeeCoder",
55
- "tags":"seecoder, prompt-free-diffusion",
56
- "description": "The extension provides seecoder feature."
57
- },
58
- {
59
- "id":"https://github.com/lilly1987/ComfyUI_node_Lilly",
60
- "tags":"prompt, wildcard",
61
- "description": "This extension provides features such as a wildcard function that randomly selects prompts belonging to a category and the ability to directly load lora from prompts."
62
- },
63
- {
64
- "id":"https://github.com/Davemane42/ComfyUI_Dave_CustomNode",
65
- "tags":"latent couple",
66
- "description": "ComfyUI already provides the ability to composite latents by default. However, this extension makes it more convenient to use by visualizing the composite area."
67
- },
68
- {
69
- "id":"https://github.com/LEv145/images-grid-comfy-plugin",
70
- "tags":"X/Y Plot",
71
- "description": "This tool provides a viewer node that allows for checking multiple outputs in a grid, similar to the X/Y Plot extension."
72
- },
73
- {
74
- "id":"https://github.com/pythongosssss/ComfyUI-WD14-Tagger",
75
- "tags":"deepbooru, clip interrogation",
76
- "description": "This extension generates clip text by taking an image as input and using the Deepbooru model."
77
- },
78
- {
79
- "id":"https://github.com/szhublox/ambw_comfyui",
80
- "tags":"supermerger",
81
- "description": "This node takes two models, merges individual blocks together at various ratios, and automatically rates each merge, keeping the ratio with the highest score. "
82
- },
83
- {
84
- "id":"https://github.com/ssitu/ComfyUI_UltimateSDUpscale",
85
- "tags":"upscaler, Ultimate SD Upscale",
86
- "description": "ComfyUI nodes for the Ultimate Stable Diffusion Upscale script by Coyote-A. Uses the same script used in the A1111 extension to hopefully replicate images generated using the A1111 webui."
87
- },
88
- {
89
- "id":"https://github.com/dawangraoming/ComfyUI_ksampler_gpu/raw/main/ksampler_gpu.py",
90
- "tags":"random, noise",
91
- "description": "A1111 provides KSampler that uses GPU-based random noise. This extension offers KSampler utilizing GPU-based random noise."
92
- },
93
- {
94
- "id":"https://github.com/space-nuko/nui-suite",
95
- "tags":"prompt, dynamic prompt",
96
- "description": "This extension provides nodes with the functionality of dynamic prompts."
97
- },
98
- {
99
- "id":"https://github.com/melMass/comfy_mtb",
100
- "tags":"roop",
101
- "description": "This extension provides bunch of nodes including roop"
102
- },
103
- {
104
- "id":"https://github.com/ssitu/ComfyUI_roop",
105
- "tags":"roop",
106
- "description": "This extension provides nodes for the roop A1111 webui script."
107
- },
108
- {
109
- "id":"https://github.com/asagi4/comfyui-prompt-control",
110
- "tags":"prompt, prompt editing",
111
- "description": "This extension provides the ability to use prompts like \n\n**a [large::0.1] [cat|dog:0.05] [<lora:somelora:0.5:0.6>::0.5] [in a park:in space:0.4]**\n\n"
112
- },
113
- {
114
- "id":"https://github.com/adieyal/comfyui-dynamicprompts",
115
- "tags":"prompt, dynamic prompt",
116
- "description": "This extension is a port of sd-dynamic-prompt to ComfyUI."
117
- },
118
- {
119
- "id":"https://github.com/kwaroran/abg-comfyui",
120
- "tags":"abg, background remover",
121
- "description": "A Anime Background Remover node for comfyui, based on this hf space, works same as AGB extention in automatic1111."
122
- },
123
- {
124
- "id":"https://github.com/Gourieff/comfyui-reactor-node",
125
- "tags":"reactor, sd-webui-roop-nsfw",
126
- "description": "This is a ported version of ComfyUI for the sd-webui-roop-nsfw extension."
127
- },
128
- {
129
- "id":"https://github.com/laksjdjf/cgem156-ComfyUI",
130
- "tags":"regional prompt, latent couple, prompt",
131
- "description": "This custom nodes provide a functionality similar to regional prompts, offering couple features at the attention level."
132
- },
133
- {
134
- "id":"https://github.com/FizzleDorf/ComfyUI_FizzNodes",
135
- "tags":"deforum",
136
- "description": "This custom nodes provide functionality that assists in animation creation, similar to deforum."
137
- },
138
- {
139
- "id":"https://github.com/seanlynch/comfyui-optical-flow",
140
- "tags":"deforum, vid2vid",
141
- "description": "This custom nodes provide functionality that assists in animation creation, similar to deforum."
142
- },
143
- {
144
- "id":"https://github.com/ssitu/ComfyUI_fabric",
145
- "tags":"fabric",
146
- "description": "Similar to sd-webui-fabric, this custom nodes provide the functionality of [a/FABRIC](https://github.com/sd-fabric/fabric)."
147
- },
148
- {
149
- "id":"https://github.com/Zuellni/ComfyUI-ExLlama",
150
- "tags":"ExLlama, prompt, language model",
151
- "description": "Similar to text-generation-webui, this custom nodes provide the functionality of [a/exllama](https://github.com/turboderp/exllama)."
152
- },
153
- {
154
- "id":"https://github.com/spinagon/ComfyUI-seamless-tiling",
155
- "tags":"tiling",
156
- "description": "ComfyUI node for generating seamless textures Replicates 'Tiling' option from A1111"
157
- },
158
- {
159
- "id":"https://github.com/laksjdjf/cd-tuner_negpip-ComfyUI",
160
- "tags":"cd-tuner, negpip",
161
- "description": "This extension is a port of the [a/sd-webui-cd-tuner](https://github.com/hako-mikan/sd-webui-cd-tuner)(a.k.a. CD(color/Detail) Tuner )and [a/sd-webui-negpip](https://github.com/hako-mikan/sd-webui-negpip)(a.k.a. NegPiP) extensions of A1111 to ComfyUI."
162
- },
163
- {
164
- "id":"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding",
165
- "tags":"DT, dynamic thresholding",
166
- "description": "This custom node is a port of the Dynamic Thresholding extension from A1111 to make it available for use in ComfyUI."
167
- },
168
- {
169
- "id":"https://github.com/hhhzzyang/Comfyui_Lama",
170
- "tags":"lama, inpainting anything",
171
- "description": "This extension provides custom nodes developed based on [a/LaMa](https://github.com/advimman/lama) and [a/Inpainting anything](https://github.com/geekyutao/Inpaint-Anything)."
172
- },
173
- {
174
- "id":"https://github.com/mlinmg/ComfyUI-LaMA-Preprocessor",
175
- "tags":"lama",
176
- "description": "This extension provides custom nodes for [a/LaMa](https://github.com/advimman/lama) functionality."
177
- },
178
- {
179
- "id":"https://github.com/Haoming02/comfyui-diffusion-cg",
180
- "tags":"diffusion-cg",
181
- "description": "This extension provides custom nodes for [a/SD Webui Diffusion Color Grading](https://github.com/Haoming02/sd-webui-diffusion-cg) functionality."
182
- },
183
- {
184
- "id":"https://github.com/asagi4/ComfyUI-CADS",
185
- "tags":"diffusion-cg",
186
- "description": "This extension provides custom nodes for [a/sd-webui-cads](https://github.com/v0xie/sd-webui-cads) functionality."
187
- },
188
- {
189
- "id":"https://git.mmaker.moe/mmaker/sd-webui-color-enhance",
190
- "tags":"color-enhance",
191
- "description": "This extension supports both A1111 and ComfyUI simultaneously."
192
- },
193
- {
194
- "id":"https://github.com/shiimizu/ComfyUI-TiledDiffusion",
195
- "tags":"multidiffusion",
196
- "description": "This extension provides custom nodes for [a/Mixture of Diffusers](https://github.com/albarji/mixture-of-diffusers) and [a/MultiDiffusion](https://github.com/omerbt/MultiDiffusion)"
197
- },
198
- {
199
- "id":"https://github.com/abyz22/image_control",
200
- "tags":"BMAB",
201
- "description": "This extension provides some alternative functionalities of the [a/sd-webui-bmab](https://github.com/portu-sim/sd-webui-bmab) extension."
202
- },
203
- {
204
- "id":"https://github.com/blepping/ComfyUI-sonar",
205
- "tags":"sonar",
206
- "description": "This extension provides some alternative functionalities of the [a/stable-diffusion-webui-sonar](https://github.com/Kahsolt/stable-diffusion-webui-sonar) extension."
207
- },
208
- {
209
- "id":"https://github.com/AIFSH/ComfyUI-RVC",
210
- "tags":"sonar",
211
- "description": "a comfyui custom node for [a/Retrieval-based-Voice-Conversion-WebUI](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git), you can Voice-Conversion in comfyui now!"
212
- },
213
- {
214
- "id":"https://github.com/portu-sim/comfyui-bmab",
215
- "tags":"bmab",
216
- "description": "a comfyui custom node for [a/sd-webui-bmab](https://github.com/portu-sim/sd-webui-bmab)"
217
- },
218
- {
219
- "id":"https://github.com/ThereforeGames/ComfyUI-Unprompted",
220
- "tags":"unprompted",
221
- "description": "This extension is a port of [a/unprompted](https://github.com/ThereforeGames/unprompted)"
222
- }
223
- ]
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/channels.list.template DELETED
@@ -1,6 +0,0 @@
1
- default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main
2
- recent::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new
3
- legacy::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/legacy
4
- forked::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/forked
5
- dev::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/dev
6
- tutorial::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/tutorial
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/check.bat DELETED
@@ -1,21 +0,0 @@
1
- @echo off
2
-
3
- python json-checker.py "custom-node-list.json"
4
- python json-checker.py "model-list.json"
5
- python json-checker.py "alter-list.json"
6
- python json-checker.py "extension-node-map.json"
7
- python json-checker.py "node_db\new\custom-node-list.json"
8
- python json-checker.py "node_db\new\model-list.json"
9
- python json-checker.py "node_db\new\extension-node-map.json"
10
- python json-checker.py "node_db\dev\custom-node-list.json"
11
- python json-checker.py "node_db\dev\model-list.json"
12
- python json-checker.py "node_db\dev\extension-node-map.json"
13
- python json-checker.py "node_db\tutorial\custom-node-list.json"
14
- python json-checker.py "node_db\tutorial\model-list.json"
15
- python json-checker.py "node_db\tutorial\extension-node-map.json"
16
- python json-checker.py "node_db\legacy\custom-node-list.json"
17
- python json-checker.py "node_db\legacy\model-list.json"
18
- python json-checker.py "node_db\legacy\extension-node-map.json"
19
- python json-checker.py "node_db\forked\custom-node-list.json"
20
- python json-checker.py "node_db\forked\model-list.json"
21
- python json-checker.py "node_db\forked\extension-node-map.json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/check.sh DELETED
@@ -1,43 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo
4
- echo CHECK1
5
-
6
- files=(
7
- "custom-node-list.json"
8
- "model-list.json"
9
- "alter-list.json"
10
- "extension-node-map.json"
11
- "github-stats.json"
12
- "extras.json"
13
- "node_db/new/custom-node-list.json"
14
- "node_db/new/model-list.json"
15
- "node_db/new/extension-node-map.json"
16
- "node_db/dev/custom-node-list.json"
17
- "node_db/dev/model-list.json"
18
- "node_db/dev/extension-node-map.json"
19
- "node_db/tutorial/custom-node-list.json"
20
- "node_db/tutorial/model-list.json"
21
- "node_db/tutorial/extension-node-map.json"
22
- "node_db/legacy/custom-node-list.json"
23
- "node_db/legacy/model-list.json"
24
- "node_db/legacy/extension-node-map.json"
25
- "node_db/forked/custom-node-list.json"
26
- "node_db/forked/model-list.json"
27
- "node_db/forked/extension-node-map.json"
28
- )
29
-
30
- for file in "${files[@]}"; do
31
- python json-checker.py "$file"
32
- done
33
-
34
- echo
35
- echo CHECK2
36
- find ~/.tmp/default -name "*.py" -print0 | xargs -0 grep -E "crypto|^_A="
37
-
38
- echo
39
- echo CHECK3
40
- find ~/.tmp/default -name "requirements.txt" | xargs grep "^\s*https\\?:"
41
- find ~/.tmp/default -name "requirements.txt" | xargs grep "\.whl"
42
-
43
- echo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/cm-cli.py DELETED
@@ -1,1243 +0,0 @@
1
- import os
2
- import sys
3
- import traceback
4
- import json
5
- import asyncio
6
- import concurrent
7
- import threading
8
- from typing import Optional
9
-
10
- import typer
11
- from rich import print
12
- from typing_extensions import List, Annotated
13
- import re
14
- import git
15
- import importlib
16
-
17
-
18
- sys.path.append(os.path.dirname(__file__))
19
- sys.path.append(os.path.join(os.path.dirname(__file__), "glob"))
20
-
21
- import manager_util
22
-
23
- # read env vars
24
- # COMFYUI_FOLDERS_BASE_PATH is not required in cm-cli.py
25
- # `comfy_path` should be resolved before importing manager_core
26
- comfy_path = os.environ.get('COMFYUI_PATH')
27
- if comfy_path is None:
28
- try:
29
- import folder_paths
30
- comfy_path = os.path.join(os.path.dirname(folder_paths.__file__))
31
- except:
32
- print("\n[bold yellow]WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.[/bold yellow]", file=sys.stderr)
33
- comfy_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..', '..'))
34
-
35
- sys.path.append(comfy_path)
36
-
37
- import utils.extra_config
38
- import cm_global
39
- import manager_core as core
40
- from manager_core import unified_manager
41
- import cnr_utils
42
-
43
- comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
44
-
45
- cm_global.pip_blacklist = ['torch', 'torchsde', 'torchvision']
46
- cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
47
- cm_global.pip_overrides = {'numpy': 'numpy<2'}
48
-
49
- if os.path.exists(os.path.join(manager_util.comfyui_manager_path, "pip_overrides.json")):
50
- with open(os.path.join(manager_util.comfyui_manager_path, "pip_overrides.json"), 'r', encoding="UTF-8", errors="ignore") as json_file:
51
- cm_global.pip_overrides = json.load(json_file)
52
-
53
-
54
- def check_comfyui_hash():
55
- repo = git.Repo(comfy_path)
56
- core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
57
-
58
- cm_global.variables['comfyui.revision'] = core.comfy_ui_revision
59
-
60
- core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
61
-
62
-
63
- check_comfyui_hash() # This is a preparation step for manager_core
64
- core.check_invalid_nodes()
65
-
66
-
67
- def read_downgrade_blacklist():
68
- try:
69
- import configparser
70
- config = configparser.ConfigParser()
71
- config.read(core.manager_config.path)
72
- default_conf = config['default']
73
-
74
- if 'downgrade_blacklist' in default_conf:
75
- items = default_conf['downgrade_blacklist'].split(',')
76
- items = [x.strip() for x in items if x != '']
77
- cm_global.pip_downgrade_blacklist += items
78
- cm_global.pip_downgrade_blacklist = list(set(cm_global.pip_downgrade_blacklist))
79
- except:
80
- pass
81
-
82
-
83
- read_downgrade_blacklist() # This is a preparation step for manager_core
84
-
85
-
86
- class Ctx:
87
- folder_paths = None
88
-
89
- def __init__(self):
90
- self.channel = 'default'
91
- self.no_deps = False
92
- self.mode = 'cache'
93
- self.user_directory = None
94
- self.custom_nodes_paths = [os.path.join(core.comfy_base_path, 'custom_nodes')]
95
- self.manager_files_directory = os.path.dirname(__file__)
96
-
97
- if Ctx.folder_paths is None:
98
- try:
99
- Ctx.folder_paths = importlib.import_module('folder_paths')
100
- except ImportError:
101
- print("Warning: Unable to import folder_paths module")
102
-
103
- def set_channel_mode(self, channel, mode):
104
- if mode is not None:
105
- self.mode = mode
106
-
107
- valid_modes = ["remote", "local", "cache"]
108
- if mode and mode.lower() not in valid_modes:
109
- typer.echo(
110
- f"Invalid mode: {mode}. Allowed modes are 'remote', 'local', 'cache'.",
111
- err=True,
112
- )
113
- exit(1)
114
-
115
- if channel is not None:
116
- self.channel = channel
117
-
118
- asyncio.run(unified_manager.reload(cache_mode=self.mode, dont_wait=False))
119
- asyncio.run(unified_manager.load_nightly(self.channel, self.mode))
120
-
121
- def set_no_deps(self, no_deps):
122
- self.no_deps = no_deps
123
-
124
- def set_user_directory(self, user_directory):
125
- if user_directory is None:
126
- return
127
-
128
- extra_model_paths_yaml = os.path.join(user_directory, 'extra_model_paths.yaml')
129
- if os.path.exists(extra_model_paths_yaml):
130
- utils.extra_config.load_extra_path_config(extra_model_paths_yaml)
131
-
132
- core.update_user_directory(user_directory)
133
-
134
- if os.path.exists(core.manager_pip_overrides_path):
135
- with open(core.manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
136
- cm_global.pip_overrides = json.load(json_file)
137
- cm_global.pip_overrides = {'numpy': 'numpy<2'}
138
-
139
- @staticmethod
140
- def get_startup_scripts_path():
141
- return os.path.join(core.manager_startup_script_path, "install-scripts.txt")
142
-
143
- @staticmethod
144
- def get_restore_snapshot_path():
145
- return os.path.join(core.manager_startup_script_path, "restore-snapshot.json")
146
-
147
- @staticmethod
148
- def get_snapshot_path():
149
- return core.manager_snapshot_path
150
-
151
- @staticmethod
152
- def get_custom_nodes_paths():
153
- if Ctx.folder_paths is None:
154
- print("Error: folder_paths module is not available")
155
- return []
156
- return Ctx.folder_paths.get_folder_paths('custom_nodes')
157
-
158
-
159
- cmd_ctx = Ctx()
160
-
161
-
162
- def install_node(node_spec_str, is_all=False, cnt_msg=''):
163
- if core.is_valid_url(node_spec_str):
164
- # install via urls
165
- res = asyncio.run(core.gitclone_install(node_spec_str, no_deps=cmd_ctx.no_deps))
166
- if not res.result:
167
- print(res.msg)
168
- print(f"[bold red]ERROR: An error occurred while installing '{node_spec_str}'.[/bold red]")
169
- else:
170
- print(f"{cnt_msg} [INSTALLED] {node_spec_str:50}")
171
- else:
172
- node_spec = unified_manager.resolve_node_spec(node_spec_str)
173
-
174
- if node_spec is None:
175
- return
176
-
177
- node_name, version_spec, is_specified = node_spec
178
-
179
- # NOTE: install node doesn't allow update if version is not specified
180
- if not is_specified:
181
- version_spec = None
182
-
183
- res = asyncio.run(unified_manager.install_by_id(node_name, version_spec, cmd_ctx.channel, cmd_ctx.mode, instant_execution=True, no_deps=cmd_ctx.no_deps))
184
-
185
- if res.action == 'skip':
186
- print(f"{cnt_msg} [ SKIP ] {node_name:50} => Already installed")
187
- elif res.action == 'enable':
188
- print(f"{cnt_msg} [ ENABLED ] {node_name:50}")
189
- elif res.action == 'install-git' and res.target == 'nightly':
190
- print(f"{cnt_msg} [INSTALLED] {node_name:50}[NIGHTLY]")
191
- elif res.action == 'install-git' and res.target == 'unknown':
192
- print(f"{cnt_msg} [INSTALLED] {node_name:50}[UNKNOWN]")
193
- elif res.action == 'install-cnr' and res.result:
194
- print(f"{cnt_msg} [INSTALLED] {node_name:50}[{res.target}]")
195
- elif res.action == 'switch-cnr' and res.result:
196
- print(f"{cnt_msg} [INSTALLED] {node_name:50}[{res.target}]")
197
- elif (res.action == 'switch-cnr' or res.action == 'install-cnr') and not res.result and node_name in unified_manager.cnr_map:
198
- print(f"\nAvailable version of '{node_name}'")
199
- show_versions(node_name)
200
- print("")
201
- else:
202
- print(f"[bold red]ERROR: An error occurred while installing '{node_name}'.\n{res.msg}[/bold red]")
203
-
204
-
205
- def reinstall_node(node_spec_str, is_all=False, cnt_msg=''):
206
- node_spec = unified_manager.resolve_node_spec(node_spec_str)
207
-
208
- node_name, version_spec, _ = node_spec
209
-
210
- unified_manager.unified_uninstall(node_name, version_spec == 'unknown')
211
- install_node(node_name, is_all=is_all, cnt_msg=cnt_msg)
212
-
213
-
214
- def fix_node(node_spec_str, is_all=False, cnt_msg=''):
215
- node_spec = unified_manager.resolve_node_spec(node_spec_str, guess_mode='active')
216
-
217
- if node_spec is None:
218
- if not is_all:
219
- if unified_manager.resolve_node_spec(node_spec_str, guess_mode='inactive') is not None:
220
- print(f"{cnt_msg} [ SKIPPED ]: {node_spec_str:50} => Disabled")
221
- else:
222
- print(f"{cnt_msg} [ SKIPPED ]: {node_spec_str:50} => Not installed")
223
-
224
- return
225
-
226
- node_name, version_spec, _ = node_spec
227
-
228
- print(f"{cnt_msg} [ FIXING ]: {node_name:50}[{version_spec}]")
229
- res = unified_manager.unified_fix(node_name, version_spec, no_deps=cmd_ctx.no_deps)
230
-
231
- if not res.result:
232
- print(f"ERROR: f{res.msg}")
233
-
234
-
235
- def uninstall_node(node_spec_str: str, is_all: bool = False, cnt_msg: str = ''):
236
- spec = node_spec_str.split('@')
237
- if len(spec) == 2 and spec[1] == 'unknown':
238
- node_name = spec[0]
239
- is_unknown = True
240
- else:
241
- node_name = spec[0]
242
- is_unknown = False
243
-
244
- res = unified_manager.unified_uninstall(node_name, is_unknown)
245
- if len(spec) == 1 and res.action == 'skip' and not is_unknown:
246
- res = unified_manager.unified_uninstall(node_name, True)
247
-
248
- if res.action == 'skip':
249
- print(f"{cnt_msg} [ SKIPPED ]: {node_name:50} => Not installed")
250
-
251
- elif res.result:
252
- print(f"{cnt_msg} [UNINSTALLED] {node_name:50}")
253
- else:
254
- print(f"ERROR: An error occurred while uninstalling '{node_name}'.")
255
-
256
-
257
- def update_node(node_spec_str, is_all=False, cnt_msg=''):
258
- node_spec = unified_manager.resolve_node_spec(node_spec_str, 'active')
259
-
260
- if node_spec is None:
261
- if unified_manager.resolve_node_spec(node_spec_str, 'inactive'):
262
- print(f"{cnt_msg} [ SKIPPED ]: {node_spec_str:50} => Disabled")
263
- else:
264
- print(f"{cnt_msg} [ SKIPPED ]: {node_spec_str:50} => Not installed")
265
- return None
266
-
267
- node_name, version_spec, _ = node_spec
268
-
269
- res = unified_manager.unified_update(node_name, version_spec, no_deps=cmd_ctx.no_deps, return_postinstall=True)
270
-
271
- if not res.result:
272
- print(f"ERROR: An error occurred while updating '{node_name}'.")
273
- elif res.action == 'skip':
274
- print(f"{cnt_msg} [ SKIPPED ]: {node_name:50} => {res.msg}")
275
- else:
276
- print(f"{cnt_msg} [ UPDATED ]: {node_name:50} => ({version_spec} -> {res.target})")
277
-
278
- return res.with_target(f'{node_name}@{res.target}')
279
-
280
-
281
- def update_parallel(nodes):
282
- is_all = False
283
- if 'all' in nodes:
284
- is_all = True
285
- nodes = []
286
- for x in unified_manager.active_nodes.keys():
287
- nodes.append(x)
288
- for x in unified_manager.unknown_active_nodes.keys():
289
- nodes.append(x+"@unknown")
290
- else:
291
- nodes = [x for x in nodes if x.lower() not in ['comfy', 'comfyui']]
292
-
293
- total = len(nodes)
294
-
295
- lock = threading.Lock()
296
- processed = []
297
-
298
- i = 0
299
-
300
- def process_custom_node(x):
301
- nonlocal i
302
- nonlocal processed
303
-
304
- with lock:
305
- i += 1
306
-
307
- try:
308
- res = update_node(x, is_all=is_all, cnt_msg=f'{i}/{total}')
309
- with lock:
310
- processed.append(res)
311
- except Exception as e:
312
- print(f"ERROR: {e}")
313
- traceback.print_exc()
314
-
315
- with concurrent.futures.ThreadPoolExecutor(4) as executor:
316
- for item in nodes:
317
- executor.submit(process_custom_node, item)
318
-
319
- i = 1
320
- for res in processed:
321
- if res is not None:
322
- print(f"[{i}/{total}] Post update: {res.target}")
323
- if res.postinstall is not None:
324
- res.postinstall()
325
- i += 1
326
-
327
-
328
- def update_comfyui():
329
- res = core.update_path(comfy_path, instant_execution=True)
330
- if res == 'fail':
331
- print("Updating ComfyUI has failed.")
332
- elif res == 'updated':
333
- print("ComfyUI is updated.")
334
- else:
335
- print("ComfyUI is already up to date.")
336
-
337
-
338
- def enable_node(node_spec_str, is_all=False, cnt_msg=''):
339
- if unified_manager.resolve_node_spec(node_spec_str, guess_mode='active') is not None:
340
- print(f"{cnt_msg} [ SKIP ] {node_spec_str:50} => Already enabled")
341
- return
342
-
343
- node_spec = unified_manager.resolve_node_spec(node_spec_str, guess_mode='inactive')
344
-
345
- if node_spec is None:
346
- print(f"{cnt_msg} [ SKIP ] {node_spec_str:50} => Not found")
347
- return
348
-
349
- node_name, version_spec, _ = node_spec
350
-
351
- res = unified_manager.unified_enable(node_name, version_spec)
352
-
353
- if res.action == 'skip':
354
- print(f"{cnt_msg} [ SKIP ] {node_name:50} => {res.msg}")
355
- elif res.result:
356
- print(f"{cnt_msg} [ENABLED] {node_name:50}")
357
- else:
358
- print(f"{cnt_msg} [ FAIL ] {node_name:50} => {res.msg}")
359
-
360
-
361
- def disable_node(node_spec_str: str, is_all=False, cnt_msg=''):
362
- if 'comfyui-manager' in node_spec_str.lower():
363
- return
364
-
365
- node_spec = unified_manager.resolve_node_spec(node_spec_str, guess_mode='active')
366
-
367
- if node_spec is None:
368
- if unified_manager.resolve_node_spec(node_spec_str, guess_mode='inactive') is not None:
369
- print(f"{cnt_msg} [ SKIP ] {node_spec_str:50} => Already disabled")
370
- else:
371
- print(f"{cnt_msg} [ SKIP ] {node_spec_str:50} => Not found")
372
- return
373
-
374
- node_name, version_spec, _ = node_spec
375
-
376
- res = unified_manager.unified_disable(node_name, version_spec == 'unknown')
377
-
378
- if res.action == 'skip':
379
- print(f"{cnt_msg} [ SKIP ] {node_name:50} => {res.msg}")
380
- elif res.result:
381
- print(f"{cnt_msg} [DISABLED] {node_name:50}")
382
- else:
383
- print(f"{cnt_msg} [ FAIL ] {node_name:50} => {res.msg}")
384
-
385
-
386
- def show_list(kind, simple=False):
387
- custom_nodes = asyncio.run(unified_manager.get_custom_nodes(channel=cmd_ctx.channel, mode=cmd_ctx.mode))
388
-
389
- # collect not-installed unknown nodes
390
- not_installed_unknown_nodes = []
391
- repo_unknown = {}
392
-
393
- for k, v in custom_nodes.items():
394
- if 'cnr_latest' not in v:
395
- if len(v['files']) == 1:
396
- repo_url = v['files'][0]
397
- node_name = repo_url.split('/')[-1]
398
- if node_name not in unified_manager.unknown_inactive_nodes and node_name not in unified_manager.unknown_active_nodes:
399
- not_installed_unknown_nodes.append(v)
400
- else:
401
- repo_unknown[node_name] = v
402
-
403
- processed = {}
404
- unknown_processed = []
405
-
406
- flag = kind in ['all', 'cnr', 'installed', 'enabled']
407
- for k, v in unified_manager.active_nodes.items():
408
- if flag:
409
- cnr = unified_manager.cnr_map[k]
410
- processed[k] = "[ ENABLED ] ", cnr['name'], k, cnr['publisher']['name'], v[0]
411
- else:
412
- processed[k] = None
413
-
414
- if flag and kind != 'cnr':
415
- for k, v in unified_manager.unknown_active_nodes.items():
416
- item = repo_unknown.get(k)
417
-
418
- if item is None:
419
- continue
420
-
421
- log_item = "[ ENABLED ] ", item['title'], k, item['author']
422
- unknown_processed.append(log_item)
423
-
424
- flag = kind in ['all', 'cnr', 'installed', 'disabled']
425
- for k, v in unified_manager.cnr_inactive_nodes.items():
426
- if k in processed:
427
- continue
428
-
429
- if flag:
430
- cnr = unified_manager.cnr_map[k]
431
- processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], ", ".join(list(v.keys()))
432
- else:
433
- processed[k] = None
434
-
435
- for k, v in unified_manager.nightly_inactive_nodes.items():
436
- if k in processed:
437
- continue
438
-
439
- if flag:
440
- cnr = unified_manager.cnr_map[k]
441
- processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], 'nightly'
442
- else:
443
- processed[k] = None
444
-
445
- if flag and kind != 'cnr':
446
- for k, v in unified_manager.unknown_inactive_nodes.items():
447
- item = repo_unknown.get(k)
448
-
449
- if item is None:
450
- continue
451
-
452
- log_item = "[ DISABLED ] ", item['title'], k, item['author']
453
- unknown_processed.append(log_item)
454
-
455
- flag = kind in ['all', 'cnr', 'not-installed']
456
- for k, v in unified_manager.cnr_map.items():
457
- if k in processed:
458
- continue
459
-
460
- if flag:
461
- cnr = unified_manager.cnr_map[k]
462
- ver_spec = v['latest_version']['version'] if 'latest_version' in v else '0.0.0'
463
- processed[k] = "[ NOT INSTALLED ] ", cnr['name'], k, cnr['publisher']['name'], ver_spec
464
- else:
465
- processed[k] = None
466
-
467
- if flag and kind != 'cnr':
468
- for x in not_installed_unknown_nodes:
469
- if len(x['files']) == 1:
470
- node_id = os.path.basename(x['files'][0])
471
- log_item = "[ NOT INSTALLED ] ", x['title'], node_id, x['author']
472
- unknown_processed.append(log_item)
473
-
474
- for x in processed.values():
475
- if x is None:
476
- continue
477
-
478
- prefix, title, short_id, author, ver_spec = x
479
- if simple:
480
- print(title+'@'+ver_spec)
481
- else:
482
- print(f"{prefix} {title:50} {short_id:30} (author: {author:20}) \\[{ver_spec}]")
483
-
484
- for x in unknown_processed:
485
- prefix, title, short_id, author = x
486
- if simple:
487
- print(title+'@unknown')
488
- else:
489
- print(f"{prefix} {title:50} {short_id:30} (author: {author:20}) [UNKNOWN]")
490
-
491
-
492
- async def show_snapshot(simple_mode=False):
493
- json_obj = await core.get_current_snapshot()
494
-
495
- if simple_mode:
496
- print(f"[{json_obj['comfyui']}] comfyui")
497
- for k, v in json_obj['git_custom_nodes'].items():
498
- print(f"[{v['hash']}] {k}")
499
- for v in json_obj['file_custom_nodes']:
500
- print(f"[ N/A ] {v['filename']}")
501
-
502
- else:
503
- formatted_json = json.dumps(json_obj, ensure_ascii=False, indent=4)
504
- print(formatted_json)
505
-
506
-
507
- def show_snapshot_list(simple_mode=False):
508
- snapshot_path = cmd_ctx.get_snapshot_path()
509
-
510
- files = os.listdir(snapshot_path)
511
- json_files = [x for x in files if x.endswith('.json')]
512
- for x in sorted(json_files):
513
- print(x)
514
-
515
-
516
- def cancel():
517
- if os.path.exists(cmd_ctx.get_startup_scripts_path()):
518
- os.remove(cmd_ctx.get_startup_scripts_path())
519
-
520
- if os.path.exists(cmd_ctx.get_restore_snapshot_path()):
521
- os.remove(cmd_ctx.get_restore_snapshot_path())
522
-
523
-
524
- async def auto_save_snapshot():
525
- path = await core.save_snapshot_with_postfix('cli-autosave')
526
- print(f"Current snapshot is saved as `{path}`")
527
-
528
-
529
- def get_all_installed_node_specs():
530
- res = []
531
- processed = set()
532
- for k, v in unified_manager.active_nodes.items():
533
- node_spec_str = f"{k}@{v[0]}"
534
- res.append(node_spec_str)
535
- processed.add(k)
536
-
537
- for k in unified_manager.cnr_inactive_nodes.keys():
538
- if k in processed:
539
- continue
540
-
541
- latest = unified_manager.get_from_cnr_inactive_nodes(k)
542
- if latest is not None:
543
- node_spec_str = f"{k}@{str(latest[0])}"
544
- res.append(node_spec_str)
545
-
546
- for k in unified_manager.nightly_inactive_nodes.keys():
547
- if k in processed:
548
- continue
549
-
550
- node_spec_str = f"{k}@nightly"
551
- res.append(node_spec_str)
552
-
553
- for k in unified_manager.unknown_active_nodes.keys():
554
- node_spec_str = f"{k}@unknown"
555
- res.append(node_spec_str)
556
-
557
- for k in unified_manager.unknown_inactive_nodes.keys():
558
- node_spec_str = f"{k}@unknown"
559
- res.append(node_spec_str)
560
-
561
- return res
562
-
563
-
564
- def for_each_nodes(nodes, act, allow_all=True):
565
- is_all = False
566
- if allow_all and 'all' in nodes:
567
- is_all = True
568
- nodes = get_all_installed_node_specs()
569
- else:
570
- nodes = [x for x in nodes if x.lower() not in ['comfy', 'comfyui', 'all']]
571
-
572
- total = len(nodes)
573
- i = 1
574
- for x in nodes:
575
- try:
576
- act(x, is_all=is_all, cnt_msg=f'{i}/{total}')
577
- except Exception as e:
578
- print(f"ERROR: {e}")
579
- traceback.print_exc()
580
- i += 1
581
-
582
-
583
- app = typer.Typer()
584
-
585
-
586
- @app.command(help="Display help for commands")
587
- def help(ctx: typer.Context):
588
- print(ctx.find_root().get_help())
589
- ctx.exit(0)
590
-
591
-
592
- @app.command(help="Install custom nodes")
593
- def install(
594
- nodes: List[str] = typer.Argument(
595
- ..., help="List of custom nodes to install"
596
- ),
597
- channel: Annotated[
598
- str,
599
- typer.Option(
600
- show_default=False,
601
- help="Specify the operation mode"
602
- ),
603
- ] = None,
604
- mode: str = typer.Option(
605
- None,
606
- help="[remote|local|cache]"
607
- ),
608
- no_deps: Annotated[
609
- Optional[bool],
610
- typer.Option(
611
- "--no-deps",
612
- show_default=False,
613
- help="Skip installing any Python dependencies",
614
- ),
615
- ] = False,
616
- user_directory: str = typer.Option(
617
- None,
618
- help="user directory"
619
- ),
620
- ):
621
- cmd_ctx.set_user_directory(user_directory)
622
- cmd_ctx.set_channel_mode(channel, mode)
623
- cmd_ctx.set_no_deps(no_deps)
624
-
625
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
626
- for_each_nodes(nodes, act=install_node)
627
- pip_fixer.fix_broken()
628
-
629
-
630
- @app.command(help="Reinstall custom nodes")
631
- def reinstall(
632
- nodes: List[str] = typer.Argument(
633
- ..., help="List of custom nodes to reinstall"
634
- ),
635
- channel: Annotated[
636
- str,
637
- typer.Option(
638
- show_default=False,
639
- help="Specify the operation mode"
640
- ),
641
- ] = None,
642
- mode: str = typer.Option(
643
- None,
644
- help="[remote|local|cache]"
645
- ),
646
- no_deps: Annotated[
647
- Optional[bool],
648
- typer.Option(
649
- "--no-deps",
650
- show_default=False,
651
- help="Skip installing any Python dependencies",
652
- ),
653
- ] = False,
654
- user_directory: str = typer.Option(
655
- None,
656
- help="user directory"
657
- ),
658
- ):
659
- cmd_ctx.set_user_directory(user_directory)
660
- cmd_ctx.set_channel_mode(channel, mode)
661
- cmd_ctx.set_no_deps(no_deps)
662
-
663
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
664
- for_each_nodes(nodes, act=reinstall_node)
665
- pip_fixer.fix_broken()
666
-
667
-
668
- @app.command(help="Uninstall custom nodes")
669
- def uninstall(
670
- nodes: List[str] = typer.Argument(
671
- ..., help="List of custom nodes to uninstall"
672
- ),
673
- channel: Annotated[
674
- str,
675
- typer.Option(
676
- show_default=False,
677
- help="Specify the operation mode"
678
- ),
679
- ] = None,
680
- mode: str = typer.Option(
681
- None,
682
- help="[remote|local|cache]"
683
- ),
684
- ):
685
- cmd_ctx.set_channel_mode(channel, mode)
686
- for_each_nodes(nodes, act=uninstall_node)
687
-
688
-
689
- @app.command(help="Disable custom nodes")
690
- def update(
691
- nodes: List[str] = typer.Argument(
692
- ...,
693
- help="[all|List of custom nodes to update]"
694
- ),
695
- channel: Annotated[
696
- str,
697
- typer.Option(
698
- show_default=False,
699
- help="Specify the operation mode"
700
- ),
701
- ] = None,
702
- mode: str = typer.Option(
703
- None,
704
- help="[remote|local|cache]"
705
- ),
706
- user_directory: str = typer.Option(
707
- None,
708
- help="user directory"
709
- ),
710
- ):
711
- cmd_ctx.set_user_directory(user_directory)
712
- cmd_ctx.set_channel_mode(channel, mode)
713
-
714
- if 'all' in nodes:
715
- asyncio.run(auto_save_snapshot())
716
-
717
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
718
-
719
- for x in nodes:
720
- if x.lower() in ['comfyui', 'comfy', 'all']:
721
- update_comfyui()
722
- break
723
-
724
- update_parallel(nodes)
725
- pip_fixer.fix_broken()
726
-
727
-
728
- @app.command(help="Disable custom nodes")
729
- def disable(
730
- nodes: List[str] = typer.Argument(
731
- ...,
732
- help="[all|List of custom nodes to disable]"
733
- ),
734
- channel: Annotated[
735
- str,
736
- typer.Option(
737
- show_default=False,
738
- help="Specify the operation mode"
739
- ),
740
- ] = None,
741
- mode: str = typer.Option(
742
- None,
743
- help="[remote|local|cache]"
744
- ),
745
- user_directory: str = typer.Option(
746
- None,
747
- help="user directory"
748
- ),
749
- ):
750
- cmd_ctx.set_user_directory(user_directory)
751
- cmd_ctx.set_channel_mode(channel, mode)
752
-
753
- if 'all' in nodes:
754
- asyncio.run(auto_save_snapshot())
755
-
756
- for_each_nodes(nodes, disable_node, allow_all=True)
757
-
758
-
759
- @app.command(help="Enable custom nodes")
760
- def enable(
761
- nodes: List[str] = typer.Argument(
762
- ...,
763
- help="[all|List of custom nodes to enable]"
764
- ),
765
- channel: Annotated[
766
- str,
767
- typer.Option(
768
- show_default=False,
769
- help="Specify the operation mode"
770
- ),
771
- ] = None,
772
- mode: str = typer.Option(
773
- None,
774
- help="[remote|local|cache]"
775
- ),
776
- user_directory: str = typer.Option(
777
- None,
778
- help="user directory"
779
- ),
780
- ):
781
- cmd_ctx.set_user_directory(user_directory)
782
- cmd_ctx.set_channel_mode(channel, mode)
783
-
784
- if 'all' in nodes:
785
- asyncio.run(auto_save_snapshot())
786
-
787
- for_each_nodes(nodes, enable_node, allow_all=True)
788
-
789
-
790
- @app.command(help="Fix dependencies of custom nodes")
791
- def fix(
792
- nodes: List[str] = typer.Argument(
793
- ...,
794
- help="[all|List of custom nodes to fix]"
795
- ),
796
- channel: Annotated[
797
- str,
798
- typer.Option(
799
- show_default=False,
800
- help="Specify the operation mode"
801
- ),
802
- ] = None,
803
- mode: str = typer.Option(
804
- None,
805
- help="[remote|local|cache]"
806
- ),
807
- user_directory: str = typer.Option(
808
- None,
809
- help="user directory"
810
- ),
811
- ):
812
- cmd_ctx.set_user_directory(user_directory)
813
- cmd_ctx.set_channel_mode(channel, mode)
814
-
815
- if 'all' in nodes:
816
- asyncio.run(auto_save_snapshot())
817
-
818
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
819
- for_each_nodes(nodes, fix_node, allow_all=True)
820
- pip_fixer.fix_broken()
821
-
822
-
823
- @app.command("show-versions", help="Show all available versions of the node")
824
- def show_versions(node_name: str):
825
- versions = cnr_utils.all_versions_of_node(node_name)
826
- if versions is None:
827
- print(f"Node not found in Comfy Registry: {node_name}")
828
-
829
- for x in versions:
830
- print(f"[{x['createdAt'][:10]}] {x['version']} -- {x['changelog']}")
831
-
832
-
833
- @app.command("show", help="Show node list")
834
- def show(
835
- arg: str = typer.Argument(
836
- help="[installed|enabled|not-installed|disabled|all|cnr|snapshot|snapshot-list]"
837
- ),
838
- channel: Annotated[
839
- str,
840
- typer.Option(
841
- show_default=False,
842
- help="Specify the operation mode"
843
- ),
844
- ] = None,
845
- mode: str = typer.Option(
846
- None,
847
- help="[remote|local|cache]"
848
- ),
849
- user_directory: str = typer.Option(
850
- None,
851
- help="user directory"
852
- ),
853
- ):
854
- valid_commands = [
855
- "installed",
856
- "enabled",
857
- "not-installed",
858
- "disabled",
859
- "all",
860
- "cnr",
861
- "snapshot",
862
- "snapshot-list",
863
- ]
864
- if arg not in valid_commands:
865
- typer.echo(f"Invalid command: `show {arg}`", err=True)
866
- exit(1)
867
-
868
- cmd_ctx.set_user_directory(user_directory)
869
- cmd_ctx.set_channel_mode(channel, mode)
870
- if arg == 'snapshot':
871
- show_snapshot()
872
- elif arg == 'snapshot-list':
873
- show_snapshot_list()
874
- else:
875
- show_list(arg)
876
-
877
-
878
- @app.command("simple-show", help="Show node list (simple mode)")
879
- def simple_show(
880
- arg: str = typer.Argument(
881
- help="[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]"
882
- ),
883
- channel: Annotated[
884
- str,
885
- typer.Option(
886
- show_default=False,
887
- help="Specify the operation mode"
888
- ),
889
- ] = None,
890
- mode: str = typer.Option(
891
- None,
892
- help="[remote|local|cache]"
893
- ),
894
- user_directory: str = typer.Option(
895
- None,
896
- help="user directory"
897
- ),
898
- ):
899
- valid_commands = [
900
- "installed",
901
- "enabled",
902
- "not-installed",
903
- "disabled",
904
- "all",
905
- "snapshot",
906
- "snapshot-list",
907
- ]
908
- if arg not in valid_commands:
909
- typer.echo(f"[bold red]Invalid command: `show {arg}`[/bold red]", err=True)
910
- exit(1)
911
-
912
- cmd_ctx.set_user_directory(user_directory)
913
- cmd_ctx.set_channel_mode(channel, mode)
914
-
915
- if arg == 'snapshot':
916
- show_snapshot(True)
917
- elif arg == 'snapshot-list':
918
- show_snapshot_list(True)
919
- else:
920
- show_list(arg, True)
921
-
922
-
923
- @app.command('cli-only-mode', help="Set whether to use ComfyUI-Manager in CLI-only mode.")
924
- def cli_only_mode(
925
- mode: str = typer.Argument(
926
- ..., help="[enable|disable]"
927
- ),
928
- user_directory: str = typer.Option(
929
- None,
930
- help="user directory"
931
- )
932
- ):
933
- cmd_ctx.set_user_directory(user_directory)
934
- cli_mode_flag = os.path.join(cmd_ctx.manager_files_directory, '.enable-cli-only-mode')
935
-
936
- if mode.lower() == 'enable':
937
- with open(cli_mode_flag, 'w'):
938
- pass
939
- print("\nINFO: `cli-only-mode` is enabled\n")
940
- elif mode.lower() == 'disable':
941
- if os.path.exists(cli_mode_flag):
942
- os.remove(cli_mode_flag)
943
- print("\nINFO: `cli-only-mode` is disabled\n")
944
- else:
945
- print(f"\n[bold red]Invalid value for cli-only-mode: {mode}[/bold red]\n")
946
- exit(1)
947
-
948
-
949
- @app.command(
950
- "deps-in-workflow", help="Generate dependencies file from workflow (.json/.png)"
951
- )
952
- def deps_in_workflow(
953
- workflow: Annotated[
954
- str, typer.Option(show_default=False, help="Workflow file (.json/.png)")
955
- ],
956
- output: Annotated[
957
- str, typer.Option(show_default=False, help="Output file (.json)")
958
- ],
959
- channel: Annotated[
960
- str,
961
- typer.Option(
962
- show_default=False,
963
- help="Specify the operation mode"
964
- ),
965
- ] = None,
966
- mode: str = typer.Option(
967
- None,
968
- help="[remote|local|cache]"
969
- ),
970
- user_directory: str = typer.Option(
971
- None,
972
- help="user directory"
973
- )
974
- ):
975
- cmd_ctx.set_user_directory(user_directory)
976
- cmd_ctx.set_channel_mode(channel, mode)
977
-
978
- input_path = workflow
979
- output_path = output
980
-
981
- if not os.path.exists(input_path):
982
- print(f"[bold red]File not found: {input_path}[/bold red]")
983
- exit(1)
984
-
985
- used_exts, unknown_nodes = asyncio.run(core.extract_nodes_from_workflow(input_path, mode=cmd_ctx.mode, channel_url=cmd_ctx.channel))
986
-
987
- custom_nodes = {}
988
- for x in used_exts:
989
- custom_nodes[x] = {'state': core.simple_check_custom_node(x),
990
- 'hash': '-'
991
- }
992
-
993
- res = {
994
- 'custom_nodes': custom_nodes,
995
- 'unknown_nodes': list(unknown_nodes)
996
- }
997
-
998
- with open(output_path, "w", encoding='utf-8') as output_file:
999
- json.dump(res, output_file, indent=4)
1000
-
1001
- print(f"Workflow dependencies are being saved into {output_path}.")
1002
-
1003
-
1004
- @app.command("save-snapshot", help="Save a snapshot of the current ComfyUI environment. If output path isn't provided. Save to ComfyUI-Manager/snapshots path.")
1005
- def save_snapshot(
1006
- output: Annotated[
1007
- str,
1008
- typer.Option(
1009
- show_default=False, help="Specify the output file path. (.json/.yaml)"
1010
- ),
1011
- ] = None,
1012
- user_directory: str = typer.Option(
1013
- None,
1014
- help="user directory"
1015
- )
1016
- ):
1017
- cmd_ctx.set_user_directory(user_directory)
1018
-
1019
- path = asyncio.run(core.save_snapshot_with_postfix('snapshot', output))
1020
- print(f"Current snapshot is saved as `{path}`")
1021
-
1022
-
1023
- @app.command("restore-snapshot", help="Restore snapshot from snapshot file")
1024
- def restore_snapshot(
1025
- snapshot_name: str,
1026
- pip_non_url: Optional[bool] = typer.Option(
1027
- default=None,
1028
- show_default=False,
1029
- is_flag=True,
1030
- help="Restore for pip packages registered on PyPI.",
1031
- ),
1032
- pip_non_local_url: Optional[bool] = typer.Option(
1033
- default=None,
1034
- show_default=False,
1035
- is_flag=True,
1036
- help="Restore for pip packages registered at web URLs.",
1037
- ),
1038
- pip_local_url: Optional[bool] = typer.Option(
1039
- default=None,
1040
- show_default=False,
1041
- is_flag=True,
1042
- help="Restore for pip packages specified by local paths.",
1043
- ),
1044
- user_directory: str = typer.Option(
1045
- None,
1046
- help="user directory"
1047
- )
1048
- ):
1049
- cmd_ctx.set_user_directory(user_directory)
1050
-
1051
- extras = []
1052
- if pip_non_url:
1053
- extras.append('--pip-non-url')
1054
-
1055
- if pip_non_local_url:
1056
- extras.append('--pip-non-local-url')
1057
-
1058
- if pip_local_url:
1059
- extras.append('--pip-local-url')
1060
-
1061
- print(f"PIPs restore mode: {extras}")
1062
-
1063
- if os.path.exists(snapshot_name):
1064
- snapshot_path = os.path.abspath(snapshot_name)
1065
- else:
1066
- snapshot_path = os.path.join(cmd_ctx.get_snapshot_path(), snapshot_name)
1067
- if not os.path.exists(snapshot_path):
1068
- print(f"[bold red]ERROR: `{snapshot_path}` is not exists.[/bold red]")
1069
- exit(1)
1070
-
1071
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
1072
- try:
1073
- asyncio.run(core.restore_snapshot(snapshot_path, extras))
1074
- except Exception:
1075
- print("[bold red]ERROR: Failed to restore snapshot.[/bold red]")
1076
- traceback.print_exc()
1077
- raise typer.Exit(code=1)
1078
- pip_fixer.fix_broken()
1079
-
1080
-
1081
- @app.command(
1082
- "restore-dependencies", help="Restore dependencies from whole installed custom nodes."
1083
- )
1084
- def restore_dependencies(
1085
- user_directory: str = typer.Option(
1086
- None,
1087
- help="user directory"
1088
- )
1089
- ):
1090
- cmd_ctx.set_user_directory(user_directory)
1091
-
1092
- node_paths = []
1093
-
1094
- for base_path in cmd_ctx.get_custom_nodes_paths():
1095
- for name in os.listdir(base_path):
1096
- target = os.path.join(base_path, name)
1097
- if os.path.isdir(target) and not name.endswith('.disabled'):
1098
- node_paths.append(target)
1099
-
1100
- total = len(node_paths)
1101
- i = 1
1102
-
1103
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
1104
- for x in node_paths:
1105
- print("----------------------------------------------------------------------------------------------------")
1106
- print(f"Restoring [{i}/{total}]: {x}")
1107
- unified_manager.execute_install_script('', x, instant_execution=True)
1108
- i += 1
1109
- pip_fixer.fix_broken()
1110
-
1111
-
1112
- @app.command(
1113
- "post-install", help="Install dependencies and execute installation script"
1114
- )
1115
- def post_install(
1116
- path: str = typer.Argument(
1117
- help="path to custom node",
1118
- )
1119
- ):
1120
- path = os.path.expanduser(path)
1121
-
1122
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
1123
- unified_manager.execute_install_script('', path, instant_execution=True)
1124
- pip_fixer.fix_broken()
1125
-
1126
-
1127
- @app.command(
1128
- "install-deps",
1129
- help="Install dependencies from dependencies file(.json) or workflow(.png/.json)",
1130
- )
1131
- def install_deps(
1132
- deps: str = typer.Argument(
1133
- help="Dependency spec file (.json)",
1134
- ),
1135
- channel: Annotated[
1136
- str,
1137
- typer.Option(
1138
- show_default=False,
1139
- help="Specify the operation mode"
1140
- ),
1141
- ] = None,
1142
- mode: str = typer.Option(
1143
- None,
1144
- help="[remote|local|cache]"
1145
- ),
1146
- user_directory: str = typer.Option(
1147
- None,
1148
- help="user directory"
1149
- ),
1150
- ):
1151
- cmd_ctx.set_user_directory(user_directory)
1152
- cmd_ctx.set_channel_mode(channel, mode)
1153
- asyncio.run(auto_save_snapshot())
1154
-
1155
- if not os.path.exists(deps):
1156
- print(f"[bold red]File not found: {deps}[/bold red]")
1157
- exit(1)
1158
- else:
1159
- with open(deps, 'r', encoding="UTF-8", errors="ignore") as json_file:
1160
- try:
1161
- json_obj = json.load(json_file)
1162
- except:
1163
- print(f"[bold red]Invalid json file: {deps}[/bold red]")
1164
- exit(1)
1165
-
1166
-
1167
- pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages())
1168
- for k in json_obj['custom_nodes'].keys():
1169
- state = core.simple_check_custom_node(k)
1170
- if state == 'installed':
1171
- continue
1172
- elif state == 'not-installed':
1173
- asyncio.run(core.gitclone_install(k, instant_execution=True))
1174
- else: # disabled
1175
- core.gitclone_set_active([k], False)
1176
- pip_fixer.fix_broken()
1177
-
1178
- print("Dependency installation and activation complete.")
1179
-
1180
-
1181
- @app.command(help="Clear reserved startup action in ComfyUI-Manager")
1182
- def clear():
1183
- cancel()
1184
-
1185
-
1186
- @app.command("export-custom-node-ids", help="Export custom node ids")
1187
- def export_custom_node_ids(
1188
- path: str,
1189
- channel: Annotated[
1190
- str,
1191
- typer.Option(
1192
- show_default=False,
1193
- help="Specify the operation mode"
1194
- ),
1195
- ] = None,
1196
- mode: str = typer.Option(
1197
- None,
1198
- help="[remote|local|cache]"
1199
- ),
1200
- user_directory: str = typer.Option(
1201
- None,
1202
- help="user directory"
1203
- ),
1204
- ):
1205
- cmd_ctx.set_user_directory(user_directory)
1206
- cmd_ctx.set_channel_mode(channel, mode)
1207
-
1208
- with open(path, "w", encoding='utf-8') as output_file:
1209
- for x in unified_manager.cnr_map.keys():
1210
- print(x, file=output_file)
1211
-
1212
- custom_nodes = asyncio.run(unified_manager.get_custom_nodes(channel=cmd_ctx.channel, mode=cmd_ctx.mode))
1213
- for x in custom_nodes.values():
1214
- if 'cnr_latest' not in x:
1215
- if len(x['files']) == 1:
1216
- repo_url = x['files'][0]
1217
- node_id = repo_url.split('/')[-1]
1218
- print(f"{node_id}@unknown", file=output_file)
1219
-
1220
- if 'id' in x:
1221
- print(f"{x['id']}@unknown", file=output_file)
1222
-
1223
-
1224
- @app.command(
1225
- "migrate",
1226
- help="Migrate legacy node system to new node system",
1227
- )
1228
- def migrate(
1229
- user_directory: str = typer.Option(
1230
- None,
1231
- help="user directory"
1232
- )
1233
- ):
1234
- cmd_ctx.set_user_directory(user_directory)
1235
- asyncio.run(unified_manager.migrate_unmanaged_nodes())
1236
-
1237
-
1238
- if __name__ == '__main__':
1239
- sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
1240
- sys.exit(app())
1241
-
1242
-
1243
- print("")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/cm-cli.sh DELETED
@@ -1,2 +0,0 @@
1
- #!/bin/bash
2
- python cm-cli.py $*
 
 
 
custom_nodes/comfyui-manager/components/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- *.json
2
- *.pack
 
 
 
custom_nodes/comfyui-manager/custom-node-list.json DELETED
The diff for this file is too large to render. See raw diff
 
custom_nodes/comfyui-manager/docs/en/cm-cli.md DELETED
@@ -1,146 +0,0 @@
1
- # `cm-cli`: ComfyUI-Manager CLI
2
-
3
- `cm-cli` is a tool that allows you to use various functions of ComfyUI-Manager from the command line without launching ComfyUI.
4
-
5
-
6
- ```
7
- -= ComfyUI-Manager CLI (V2.24) =-
8
-
9
-
10
- python cm-cli.py [OPTIONS]
11
-
12
- OPTIONS:
13
- [install|reinstall|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]
14
- [update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]
15
- [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]
16
- save-snapshot ?[--output <snapshot .json/.yaml>]
17
- restore-snapshot <snapshot .json/.yaml> ?[--pip-non-url] ?[--pip-non-local-url] ?[--pip-local-url]
18
- cli-only-mode [enable|disable]
19
- restore-dependencies
20
- clear
21
- ```
22
-
23
- ## How To Use?
24
- * You can execute it via `python cm-cli.py`.
25
- * For example, if you want to update all custom nodes:
26
- * In the ComfyUI-Manager directory, you can execute the command `python cm-cli.py update all`.
27
- * If running from the ComfyUI directory, you can specify the path to cm-cli.py like this: `python custom_nodes/ComfyUI-Manager/cm-cli.py update all`.
28
-
29
- ## Prerequisite
30
- * It must be run in the same Python environment as the one running ComfyUI.
31
- * If using a venv, you must run it with the venv activated.
32
- * If using a portable version, and you are in the directory with the run_nvidia_gpu.bat file, you should execute the command as follows:
33
- `.\python_embeded\python.exe ComfyUI\custom_nodes\ComfyUI-Manager\cm-cli.py update all`
34
- * The path for ComfyUI can be set with the COMFYUI_PATH environment variable. If omitted, a warning message will appear, and the path will be set relative to the installed location of ComfyUI-Manager:
35
- ```
36
- WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.
37
- ```
38
-
39
- ## Features
40
-
41
- ### 1. --channel, --mode
42
- * For viewing information and managing custom nodes, you can set the information database through --channel and --mode.
43
- * For instance, executing the command `python cm-cli.py update all --channel recent --mode remote` will operate based on the latest information from remote rather than local data embedded in the current ComfyUI-Manager repo and will only target the list in the recent channel.
44
- * --channel, --mode are only available with the commands `simple-show, show, install, uninstall, update, disable, enable, fix`.
45
-
46
- ### 2. Viewing Management Information
47
-
48
- `[simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
49
-
50
- * `[show|simple-show]` - `show` provides detailed information, while `simple-show` displays information more simply.
51
-
52
- Executing a command like `python cm-cli.py show installed` will display detailed information about the installed custom nodes.
53
-
54
- ```
55
- -= ComfyUI-Manager CLI (V2.24) =-
56
-
57
- FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
58
- [ ENABLED ] ComfyUI-Manager (author: Dr.Lt.Data)
59
- [ ENABLED ] ComfyUI-Impact-Pack (author: Dr.Lt.Data)
60
- [ ENABLED ] ComfyUI-Inspire-Pack (author: Dr.Lt.Data)
61
- [ ENABLED ] ComfyUI_experiments (author: comfyanonymous)
62
- [ ENABLED ] ComfyUI-SAI_API (author: Stability-AI)
63
- [ ENABLED ] stability-ComfyUI-nodes (author: Stability-AI)
64
- [ ENABLED ] comfyui_controlnet_aux (author: Fannovel16)
65
- [ ENABLED ] ComfyUI-Frame-Interpolation (author: Fannovel16)
66
- [ DISABLED ] ComfyUI-Loopchain (author: Fannovel16)
67
- ```
68
-
69
- Using a command like `python cm-cli.py simple-show installed` will simply display information about the installed custom nodes.
70
-
71
- ```
72
- -= ComfyUI-Manager CLI (V2.24) =-
73
-
74
- FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
75
- ComfyUI-Manager
76
- ComfyUI-Impact-Pack
77
- ComfyUI-Inspire-Pack
78
- ComfyUI_experiments
79
- ComfyUI-SAI_API
80
- stability-ComfyUI-nodes
81
- comfyui_controlnet_aux
82
- ComfyUI-Frame-Interpolation
83
- ComfyUI-Loopchain
84
- ```
85
-
86
- `[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]`
87
- * `enabled`, `disabled`: Shows nodes that have been enabled or disabled among the installed custom nodes.
88
- * `installed`: Shows all nodes that have been installed, regardless of whether they are enabled or disabled.
89
- * `not-installed`: Shows a list of custom nodes that have not been installed.
90
- * `all`: Shows a list of all custom nodes.
91
- * `snapshot`: Displays snapshot information of the currently installed custom nodes. When viewed with `show`, it is displayed in JSON format, and with `simple-show`, it is displayed simply, along with the commit hash.
92
- * `snapshot-list`: Shows a list of snapshot files stored in ComfyUI-Manager/snapshots.
93
-
94
- ### 3. Managing Custom Nodes
95
-
96
- `[install|reinstall|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
97
-
98
- * You can apply management functions by listing the names of custom nodes, such as `python cm-cli.py install ComfyUI-Impact-Pack ComfyUI-Inspire-Pack ComfyUI_experiments`.
99
- * The names of the custom nodes are as shown by `show` and are the names of the git repositories.
100
- (Plans are to update the use of nicknames in the future.)
101
-
102
- `[update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
103
-
104
- * The `update, disable, enable, fix` functions can be specified for all.
105
-
106
- * Detailed Operations
107
- * `install`: Installs the specified custom nodes.
108
- * `reinstall`: Removes and then reinstalls the specified custom nodes.
109
- * `uninstall`: Uninstalls the specified custom nodes.
110
- * `update`: Updates the specified custom nodes.
111
- * `disable`: Disables the specified custom nodes.
112
- * `enable`: Enables the specified custom nodes.
113
- * `fix`: Attempts to fix dependencies for the specified custom nodes.
114
-
115
-
116
- ### 4. Snapshot Management
117
- * `python cm-cli.py save-snapshot [--output <snapshot .json/.yaml>]`: Saves the current snapshot.
118
- * With `--output`, you can save a file in .yaml format to any specified path.
119
- * `python cm-cli.py restore-snapshot <snapshot .json/.yaml>`: Restores to the specified snapshot.
120
- * If a file exists at the snapshot path, that snapshot is loaded.
121
- * If no file exists at the snapshot path, it is implicitly assumed to be in ComfyUI-Manager/snapshots.
122
- * `--pip-non-url`: Restore for pip packages registered on PyPI.
123
- * `--pip-non-local-url`: Restore for pip packages registered at web URLs.
124
- * `--pip-local-url`: Restore for pip packages specified by local paths.
125
-
126
-
127
- ### 5. CLI Only Mode
128
-
129
- You can set whether to use ComfyUI-Manager solely via CLI.
130
-
131
- `cli-only-mode [enable|disable]`
132
-
133
- * This mode can be used if you want to restrict the use of ComfyUI-Manager through the GUI for security or policy reasons.
134
- * When CLI only mode is enabled, ComfyUI-Manager is loaded in a very restricted state, the internal web API is disabled, and the Manager button is not displayed in the main menu.
135
-
136
- ### 6. Dependency Restoration
137
-
138
- `restore-dependencies`
139
-
140
- * This command can be used if custom nodes are installed under the `ComfyUI/custom_nodes` path but their dependencies are not installed.
141
- * It is useful when starting a new cloud instance, like colab, where dependencies need to be reinstalled and installation scripts re-executed.
142
- * It can also be utilized if ComfyUI is reinstalled and only the custom_nodes path has been backed up and restored.
143
-
144
- ### 7. Clear
145
-
146
- In the GUI, installations, updates, or snapshot restorations are scheduled to execute the next time ComfyUI is launched. The `clear` command clears this scheduled state, ensuring no pre-execution actions are applied.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/docs/en/use_aria2.md DELETED
@@ -1,40 +0,0 @@
1
- # Use `aria2` as downloader
2
-
3
- Two environment variables are needed to use `aria2` as the downloader.
4
-
5
- ```bash
6
- export COMFYUI_MANAGER_ARIA2_SERVER=http://127.0.0.1:6800
7
- export COMFYUI_MANAGER_ARIA2_SECRET=__YOU_MUST_CHANGE_IT__
8
- ```
9
-
10
- An example `docker-compose.yml`
11
-
12
- ```yaml
13
- services:
14
-
15
- aria2:
16
- container_name: aria2
17
- image: p3terx/aria2-pro
18
- environment:
19
- - PUID=1000
20
- - PGID=1000
21
- - UMASK_SET=022
22
- - RPC_SECRET=__YOU_MUST_CHANGE_IT__
23
- - RPC_PORT=5080
24
- - DISK_CACHE=64M
25
- - IPV6_MODE=false
26
- - UPDATE_TRACKERS=false
27
- - CUSTOM_TRACKER_URL=
28
- volumes:
29
- - ./config:/config
30
- - ./downloads:/downloads
31
- - ~/ComfyUI/models:/models
32
- - ~/ComfyUI/custom_nodes:/custom_nodes
33
- ports:
34
- - 6800:6800
35
- restart: unless-stopped
36
- logging:
37
- driver: json-file
38
- options:
39
- max-size: 1m
40
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/docs/ko/cm-cli.md DELETED
@@ -1,149 +0,0 @@
1
- # `cm-cli`: ComfyUI-Manager CLI
2
-
3
- `cm-cli` 는 ComfyUI를 실행시키지 않고 command line에서 ComfyUI-Manager의 여러가지 기능을 사용할 수 있도록 도와주는 도구입니다.
4
-
5
-
6
- ```
7
- -= ComfyUI-Manager CLI (V2.24) =-
8
-
9
-
10
- python cm-cli.py [OPTIONS]
11
-
12
- OPTIONS:
13
- [install|reinstall|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]
14
- [update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]
15
- [simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]
16
- save-snapshot ?[--output <snapshot .json/.yaml>]
17
- restore-snapshot <snapshot .json/.yaml> ?[--pip-non-url] ?[--pip-non-local-url] ?[--pip-local-url]
18
- cli-only-mode [enable|disable]
19
- restore-dependencies
20
- clear
21
- ```
22
-
23
- ## How To Use?
24
- * `python cm-cli.py` 를 통해서 실행 시킬 수 있습니다.
25
- * 예를 들어 custom node를 모두 업데이트 하고 싶다면
26
- * ComfyUI-Manager경로 에서 `python cm-cli.py update all` 를 command를 실행할 수 있습니다.
27
- * ComfyUI 경로에서 실행한다면, `python custom_nodes/ComfyUI-Manager/cm-cli.py update all` 와 같이 cm-cli.py 의 경로를 지정할 수도 있습니다.
28
-
29
- ## Prerequisite
30
- * ComfyUI 를 실행하는 python과 동일한 python 환경에서 실행해야 합니다.
31
- * venv를 사용할 경우 해당 venv를 activate 한 상태에서 실행해야 합니다.
32
- * portable 버전을 사용할 경우 run_nvidia_gpu.bat 파일이 있는 경로인 경우, 다음과 같은 방식으로 코맨드를 실행해야 합니다.
33
- `.\python_embeded\python.exe ComfyUI\custom_nodes\ComfyUI-Manager\cm-cli.py update all`
34
- * ComfyUI 의 경로는 COMFYUI_PATH 환경 변수로 설정할 수 있습니다. 만약 생략할 경우 다음과 같은 경고 메시지가 나타나며, ComfyUI-Manager가 설치된 경로를 기준으로 상대 경로로 설정됩니다.
35
- ```
36
- WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.
37
- ```
38
-
39
- ## Features
40
-
41
- ### 1. --channel, --mode
42
- * 정보 보기 기능과 커스텀 노드 관리 기능의 경우는 --channel과 --mode를 통해 정보 DB를 설정할 수 있습니다.
43
- * 예들 들어 `python cm-cli.py update all --channel recent --mode remote`와 같은 command를 실행할 경우, 현재 ComfyUI-Manager repo에 내장된 로컬의 정보가 아닌 remote의 최신 정보를 기준으로 동작하며, recent channel에 있는 목록을 대상으로만 동작합니다.
44
- * --channel, --mode 는 `simple-show, show, install, uninstall, update, disable, enable, fix` command에서만 사용 가능합니다.
45
-
46
- ### 2. 관리 정보 보기
47
-
48
- `[simple-show|show] [installed|enabled|not-installed|disabled|all|snapshot|snapshot-list] ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
49
-
50
-
51
- * `[show|simple-show]` - `show`는 상세하게 정보를 보여주며, `simple-show`는 간단하게 정보를 보여줍니다.
52
-
53
-
54
- `python cm-cli.py show installed` 와 같은 코맨드를 실행하면 설치된 커스텀 노드의 정보를 상세하게 보여줍니다.
55
- ```
56
- -= ComfyUI-Manager CLI (V2.24) =-
57
-
58
- FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
59
- [ ENABLED ] ComfyUI-Manager (author: Dr.Lt.Data)
60
- [ ENABLED ] ComfyUI-Impact-Pack (author: Dr.Lt.Data)
61
- [ ENABLED ] ComfyUI-Inspire-Pack (author: Dr.Lt.Data)
62
- [ ENABLED ] ComfyUI_experiments (author: comfyanonymous)
63
- [ ENABLED ] ComfyUI-SAI_API (author: Stability-AI)
64
- [ ENABLED ] stability-ComfyUI-nodes (author: Stability-AI)
65
- [ ENABLED ] comfyui_controlnet_aux (author: Fannovel16)
66
- [ ENABLED ] ComfyUI-Frame-Interpolation (author: Fannovel16)
67
- [ DISABLED ] ComfyUI-Loopchain (author: Fannovel16)
68
- ```
69
-
70
- `python cm-cli.py simple-show installed` 와 같은 코맨드를 이용해서 설치된 커스텀 노드의 정보를 간단하게 보여줍니다.
71
-
72
- ```
73
- -= ComfyUI-Manager CLI (V2.24) =-
74
-
75
- FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
76
- ComfyUI-Manager
77
- ComfyUI-Impact-Pack
78
- ComfyUI-Inspire-Pack
79
- ComfyUI_experiments
80
- ComfyUI-SAI_API
81
- stability-ComfyUI-nodes
82
- comfyui_controlnet_aux
83
- ComfyUI-Frame-Interpolation
84
- ComfyUI-Loopchain
85
- ```
86
-
87
- * `[installed|enabled|not-installed|disabled|all|snapshot|snapshot-list]`
88
- * `enabled`, `disabled`: 설치된 커스텀 노드들 중 enable 되었거나, disable된 노드들을 보여줍니다.
89
- * `installed`: enable, disable 여부와 상관없이 설치된 모든 노드를 보여줍니다
90
- * `not-installed`: 설치되지 않은 커스텀 노드의 목록을 보여줍니다.
91
- * `all`: 모든 커스텀 노드의 목록을 보여줍니다.
92
- * `snapshot`: 현재 설치된 커스텀 노드의 snapshot 정보를 보여줍니다. `show`롤 통해서 볼 경우는 json 출력 형태로 보여주며, `simple-show`를 통해서 볼 경우는 간단하게, 커밋 해시와 함께 보여줍니다.
93
- * `snapshot-list`: ComfyUI-Manager/snapshots 에 저장된 snapshot 파일의 목록을 보여줍니다.
94
-
95
- ### 3. 커스텀 노드 관리 하기
96
-
97
- `[install|reinstall|uninstall|update|disable|enable|fix] node_name ... ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
98
-
99
- * `python cm-cli.py install ComfyUI-Impact-Pack ComfyUI-Inspire-Pack ComfyUI_experiments` 와 같이 커스텀 노드의 이름을 나열해서 관리 기능을 적용할 수 있습니다.
100
- * 커스텀 노드의 이름은 `show`를 했을 때 보여주는 이름이며, git repository의 이름입니다.
101
- (추후 nickname 을 사용가능하돌고 업데이트 할 예정입니다.)
102
-
103
- `[update|disable|enable|fix] all ?[--channel <channel name>] ?[--mode [remote|local|cache]]`
104
-
105
- * `update, disable, enable, fix` 기능은 all 로 지정 가능합니다.
106
-
107
- * 세부 동작
108
- * `install`: 지정된 커스텀 노드들을 설치합니다
109
- * `reinstall`: 지정된 커스텀 노드를 삭제하고 재설치 합니다.
110
- * `uninstall`: 지정된 커스텀 노드들을 삭제합니다.
111
- * `update`: 지정된 커스텀 노드들을 업데이트합니다.
112
- * `disable`: 지정된 커스텀 노드들을 비활성화합니다.
113
- * `enable`: 지정된 커스텀 노드들을 활성화합니다.
114
- * `fix`: 지정된 커스텀 노드의 의존성을 고치기 위한 시도를 합니다.
115
-
116
-
117
- ### 4. 스냅샷 관리 기능
118
- * `python cm-cli.py save-snapshot ?[--output <snapshot .json/.yaml>]`: 현재의 snapshot을 저장합니다.
119
- * --output 으로 임의의 경로에 .yaml 파일과 format으로 저장할 수 있습니다.
120
- * `python cm-cli.py restore-snapshot <snapshot .json/.yaml>`: 지정된 snapshot으로 복구합니다.
121
- * snapshot 경로에 파일이 존재하는 경우 해당 snapshot을 로드합니다.
122
- * snapshot 경로에 파일이 존재하지 않는 경우 묵시적으로, ComfyUI-Manager/snapshots 에 있다고 가정합니다.
123
- * `--pip-non-url`: PyPI 에 등록된 pip 패키지들에 대해서 복구를 수행
124
- * `--pip-non-local-url`: web URL에 등록된 pip 패키지들에 대해서 복구를 수행
125
- * `--pip-local-url`: local 경로를 지정하고 있는 pip 패키지들에 대해서 복구를 수행
126
-
127
-
128
- ### 5. CLI only mode
129
-
130
- ComfyUI-Manager를 CLI로만 사용할 것인지를 설정할 수 있습니다.
131
-
132
- `cli-only-mode [enable|disable]`
133
-
134
- * security 혹은 policy 의 이유로 GUI 를 통한 ComfyUI-Manager 사용을 제한하고 싶은 경우 이 모드를 사용할 수 있습니다.
135
- * CLI only mode를 적용할 경우 ComfyUI-Manager 가 매우 제한된 상태로 로드되어, 내부적으로 제공하는 web API가 비활성화 되며, 메인 메뉴에서도 Manager 버튼이 표시되지 않습니다.
136
-
137
-
138
- ### 6. 의존성 설치
139
-
140
- `restore-dependencies`
141
-
142
- * `ComfyUI/custom_nodes` 하위 경로에 커스텀 노드들이 설치되어 있긴 하지만, 의존성이 설치되지 않은 경우 사용할 수 있습니다.
143
- * colab 과 같이 cloud instance를 새로 시작하는 경우 의존성 재설치 및 설치 스크립트가 재실행 되어야 하는 경우 사용합니다.
144
- * ComfyUI을 재설치할 경우, custom_nodes 경로만 백업했다가 재설치 할 경우 활용 가능합니다.
145
-
146
-
147
- ### 7. clear
148
-
149
- GUI에서 install, update를 하거나 snapshot 을 restore하는 경우 예약을 통해서 다음번 ComfyUI를 실행할 경우 실행되는 구조입니다. `clear` 는 이런 예약 상태를 clear해서, 아무런 사전 실행이 적용되지 않도록 합니다.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/extension-node-map.json DELETED
The diff for this file is too large to render. See raw diff
 
custom_nodes/comfyui-manager/extras.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "favorites": [
3
- "comfyui_ipadapter_plus",
4
- "comfyui-animatediff-evolved",
5
- "comfyui_controlnet_aux",
6
- "comfyui-impact-pack",
7
- "comfyui-impact-subpack",
8
- "comfyui-custom-scripts",
9
- "comfyui-layerdiffuse",
10
- "comfyui-liveportraitkj",
11
- "aigodlike-comfyui-translation",
12
- "comfyui-reactor",
13
- "comfyui_instantid",
14
- "sd-dynamic-thresholding",
15
- "pr-was-node-suite-comfyui-47064894",
16
- "comfyui-advancedliveportrait",
17
- "comfyui_layerstyle",
18
- "efficiency-nodes-comfyui",
19
- "comfyui-crystools",
20
- "comfyui-advanced-controlnet",
21
- "comfyui-videohelpersuite",
22
- "comfyui-kjnodes",
23
- "comfy-mtb",
24
- "comfyui_essentials"
25
- ]
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/git_helper.py DELETED
@@ -1,509 +0,0 @@
1
- import subprocess
2
- import sys
3
- import os
4
- import traceback
5
-
6
- import git
7
- import json
8
- import yaml
9
- import requests
10
- from tqdm.auto import tqdm
11
- from git.remote import RemoteProgress
12
-
13
-
14
- comfy_path = os.environ.get('COMFYUI_PATH')
15
- git_exe_path = os.environ.get('GIT_EXE_PATH')
16
-
17
- if comfy_path is None:
18
- print("\nWARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI path.", file=sys.stderr)
19
- comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
20
-
21
-
22
- def download_url(url, dest_folder, filename=None):
23
- # Ensure the destination folder exists
24
- if not os.path.exists(dest_folder):
25
- os.makedirs(dest_folder)
26
-
27
- # Extract filename from URL if not provided
28
- if filename is None:
29
- filename = os.path.basename(url)
30
-
31
- # Full path to save the file
32
- dest_path = os.path.join(dest_folder, filename)
33
-
34
- # Download the file
35
- response = requests.get(url, stream=True)
36
- if response.status_code == 200:
37
- with open(dest_path, 'wb') as file:
38
- for chunk in response.iter_content(chunk_size=1024):
39
- if chunk:
40
- file.write(chunk)
41
- else:
42
- print(f"Failed to download file from {url}")
43
-
44
-
45
- nodelist_path = os.path.join(os.path.dirname(__file__), "custom-node-list.json")
46
- working_directory = os.getcwd()
47
-
48
- if os.path.basename(working_directory) != 'custom_nodes':
49
- print("WARN: This script should be executed in custom_nodes dir")
50
- print(f"DBG: INFO {working_directory}")
51
- print(f"DBG: INFO {sys.argv}")
52
- # exit(-1)
53
-
54
-
55
- class GitProgress(RemoteProgress):
56
- def __init__(self):
57
- super().__init__()
58
- self.pbar = tqdm(ascii=True)
59
-
60
- def update(self, op_code, cur_count, max_count=None, message=''):
61
- self.pbar.total = max_count
62
- self.pbar.n = cur_count
63
- self.pbar.pos = 0
64
- self.pbar.refresh()
65
-
66
-
67
- def gitclone(custom_nodes_path, url, target_hash=None, repo_path=None):
68
- repo_name = os.path.splitext(os.path.basename(url))[0]
69
-
70
- if repo_path is None:
71
- repo_path = os.path.join(custom_nodes_path, repo_name)
72
-
73
- # Clone the repository from the remote URL
74
- repo = git.Repo.clone_from(url, repo_path, recursive=True, progress=GitProgress())
75
-
76
- if target_hash is not None:
77
- print(f"CHECKOUT: {repo_name} [{target_hash}]")
78
- repo.git.checkout(target_hash)
79
-
80
- repo.git.clear_cache()
81
- repo.close()
82
-
83
-
84
- def gitcheck(path, do_fetch=False):
85
- try:
86
- # Fetch the latest commits from the remote repository
87
- repo = git.Repo(path)
88
-
89
- if repo.head.is_detached:
90
- print("CUSTOM NODE CHECK: True")
91
- return
92
-
93
- current_branch = repo.active_branch
94
- branch_name = current_branch.name
95
-
96
- remote_name = current_branch.tracking_branch().remote_name
97
- remote = repo.remote(name=remote_name)
98
-
99
- if do_fetch:
100
- remote.fetch()
101
-
102
- # Get the current commit hash and the commit hash of the remote branch
103
- commit_hash = repo.head.commit.hexsha
104
-
105
- if f'{remote_name}/{branch_name}' in repo.refs:
106
- remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha
107
- else:
108
- print("CUSTOM NODE CHECK: True") # non default branch is treated as updatable
109
- return
110
-
111
- # Compare the commit hashes to determine if the local repository is behind the remote repository
112
- if commit_hash != remote_commit_hash:
113
- # Get the commit dates
114
- commit_date = repo.head.commit.committed_datetime
115
- remote_commit_date = repo.refs[f'{remote_name}/{branch_name}'].object.committed_datetime
116
-
117
- # Compare the commit dates to determine if the local repository is behind the remote repository
118
- if commit_date < remote_commit_date:
119
- print("CUSTOM NODE CHECK: True")
120
- else:
121
- print("CUSTOM NODE CHECK: False")
122
- except Exception as e:
123
- print(e)
124
- print("CUSTOM NODE CHECK: Error")
125
-
126
-
127
- def get_remote_name(repo):
128
- available_remotes = [remote.name for remote in repo.remotes]
129
- if 'origin' in available_remotes:
130
- return 'origin'
131
- elif 'upstream' in available_remotes:
132
- return 'upstream'
133
- elif len(available_remotes) > 0:
134
- return available_remotes[0]
135
-
136
- if not available_remotes:
137
- print(f"[ComfyUI-Manager] No remotes are configured for this repository: {repo.working_dir}")
138
- else:
139
- print(f"[ComfyUI-Manager] Available remotes in '{repo.working_dir}': ")
140
- for remote in available_remotes:
141
- print(f"- {remote}")
142
-
143
- return None
144
-
145
-
146
- def switch_to_default_branch(repo):
147
- remote_name = get_remote_name(repo)
148
-
149
- try:
150
- if remote_name is None:
151
- return False
152
-
153
- default_branch = repo.git.symbolic_ref(f'refs/remotes/{remote_name}/HEAD').replace(f'refs/remotes/{remote_name}/', '')
154
- repo.git.checkout(default_branch)
155
- return True
156
- except:
157
- try:
158
- repo.git.checkout(repo.heads.master)
159
- except:
160
- try:
161
- if remote_name is not None:
162
- repo.git.checkout('-b', 'master', f'{remote_name}/master')
163
- except:
164
- pass
165
-
166
- print("[ComfyUI Manager] Failed to switch to the default branch")
167
- return False
168
-
169
-
170
- def gitpull(path):
171
- # Check if the path is a git repository
172
- if not os.path.exists(os.path.join(path, '.git')):
173
- raise ValueError('Not a git repository')
174
-
175
- # Pull the latest changes from the remote repository
176
- repo = git.Repo(path)
177
- if repo.is_dirty():
178
- print(f"STASH: '{path}' is dirty.")
179
- repo.git.stash()
180
-
181
- commit_hash = repo.head.commit.hexsha
182
- try:
183
- if repo.head.is_detached:
184
- switch_to_default_branch(repo)
185
-
186
- current_branch = repo.active_branch
187
- branch_name = current_branch.name
188
-
189
- remote_name = current_branch.tracking_branch().remote_name
190
- remote = repo.remote(name=remote_name)
191
-
192
- if f'{remote_name}/{branch_name}' not in repo.refs:
193
- switch_to_default_branch(repo)
194
- current_branch = repo.active_branch
195
- branch_name = current_branch.name
196
-
197
- remote.fetch()
198
- if f'{remote_name}/{branch_name}' in repo.refs:
199
- remote_commit_hash = repo.refs[f'{remote_name}/{branch_name}'].object.hexsha
200
- else:
201
- print("CUSTOM NODE PULL: Fail") # update fail
202
- return
203
-
204
- if commit_hash == remote_commit_hash:
205
- print("CUSTOM NODE PULL: None") # there is no update
206
- repo.close()
207
- return
208
-
209
- remote.pull()
210
-
211
- repo.git.submodule('update', '--init', '--recursive')
212
- new_commit_hash = repo.head.commit.hexsha
213
-
214
- if commit_hash != new_commit_hash:
215
- print("CUSTOM NODE PULL: Success") # update success
216
- else:
217
- print("CUSTOM NODE PULL: Fail") # update fail
218
- except Exception as e:
219
- print(e)
220
- print("CUSTOM NODE PULL: Fail") # unknown git error
221
-
222
- repo.close()
223
-
224
-
225
- def checkout_comfyui_hash(target_hash):
226
- repo = git.Repo(comfy_path)
227
- commit_hash = repo.head.commit.hexsha
228
-
229
- if commit_hash != target_hash:
230
- try:
231
- print(f"CHECKOUT: ComfyUI [{target_hash}]")
232
- repo.git.checkout(target_hash)
233
- except git.GitCommandError as e:
234
- print(f"Error checking out the ComfyUI: {str(e)}")
235
-
236
-
237
- def checkout_custom_node_hash(git_custom_node_infos):
238
- repo_name_to_url = {}
239
-
240
- for url in git_custom_node_infos.keys():
241
- repo_name = url.split('/')[-1]
242
-
243
- if repo_name.endswith('.git'):
244
- repo_name = repo_name[:-4]
245
-
246
- repo_name_to_url[repo_name] = url
247
-
248
- for path in os.listdir(working_directory):
249
- if path.endswith("ComfyUI-Manager"):
250
- continue
251
-
252
- fullpath = os.path.join(working_directory, path)
253
-
254
- if os.path.isdir(fullpath):
255
- is_disabled = path.endswith(".disabled")
256
-
257
- try:
258
- git_dir = os.path.join(fullpath, '.git')
259
- if not os.path.exists(git_dir):
260
- continue
261
-
262
- need_checkout = False
263
- repo_name = os.path.basename(fullpath)
264
-
265
- if repo_name.endswith('.disabled'):
266
- repo_name = repo_name[:-9]
267
-
268
- if repo_name not in repo_name_to_url:
269
- if not is_disabled:
270
- # should be disabled
271
- print(f"DISABLE: {repo_name}")
272
- new_path = fullpath + ".disabled"
273
- os.rename(fullpath, new_path)
274
- need_checkout = False
275
- else:
276
- item = git_custom_node_infos[repo_name_to_url[repo_name]]
277
- if item['disabled'] and is_disabled:
278
- pass
279
- elif item['disabled'] and not is_disabled:
280
- # disable
281
- print(f"DISABLE: {repo_name}")
282
- new_path = fullpath + ".disabled"
283
- os.rename(fullpath, new_path)
284
-
285
- elif not item['disabled'] and is_disabled:
286
- # enable
287
- print(f"ENABLE: {repo_name}")
288
- new_path = fullpath[:-9]
289
- os.rename(fullpath, new_path)
290
- fullpath = new_path
291
- need_checkout = True
292
- else:
293
- need_checkout = True
294
-
295
- if need_checkout:
296
- repo = git.Repo(fullpath)
297
- commit_hash = repo.head.commit.hexsha
298
-
299
- if commit_hash != item['hash']:
300
- print(f"CHECKOUT: {repo_name} [{item['hash']}]")
301
- repo.git.checkout(item['hash'])
302
-
303
- except Exception:
304
- print(f"Failed to restore snapshots for the custom node '{path}'")
305
-
306
- # clone missing
307
- for k, v in git_custom_node_infos.items():
308
- if 'ComfyUI-Manager' in k:
309
- continue
310
-
311
- if not v['disabled']:
312
- repo_name = k.split('/')[-1]
313
- if repo_name.endswith('.git'):
314
- repo_name = repo_name[:-4]
315
-
316
- path = os.path.join(working_directory, repo_name)
317
- if not os.path.exists(path):
318
- print(f"CLONE: {path}")
319
- gitclone(working_directory, k, target_hash=v['hash'])
320
-
321
-
322
- def invalidate_custom_node_file(file_custom_node_infos):
323
- global nodelist_path
324
-
325
- enabled_set = set()
326
- for item in file_custom_node_infos:
327
- if not item['disabled']:
328
- enabled_set.add(item['filename'])
329
-
330
- for path in os.listdir(working_directory):
331
- fullpath = os.path.join(working_directory, path)
332
-
333
- if not os.path.isdir(fullpath) and fullpath.endswith('.py'):
334
- if path not in enabled_set:
335
- print(f"DISABLE: {path}")
336
- new_path = fullpath+'.disabled'
337
- os.rename(fullpath, new_path)
338
-
339
- elif not os.path.isdir(fullpath) and fullpath.endswith('.py.disabled'):
340
- path = path[:-9]
341
- if path in enabled_set:
342
- print(f"ENABLE: {path}")
343
- new_path = fullpath[:-9]
344
- os.rename(fullpath, new_path)
345
-
346
- # download missing: just support for 'copy' style
347
- py_to_url = {}
348
-
349
- with open(nodelist_path, 'r', encoding="UTF-8") as json_file:
350
- info = json.load(json_file)
351
- for item in info['custom_nodes']:
352
- if item['install_type'] == 'copy':
353
- for url in item['files']:
354
- if url.endswith('.py'):
355
- py = url.split('/')[-1]
356
- py_to_url[py] = url
357
-
358
- for item in file_custom_node_infos:
359
- filename = item['filename']
360
- if not item['disabled']:
361
- target_path = os.path.join(working_directory, filename)
362
-
363
- if not os.path.exists(target_path) and filename in py_to_url:
364
- url = py_to_url[filename]
365
- print(f"DOWNLOAD: {filename}")
366
- download_url(url, working_directory)
367
-
368
-
369
- def apply_snapshot(path):
370
- try:
371
- if os.path.exists(path):
372
- if not path.endswith('.json') and not path.endswith('.yaml'):
373
- print(f"Snapshot file not found: `{path}`")
374
- print("APPLY SNAPSHOT: False")
375
- return None
376
-
377
- with open(path, 'r', encoding="UTF-8") as snapshot_file:
378
- if path.endswith('.json'):
379
- info = json.load(snapshot_file)
380
- elif path.endswith('.yaml'):
381
- info = yaml.load(snapshot_file, Loader=yaml.SafeLoader)
382
- info = info['custom_nodes']
383
- else:
384
- # impossible case
385
- print("APPLY SNAPSHOT: False")
386
- return None
387
-
388
- comfyui_hash = info['comfyui']
389
- git_custom_node_infos = info['git_custom_nodes']
390
- file_custom_node_infos = info['file_custom_nodes']
391
-
392
- checkout_comfyui_hash(comfyui_hash)
393
- checkout_custom_node_hash(git_custom_node_infos)
394
- invalidate_custom_node_file(file_custom_node_infos)
395
-
396
- print("APPLY SNAPSHOT: True")
397
- if 'pips' in info:
398
- return info['pips']
399
- else:
400
- return None
401
-
402
- print(f"Snapshot file not found: `{path}`")
403
- print("APPLY SNAPSHOT: False")
404
-
405
- return None
406
- except Exception as e:
407
- print(e)
408
- traceback.print_exc()
409
- print("APPLY SNAPSHOT: False")
410
-
411
- return None
412
-
413
-
414
- def restore_pip_snapshot(pips, options):
415
- non_url = []
416
- local_url = []
417
- non_local_url = []
418
- for k, v in pips.items():
419
- if v == "":
420
- non_url.append(k)
421
- else:
422
- if v.startswith('file:'):
423
- local_url.append(v)
424
- else:
425
- non_local_url.append(v)
426
-
427
- failed = []
428
- if '--pip-non-url' in options:
429
- # try all at once
430
- res = 1
431
- try:
432
- res = subprocess.check_call([sys.executable, '-m', 'pip', 'install'] + non_url)
433
- except:
434
- pass
435
-
436
- # fallback
437
- if res != 0:
438
- for x in non_url:
439
- res = 1
440
- try:
441
- res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
442
- except:
443
- pass
444
-
445
- if res != 0:
446
- failed.append(x)
447
-
448
- if '--pip-non-local-url' in options:
449
- for x in non_local_url:
450
- res = 1
451
- try:
452
- res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
453
- except:
454
- pass
455
-
456
- if res != 0:
457
- failed.append(x)
458
-
459
- if '--pip-local-url' in options:
460
- for x in local_url:
461
- res = 1
462
- try:
463
- res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
464
- except:
465
- pass
466
-
467
- if res != 0:
468
- failed.append(x)
469
-
470
- print(f"Installation failed for pip packages: {failed}")
471
-
472
-
473
- def setup_environment():
474
- if git_exe_path is not None:
475
- git.Git().update_environment(GIT_PYTHON_GIT_EXECUTABLE=git_exe_path)
476
-
477
-
478
- setup_environment()
479
-
480
-
481
- try:
482
- if sys.argv[1] == "--clone":
483
- repo_path = None
484
- if len(sys.argv) > 4:
485
- repo_path = sys.argv[4]
486
-
487
- gitclone(sys.argv[2], sys.argv[3], repo_path=repo_path)
488
- elif sys.argv[1] == "--check":
489
- gitcheck(sys.argv[2], False)
490
- elif sys.argv[1] == "--fetch":
491
- gitcheck(sys.argv[2], True)
492
- elif sys.argv[1] == "--pull":
493
- gitpull(sys.argv[2])
494
- elif sys.argv[1] == "--apply-snapshot":
495
- options = set()
496
- for x in sys.argv:
497
- if x in ['--pip-non-url', '--pip-local-url', '--pip-non-local-url']:
498
- options.add(x)
499
-
500
- pips = apply_snapshot(sys.argv[2])
501
-
502
- if pips and len(options) > 0:
503
- restore_pip_snapshot(pips, options)
504
- sys.exit(0)
505
- except Exception as e:
506
- print(e)
507
- sys.exit(-1)
508
-
509
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom_nodes/comfyui-manager/github-stats.json DELETED
The diff for this file is too large to render. See raw diff
 
custom_nodes/comfyui-manager/glob/__pycache__/cm_global.cpython-312.pyc DELETED
Binary file (2.85 kB)
 
custom_nodes/comfyui-manager/glob/__pycache__/cnr_utils.cpython-312.pyc DELETED
Binary file (8.91 kB)
 
custom_nodes/comfyui-manager/glob/__pycache__/git_utils.cpython-312.pyc DELETED
Binary file (3.09 kB)
 
custom_nodes/comfyui-manager/glob/__pycache__/manager_core.cpython-312.pyc DELETED
Binary file (137 kB)
 
custom_nodes/comfyui-manager/glob/__pycache__/manager_downloader.cpython-312.pyc DELETED
Binary file (6.19 kB)
 
custom_nodes/comfyui-manager/glob/__pycache__/manager_server.cpython-312.pyc DELETED
Binary file (82.2 kB)