Compare commits

..

2 Commits

Author SHA1 Message Date
bymyself
78269f6467 add static 2025-04-14 17:42:38 -07:00
bymyself
a9fedc0487 add is_legacy_manager_ui route to legacy package as well 2025-04-14 16:26:05 -07:00
62 changed files with 10894 additions and 32541 deletions

View File

@@ -1,70 +0,0 @@
name: CI
on:
push:
branches: [ main, feat/*, fix/* ]
pull_request:
branches: [ main ]
jobs:
validate-openapi:
name: Validate OpenAPI Specification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if OpenAPI changed
id: openapi-changed
uses: tj-actions/changed-files@v44
with:
files: openapi.yaml
- name: Setup Node.js
if: steps.openapi-changed.outputs.any_changed == 'true'
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Redoc CLI
if: steps.openapi-changed.outputs.any_changed == 'true'
run: |
npm install -g @redocly/cli
- name: Validate OpenAPI specification
if: steps.openapi-changed.outputs.any_changed == 'true'
run: |
redocly lint openapi.yaml
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper diff
- name: Get changed Python files
id: changed-py-files
uses: tj-actions/changed-files@v44
with:
files: |
**/*.py
files_ignore: |
comfyui_manager/legacy/**
- name: Setup Python
if: steps.changed-py-files.outputs.any_changed == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
if: steps.changed-py-files.outputs.any_changed == 'true'
run: |
pip install ruff
- name: Run ruff linting on changed files
if: steps.changed-py-files.outputs.any_changed == 'true'
run: |
echo "Changed files: ${{ steps.changed-py-files.outputs.all_changed_files }}"
echo "${{ steps.changed-py-files.outputs.all_changed_files }}" | xargs -r ruff check

1
.gitignore vendored
View File

@@ -19,6 +19,5 @@ pip_overrides.json
check2.sh
/venv/
build
dist
*.egg-info
.env

View File

@@ -10,5 +10,4 @@ include extension-node-list.json
include extras.json
include github-stats.json
include model-list.json
include alter-list.json
include comfyui_manager/channels.list.template
include alter-list.json

View File

@@ -9,7 +9,7 @@
* V3.16: Support for `uv` has been added. Set `use_uv` in `config.ini`.
* V3.10: `double-click feature` is removed
* This feature has been moved to https://github.com/ltdrdata/comfyui-connection-helper
* V3.3.2: Overhauled. Officially supports [https://registry.comfy.org/](https://registry.comfy.org/).
* V3.3.2: Overhauled. Officially supports [https://comfyregistry.org/](https://comfyregistry.org/).
* You can see whole nodes info on [ComfyUI Nodes Info](https://ltdrdata.github.io/) page.
## Installation

6
channels.list.template Normal file
View File

@@ -0,0 +1,6 @@
default::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main
recent::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/new
legacy::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/legacy
forked::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/forked
dev::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/dev
tutorial::https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/node_db/tutorial

2
cm-cli.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
python ./comfyui_manager/cm-cli.py $*

View File

@@ -1,49 +0,0 @@
# ComfyUI-Manager: Core Backend (glob)
This directory contains the Python backend modules that power ComfyUI-Manager, handling the core functionality of node management, downloading, security, and server operations.
## Directory Structure
- **glob/** - code for new cacheless ComfyUI-Manager
- **legacy/** - code for legacy ComfyUI-Manager
## Core Modules
- **manager_core.py**: The central implementation of management functions, handling configuration, installation, updates, and node management.
- **manager_server.py**: Implements server functionality and API endpoints for the web interface to interact with the backend.
## Specialized Modules
- **share_3rdparty.py**: Manages integration with third-party sharing platforms.
## Architecture
The backend follows a modular design pattern with clear separation of concerns:
1. **Core Layer**: Manager modules provide the primary API and business logic
2. **Utility Layer**: Helper modules provide specialized functionality
3. **Integration Layer**: Modules that connect to external systems
## Security Model
The system implements a comprehensive security framework with multiple levels:
- **Block**: Highest security - blocks most remote operations
- **High**: Allows only specific trusted operations
- **Middle**: Standard security for most users
- **Normal-**: More permissive for advanced users
- **Weak**: Lowest security for development environments
## Implementation Details
- The backend is designed to work seamlessly with ComfyUI
- Asynchronous task queuing is implemented for background operations
- The system supports multiple installation modes
- Error handling and risk assessment are integrated throughout the codebase
## API Integration
The backend exposes a REST API via `manager_server.py` that enables:
- Custom node management (install, update, disable, remove)
- Model downloading and organization
- System configuration
- Snapshot management
- Workflow component handling

View File

@@ -1,5 +1,6 @@
import os
import logging
from comfy.cli_args import args
def prestartup():
from . import prestartup_script # noqa: F401
@@ -7,8 +8,6 @@ def prestartup():
def start():
from comfy.cli_args import args
logging.info('[START] ComfyUI-Manager')
from .common import cm_global # noqa: F401
@@ -33,7 +32,6 @@ def should_be_disabled(fullpath:str) -> bool:
1. Disables the legacy ComfyUI-Manager.
2. The blocklist can be expanded later based on policies.
"""
from comfy.cli_args import args
if not args.disable_manager:
# In cases where installation is done via a zip archive, the directory name may not be comfyui-manager, and it may not contain a git repository.

View File

@@ -1,6 +0,0 @@
default::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main
recent::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/node_db/new
legacy::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/node_db/legacy
forked::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/node_db/forked
dev::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/node_db/dev
tutorial::https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/node_db/tutorial

View File

@@ -15,7 +15,7 @@ import git
import importlib
from ..common import manager_util
from .common import manager_util
# read env vars
# COMFYUI_FOLDERS_BASE_PATH is not required in cm-cli.py
@@ -35,21 +35,17 @@ if not os.path.exists(os.path.join(comfy_path, 'folder_paths.py')):
import utils.extra_config
from ..common import cm_global
from ..legacy import manager_core as core
from ..common import context
from ..legacy.manager_core import unified_manager
from ..common import cnr_utils
from .common import cm_global
from .glob import manager_core as core
from .common import context
from .glob.manager_core import unified_manager
from .common import cnr_utils
comfyui_manager_path = os.path.abspath(os.path.dirname(__file__))
cm_global.pip_blacklist = {'torch', 'torchaudio', 'torchsde', 'torchvision'}
cm_global.pip_downgrade_blacklist = ['torch', 'torchaudio', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
if sys.version_info < (3, 13):
cm_global.pip_overrides = {'numpy': 'numpy<2'}
else:
cm_global.pip_overrides = {}
cm_global.pip_blacklist = {'torch', 'torchsde', 'torchvision'}
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
cm_global.pip_overrides = {'numpy': 'numpy<2'}
if os.path.exists(os.path.join(manager_util.comfyui_manager_path, "pip_overrides.json")):
with open(os.path.join(manager_util.comfyui_manager_path, "pip_overrides.json"), 'r', encoding="UTF-8", errors="ignore") as json_file:
@@ -69,7 +65,7 @@ def check_comfyui_hash():
repo = git.Repo(comfy_path)
core.comfy_ui_revision = len(list(repo.iter_commits('HEAD')))
core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
except Exception:
except:
print('[bold yellow]INFO: Frozen ComfyUI mode.[/bold yellow]')
core.comfy_ui_revision = 0
core.comfy_ui_commit_datetime = 0
@@ -93,7 +89,7 @@ def read_downgrade_blacklist():
items = [x.strip() for x in items if x != '']
cm_global.pip_downgrade_blacklist += items
cm_global.pip_downgrade_blacklist = list(set(cm_global.pip_downgrade_blacklist))
except Exception:
except:
pass
@@ -108,7 +104,7 @@ class Ctx:
self.no_deps = False
self.mode = 'cache'
self.user_directory = None
self.custom_nodes_paths = [os.path.join(context.comfy_base_path, 'custom_nodes')]
self.custom_nodes_paths = [os.path.join(core.comfy_base_path, 'custom_nodes')]
self.manager_files_directory = os.path.dirname(__file__)
if Ctx.folder_paths is None:
@@ -151,9 +147,7 @@ class Ctx:
if os.path.exists(context.manager_pip_overrides_path):
with open(context.manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
cm_global.pip_overrides = json.load(json_file)
if sys.version_info < (3, 13):
cm_global.pip_overrides = {'numpy': 'numpy<2'}
cm_global.pip_overrides = {'numpy': 'numpy<2'}
if os.path.exists(context.manager_pip_blacklist_path):
with open(context.manager_pip_blacklist_path, 'r', encoding="UTF-8", errors="ignore") as f:
@@ -190,18 +184,13 @@ class Ctx:
cmd_ctx = Ctx()
def install_node(node_spec_str, is_all=False, cnt_msg='', **kwargs):
exit_on_fail = kwargs.get('exit_on_fail', False)
print(f"install_node exit on fail:{exit_on_fail}...")
def install_node(node_spec_str, is_all=False, cnt_msg=''):
if core.is_valid_url(node_spec_str):
# install via urls
res = asyncio.run(core.gitclone_install(node_spec_str, no_deps=cmd_ctx.no_deps))
if not res.result:
print(res.msg)
print(f"[bold red]ERROR: An error occurred while installing '{node_spec_str}'.[/bold red]")
if exit_on_fail:
sys.exit(1)
else:
print(f"{cnt_msg} [INSTALLED] {node_spec_str:50}")
else:
@@ -236,8 +225,6 @@ def install_node(node_spec_str, is_all=False, cnt_msg='', **kwargs):
print("")
else:
print(f"[bold red]ERROR: An error occurred while installing '{node_name}'.\n{res.msg}[/bold red]")
if exit_on_fail:
sys.exit(1)
def reinstall_node(node_spec_str, is_all=False, cnt_msg=''):
@@ -444,11 +431,8 @@ def show_list(kind, simple=False):
flag = kind in ['all', 'cnr', 'installed', 'enabled']
for k, v in unified_manager.active_nodes.items():
if flag:
cnr = unified_manager.cnr_map.get(k)
if cnr:
processed[k] = "[ ENABLED ] ", cnr['name'], k, cnr['publisher']['name'], v[0]
else:
processed[k] = None
cnr = unified_manager.cnr_map[k]
processed[k] = "[ ENABLED ] ", cnr['name'], k, cnr['publisher']['name'], v[0]
else:
processed[k] = None
@@ -468,11 +452,8 @@ def show_list(kind, simple=False):
continue
if flag:
cnr = unified_manager.cnr_map.get(k) # NOTE: can this be None if removed from CNR after installed
if cnr:
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], ", ".join(list(v.keys()))
else:
processed[k] = None
cnr = unified_manager.cnr_map[k]
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], ", ".join(list(v.keys()))
else:
processed[k] = None
@@ -481,11 +462,8 @@ def show_list(kind, simple=False):
continue
if flag:
cnr = unified_manager.cnr_map.get(k)
if cnr:
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], 'nightly'
else:
processed[k] = None
cnr = unified_manager.cnr_map[k]
processed[k] = "[ DISABLED ] ", cnr['name'], k, cnr['publisher']['name'], 'nightly'
else:
processed[k] = None
@@ -505,12 +483,9 @@ def show_list(kind, simple=False):
continue
if flag:
cnr = unified_manager.cnr_map.get(k)
if cnr:
ver_spec = v['latest_version']['version'] if 'latest_version' in v else '0.0.0'
processed[k] = "[ NOT INSTALLED ] ", cnr['name'], k, cnr['publisher']['name'], ver_spec
else:
processed[k] = None
cnr = unified_manager.cnr_map[k]
ver_spec = v['latest_version']['version'] if 'latest_version' in v else '0.0.0'
processed[k] = "[ NOT INSTALLED ] ", cnr['name'], k, cnr['publisher']['name'], ver_spec
else:
processed[k] = None
@@ -611,7 +586,7 @@ def get_all_installed_node_specs():
return res
def for_each_nodes(nodes, act, allow_all=True, **kwargs):
def for_each_nodes(nodes, act, allow_all=True):
is_all = False
if allow_all and 'all' in nodes:
is_all = True
@@ -623,7 +598,7 @@ def for_each_nodes(nodes, act, allow_all=True, **kwargs):
i = 1
for x in nodes:
try:
act(x, is_all=is_all, cnt_msg=f'{i}/{total}', **kwargs)
act(x, is_all=is_all, cnt_msg=f'{i}/{total}')
except Exception as e:
print(f"ERROR: {e}")
traceback.print_exc()
@@ -667,17 +642,13 @@ def install(
None,
help="user directory"
),
exit_on_fail: bool = typer.Option(
False,
help="Exit on failure"
)
):
cmd_ctx.set_user_directory(user_directory)
cmd_ctx.set_channel_mode(channel, mode)
cmd_ctx.set_no_deps(no_deps)
pip_fixer = manager_util.PIPFixer(manager_util.get_installed_packages(), comfy_path, context.manager_files_path)
for_each_nodes(nodes, act=install_node, exit_on_fail=exit_on_fail)
for_each_nodes(nodes, act=install_node)
pip_fixer.fix_broken()
@@ -1237,7 +1208,7 @@ def install_deps(
with open(deps, 'r', encoding="UTF-8", errors="ignore") as json_file:
try:
json_obj = json.load(json_file)
except Exception:
except:
print(f"[bold red]Invalid json file: {deps}[/bold red]")
exit(1)
@@ -1298,10 +1269,6 @@ def export_custom_node_ids(
print(f"{x['id']}@unknown", file=output_file)
def main():
app()
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(app())

View File

View File

@@ -1,16 +0,0 @@
# ComfyUI-Manager: Core Backend (glob)
This directory contains the Python backend modules that power ComfyUI-Manager, handling the core functionality of node management, downloading, security, and server operations.
## Core Modules
- **manager_downloader.py**: Handles downloading operations for models, extensions, and other resources.
- **manager_util.py**: Provides utility functions used throughout the system.
## Specialized Modules
- **cm_global.py**: Maintains global variables and state management across the system.
- **cnr_utils.py**: Helper utilities for interacting with the custom node registry (CNR).
- **git_utils.py**: Git-specific utilities for repository operations.
- **node_package.py**: Handles the packaging and installation of node extensions.
- **security_check.py**: Implements the multi-level security system for installation safety.

View File

@@ -112,7 +112,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
json_obj = await fetch_all()
manager_util.save_to_cache(uri, json_obj)
return json_obj['nodes']
except Exception:
except:
res = {}
print("Cannot connect to comfyregistry.")
finally:
@@ -237,7 +237,7 @@ def generate_cnr_id(fullpath, cnr_id):
if not os.path.exists(cnr_id_path):
with open(cnr_id_path, "w") as f:
return f.write(cnr_id)
except Exception:
except:
print(f"[ComfyUI Manager] unable to create file: {cnr_id_path}")
@@ -247,7 +247,7 @@ def read_cnr_id(fullpath):
if os.path.exists(cnr_id_path):
with open(cnr_id_path) as f:
return f.read().strip()
except Exception:
except:
pass
return None

View File

@@ -14,7 +14,7 @@ if comfy_path is None:
try:
comfy_path = os.path.abspath(os.path.dirname(sys.modules['__main__'].__file__))
os.environ['COMFYUI_PATH'] = comfy_path
except Exception:
except:
logging.error("[ComfyUI-Manager] environment variable 'COMFYUI_PATH' is not specified.")
exit(-1)
@@ -95,7 +95,7 @@ def get_current_comfyui_ver():
project = data.get('project', {})
return project.get('version')
except Exception:
except:
return None
@@ -103,7 +103,7 @@ def get_comfyui_tag():
try:
with git.Repo(comfy_path) as repo:
return repo.git.describe('--tags')
except Exception:
except:
return None

View File

@@ -156,27 +156,27 @@ def switch_to_default_branch(repo):
default_branch = repo.git.symbolic_ref(f'refs/remotes/{remote_name}/HEAD').replace(f'refs/remotes/{remote_name}/', '')
repo.git.checkout(default_branch)
return True
except Exception:
except:
# try checkout master
# try checkout main if failed
try:
repo.git.checkout(repo.heads.master)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'master', f'{remote_name}/master')
return True
except Exception:
except:
try:
repo.git.checkout(repo.heads.main)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'main', f'{remote_name}/main')
return True
except Exception:
except:
pass
print("[ComfyUI Manager] Failed to switch to the default branch")
@@ -447,7 +447,7 @@ def restore_pip_snapshot(pips, options):
res = 1
try:
res = subprocess.check_call([sys.executable, '-m', 'pip', 'install'] + non_url)
except Exception:
except:
pass
# fallback
@@ -456,7 +456,7 @@ def restore_pip_snapshot(pips, options):
res = 1
try:
res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
except Exception:
except:
pass
if res != 0:
@@ -467,7 +467,7 @@ def restore_pip_snapshot(pips, options):
res = 1
try:
res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
except Exception:
except:
pass
if res != 0:
@@ -478,7 +478,7 @@ def restore_pip_snapshot(pips, options):
res = 1
try:
res = subprocess.check_call([sys.executable, '-m', 'pip', 'install', x])
except Exception:
except:
pass
if res != 0:

View File

@@ -46,8 +46,6 @@ def git_url(fullpath):
for k, v in config.items():
if k.startswith('remote ') and 'url' in v:
if 'Comfy-Org/ComfyUI-Manager' in v['url']:
return "https://github.com/ltdrdata/ComfyUI-Manager"
return v['url']
return None

View File

@@ -15,7 +15,6 @@ import re
import logging
import platform
import shlex
from . import cm_global
cache_lock = threading.Lock()
@@ -54,7 +53,7 @@ def make_pip_cmd(cmd):
# DON'T USE StrictVersion - cannot handle pre_release version
# try:
# from distutils.version import StrictVersion
# except Exception:
# except:
# print(f"[ComfyUI-Manager] 'distutils' package not found. Activating fallback mode for compatibility.")
class StrictVersion:
def __init__(self, version_string):
@@ -260,7 +259,7 @@ def get_installed_packages(renew=False):
pip_map[normalized_name] = y[1]
except subprocess.CalledProcessError:
logging.error("[ComfyUI-Manager] Failed to retrieve the information of installed pip packages.")
return {}
return set()
return pip_map
@@ -311,7 +310,6 @@ def parse_requirement_line(line):
torch_torchvision_torchaudio_version_map = {
'2.7.0': ('0.22.0', '2.7.0'),
'2.6.0': ('0.21.0', '2.6.0'),
'2.5.1': ('0.20.0', '2.5.0'),
'2.5.0': ('0.20.0', '2.5.0'),
@@ -415,9 +413,8 @@ class PIPFixer:
if len(targets) > 0:
for x in targets:
if sys.version_info < (3, 13):
cmd = make_pip_cmd(['install', f"{x}=={versions[0].version_string}", "numpy<2"])
subprocess.check_output(cmd, universal_newlines=True)
cmd = make_pip_cmd(['install', f"{x}=={versions[0].version_string}", "numpy<2"])
subprocess.check_output(cmd, universal_newlines=True)
logging.info(f"[ComfyUI-Manager] 'opencv' dependencies were fixed: {targets}")
except Exception as e:
@@ -425,21 +422,17 @@ class PIPFixer:
logging.error(e)
# fix numpy
if sys.version_info >= (3, 13):
logging.info("[ComfyUI-Manager] In Python 3.13 and above, PIP Fixer does not downgrade `numpy` below version 2.0. If you need to force a downgrade of `numpy`, please use `pip_auto_fix.list`.")
else:
try:
np = new_pip_versions.get('numpy')
if cm_global.pip_overrides.get('numpy') == 'numpy<2':
if np is not None:
if StrictVersion(np) >= StrictVersion('2'):
cmd = make_pip_cmd(['install', "numpy<2"])
subprocess.check_output(cmd , universal_newlines=True)
try:
np = new_pip_versions.get('numpy')
if np is not None:
if StrictVersion(np) >= StrictVersion('2'):
cmd = make_pip_cmd(['install', "numpy<2"])
subprocess.check_output(cmd , universal_newlines=True)
logging.info("[ComfyUI-Manager] 'numpy' dependency were fixed")
except Exception as e:
logging.error("[ComfyUI-Manager] Failed to restore numpy")
logging.error(e)
logging.info("[ComfyUI-Manager] 'numpy' dependency were fixed")
except Exception as e:
logging.error("[ComfyUI-Manager] Failed to restore numpy")
logging.error(e)
# fix missing frontend
try:
@@ -479,7 +472,7 @@ class PIPFixer:
normalized_name = parsed['package'].lower().replace('-', '_')
if normalized_name in new_pip_versions:
if 'version' in parsed and 'operator' in parsed:
cur = StrictVersion(new_pip_versions[normalized_name])
cur = StrictVersion(new_pip_versions[parsed['package']])
dest = parsed['version']
op = parsed['operator']
if cur == dest:
@@ -527,7 +520,7 @@ def robust_readlines(fullpath):
try:
with open(fullpath, "r") as f:
return f.readlines()
except Exception:
except:
encoding = None
with open(fullpath, "rb") as f:
raw_data = f.read()

View File

@@ -1,67 +0,0 @@
# Data Models
This directory contains Pydantic models for ComfyUI Manager, providing type safety, validation, and serialization for the API and internal data structures.
## Overview
- `generated_models.py` - All models auto-generated from OpenAPI spec
- `__init__.py` - Package exports for all models
**Note**: All models are now auto-generated from the OpenAPI specification. Manual model files (`task_queue.py`, `state_management.py`) have been deprecated in favor of a single source of truth.
## Generating Types from OpenAPI
The state management models are automatically generated from the OpenAPI specification using `datamodel-codegen`. This ensures type safety and consistency between the API specification and the Python code.
### Prerequisites
Install the code generator:
```bash
pipx install datamodel-code-generator
```
### Generation Command
To regenerate all models after updating the OpenAPI spec:
```bash
datamodel-codegen \
--use-subclass-enum \
--field-constraints \
--strict-types bytes \
--input openapi.yaml \
--output comfyui_manager/data_models/generated_models.py \
--output-model-type pydantic_v2.BaseModel
```
### When to Regenerate
You should regenerate the models when:
1. **Adding new API endpoints** that return new data structures
2. **Modifying existing schemas** in the OpenAPI specification
3. **Adding new state management features** that require new models
### Important Notes
- **Single source of truth**: All models are now generated from `openapi.yaml`
- **No manual models**: All previously manual models have been migrated to the OpenAPI spec
- **OpenAPI requirements**: New schemas must be referenced in API paths to be generated by datamodel-codegen
- **Validation**: Always validate the OpenAPI spec before generation:
```bash
python3 -c "import yaml; yaml.safe_load(open('openapi.yaml'))"
```
### Example: Adding New State Models
1. Add your schema to `openapi.yaml` under `components/schemas/`
2. Reference the schema in an API endpoint response
3. Run the generation command above
4. Update `__init__.py` to export the new models
5. Import and use the models in your code
### Troubleshooting
- **Models not generated**: Ensure schemas are under `components/schemas/` (not `parameters/`)
- **Missing models**: Verify schemas are referenced in at least one API path
- **Import errors**: Check that new models are added to `__init__.py` exports

View File

@@ -1,119 +0,0 @@
"""
Data models for ComfyUI Manager.
This package contains Pydantic models used throughout the ComfyUI Manager
for data validation, serialization, and type safety.
All models are auto-generated from the OpenAPI specification to ensure
consistency between the API and implementation.
"""
from .generated_models import (
# Core Task Queue Models
QueueTaskItem,
TaskHistoryItem,
TaskStateMessage,
TaskExecutionStatus,
# WebSocket Message Models
MessageTaskDone,
MessageTaskStarted,
MessageTaskFailed,
MessageUpdate,
ManagerMessageName,
# State Management Models
BatchExecutionRecord,
ComfyUISystemState,
BatchOperation,
InstalledNodeInfo,
InstalledModelInfo,
ComfyUIVersionInfo,
# Other models
Kind,
StatusStr,
ManagerPackInfo,
ManagerPackInstalled,
SelectedVersion,
ManagerChannel,
ManagerDatabaseSource,
ManagerPackState,
ManagerPackInstallType,
ManagerPack,
InstallPackParams,
UpdatePackParams,
UpdateAllPacksParams,
UpdateComfyUIParams,
FixPackParams,
UninstallPackParams,
DisablePackParams,
EnablePackParams,
QueueStatus,
ManagerMappings,
ModelMetadata,
NodePackageMetadata,
SnapshotItem,
Error,
InstalledPacksResponse,
HistoryResponse,
HistoryListResponse,
InstallType,
OperationType,
Result,
)
__all__ = [
# Core Task Queue Models
"QueueTaskItem",
"TaskHistoryItem",
"TaskStateMessage",
"TaskExecutionStatus",
# WebSocket Message Models
"MessageTaskDone",
"MessageTaskStarted",
"MessageTaskFailed",
"MessageUpdate",
"ManagerMessageName",
# State Management Models
"BatchExecutionRecord",
"ComfyUISystemState",
"BatchOperation",
"InstalledNodeInfo",
"InstalledModelInfo",
"ComfyUIVersionInfo",
# Other models
"Kind",
"StatusStr",
"ManagerPackInfo",
"ManagerPackInstalled",
"SelectedVersion",
"ManagerChannel",
"ManagerDatabaseSource",
"ManagerPackState",
"ManagerPackInstallType",
"ManagerPack",
"InstallPackParams",
"UpdatePackParams",
"UpdateAllPacksParams",
"UpdateComfyUIParams",
"FixPackParams",
"UninstallPackParams",
"DisablePackParams",
"EnablePackParams",
"QueueStatus",
"ManagerMappings",
"ModelMetadata",
"NodePackageMetadata",
"SnapshotItem",
"Error",
"InstalledPacksResponse",
"HistoryResponse",
"HistoryListResponse",
"InstallType",
"OperationType",
"Result",
]

View File

@@ -1,476 +0,0 @@
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-14T01:44:21+00:00
from __future__ import annotations
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union
from pydantic import BaseModel, Field, RootModel
class Kind(str, Enum):
install = 'install'
uninstall = 'uninstall'
update = 'update'
update_all = 'update-all'
update_comfyui = 'update-comfyui'
fix = 'fix'
disable = 'disable'
enable = 'enable'
install_model = 'install-model'
class StatusStr(str, Enum):
success = 'success'
error = 'error'
skip = 'skip'
class TaskExecutionStatus(BaseModel):
status_str: StatusStr = Field(..., description='Overall task execution status')
completed: bool = Field(..., description='Whether the task completed')
messages: List[str] = Field(..., description='Additional status messages')
class ManagerMessageName(str, Enum):
cm_task_completed = 'cm-task-completed'
cm_task_started = 'cm-task-started'
cm_queue_status = 'cm-queue-status'
class ManagerPackInfo(BaseModel):
id: str = Field(
...,
description='Either github-author/github-repo or name of pack from the registry',
)
version: str = Field(..., description='Semantic version or Git commit hash')
ui_id: Optional[str] = Field(None, description='Task ID - generated internally')
class ManagerPackInstalled(BaseModel):
ver: str = Field(
...,
description='The version of the pack that is installed (Git commit hash or semantic version)',
)
cnr_id: Optional[str] = Field(
None, description='The name of the pack if installed from the registry'
)
aux_id: Optional[str] = Field(
None,
description='The name of the pack if installed from github (author/repo-name format)',
)
enabled: bool = Field(..., description='Whether the pack is enabled')
class SelectedVersion(str, Enum):
latest = 'latest'
nightly = 'nightly'
class ManagerChannel(str, Enum):
default = 'default'
recent = 'recent'
legacy = 'legacy'
forked = 'forked'
dev = 'dev'
tutorial = 'tutorial'
class ManagerDatabaseSource(str, Enum):
remote = 'remote'
local = 'local'
cache = 'cache'
class ManagerPackState(str, Enum):
installed = 'installed'
disabled = 'disabled'
not_installed = 'not_installed'
import_failed = 'import_failed'
needs_update = 'needs_update'
class ManagerPackInstallType(str, Enum):
git_clone = 'git-clone'
copy = 'copy'
cnr = 'cnr'
class UpdateState(Enum):
false = 'false'
true = 'true'
class ManagerPack(ManagerPackInfo):
author: Optional[str] = Field(
None, description="Pack author name or 'Unclaimed' if added via GitHub crawl"
)
files: Optional[List[str]] = Field(None, description='Files included in the pack')
reference: Optional[str] = Field(
None, description='The type of installation reference'
)
title: Optional[str] = Field(None, description='The display name of the pack')
cnr_latest: Optional[SelectedVersion] = None
repository: Optional[str] = Field(None, description='GitHub repository URL')
state: Optional[ManagerPackState] = None
update_state: Optional[UpdateState] = Field(
None, alias='update-state', description='Update availability status'
)
stars: Optional[int] = Field(None, description='GitHub stars count')
last_update: Optional[datetime] = Field(None, description='Last update timestamp')
health: Optional[str] = Field(None, description='Health status of the pack')
description: Optional[str] = Field(None, description='Pack description')
trust: Optional[bool] = Field(None, description='Whether the pack is trusted')
install_type: Optional[ManagerPackInstallType] = None
class InstallPackParams(ManagerPackInfo):
selected_version: Union[str, SelectedVersion] = Field(
..., description='Semantic version, Git commit hash, latest, or nightly'
)
repository: Optional[str] = Field(
None,
description='GitHub repository URL (required if selected_version is nightly)',
)
pip: Optional[List[str]] = Field(None, description='PyPi dependency names')
mode: ManagerDatabaseSource
channel: ManagerChannel
skip_post_install: Optional[bool] = Field(
None, description='Whether to skip post-installation steps'
)
class UpdateAllPacksParams(BaseModel):
mode: Optional[ManagerDatabaseSource] = None
ui_id: Optional[str] = Field(None, description='Task ID - generated internally')
class UpdatePackParams(BaseModel):
node_name: str = Field(..., description='Name of the node package to update')
node_ver: Optional[str] = Field(
None, description='Current version of the node package'
)
class UpdateComfyUIParams(BaseModel):
is_stable: Optional[bool] = Field(
True,
description='Whether to update to stable version (true) or nightly (false)',
)
target_version: Optional[str] = Field(
None,
description='Specific version to switch to (for version switching operations)',
)
class FixPackParams(BaseModel):
node_name: str = Field(..., description='Name of the node package to fix')
node_ver: str = Field(..., description='Version of the node package')
class UninstallPackParams(BaseModel):
node_name: str = Field(..., description='Name of the node package to uninstall')
is_unknown: Optional[bool] = Field(
False, description='Whether this is an unknown/unregistered package'
)
class DisablePackParams(BaseModel):
node_name: str = Field(..., description='Name of the node package to disable')
is_unknown: Optional[bool] = Field(
False, description='Whether this is an unknown/unregistered package'
)
class EnablePackParams(BaseModel):
cnr_id: str = Field(
..., description='ComfyUI Node Registry ID of the package to enable'
)
class QueueStatus(BaseModel):
total_count: int = Field(
..., description='Total number of tasks (pending + running)'
)
done_count: int = Field(..., description='Number of completed tasks')
in_progress_count: int = Field(..., description='Number of tasks currently running')
pending_count: Optional[int] = Field(
None, description='Number of tasks waiting to be executed'
)
is_processing: bool = Field(..., description='Whether the task worker is active')
client_id: Optional[str] = Field(
None, description='Client ID (when filtered by client)'
)
class ManagerMappings1(BaseModel):
title_aux: Optional[str] = Field(None, description='The display name of the pack')
class ManagerMappings(
RootModel[Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]]]
):
root: Optional[Dict[str, List[Union[List[str], ManagerMappings1]]]] = Field(
None, description='Tuple of [node_names, metadata]'
)
class ModelMetadata(BaseModel):
name: str = Field(..., description='Name of the model')
type: str = Field(..., description='Type of model')
base: Optional[str] = Field(None, description='Base model type')
save_path: Optional[str] = Field(None, description='Path for saving the model')
url: str = Field(..., description='Download URL')
filename: str = Field(..., description='Target filename')
ui_id: Optional[str] = Field(None, description='ID for UI reference')
class InstallType(str, Enum):
git = 'git'
copy = 'copy'
pip = 'pip'
class NodePackageMetadata(BaseModel):
title: Optional[str] = Field(None, description='Display name of the node package')
name: Optional[str] = Field(None, description='Repository/package name')
files: Optional[List[str]] = Field(None, description='Source URLs for the package')
description: Optional[str] = Field(
None, description='Description of the node package functionality'
)
install_type: Optional[InstallType] = Field(None, description='Installation method')
version: Optional[str] = Field(None, description='Version identifier')
id: Optional[str] = Field(
None, description='Unique identifier for the node package'
)
ui_id: Optional[str] = Field(None, description='ID for UI reference')
channel: Optional[str] = Field(None, description='Source channel')
mode: Optional[str] = Field(None, description='Source mode')
class SnapshotItem(RootModel[str]):
root: str = Field(..., description='Name of the snapshot')
class Error(BaseModel):
error: str = Field(..., description='Error message')
class InstalledPacksResponse(RootModel[Optional[Dict[str, ManagerPackInstalled]]]):
root: Optional[Dict[str, ManagerPackInstalled]] = None
class HistoryListResponse(BaseModel):
ids: Optional[List[str]] = Field(
None, description='List of available batch history IDs'
)
class InstalledNodeInfo(BaseModel):
name: str = Field(..., description='Node package name')
version: str = Field(..., description='Installed version')
repository_url: Optional[str] = Field(None, description='Git repository URL')
install_method: str = Field(
..., description='Installation method (cnr, git, pip, etc.)'
)
enabled: Optional[bool] = Field(
True, description='Whether the node is currently enabled'
)
install_date: Optional[datetime] = Field(
None, description='ISO timestamp of installation'
)
class InstalledModelInfo(BaseModel):
name: str = Field(..., description='Model filename')
path: str = Field(..., description='Full path to model file')
type: str = Field(..., description='Model type (checkpoint, lora, vae, etc.)')
size_bytes: Optional[int] = Field(None, description='File size in bytes', ge=0)
hash: Optional[str] = Field(None, description='Model file hash for verification')
install_date: Optional[datetime] = Field(
None, description='ISO timestamp when added'
)
class ComfyUIVersionInfo(BaseModel):
version: str = Field(..., description='ComfyUI version string')
commit_hash: Optional[str] = Field(None, description='Git commit hash')
branch: Optional[str] = Field(None, description='Git branch name')
is_stable: Optional[bool] = Field(
False, description='Whether this is a stable release'
)
last_updated: Optional[datetime] = Field(
None, description='ISO timestamp of last update'
)
class OperationType(str, Enum):
install = 'install'
update = 'update'
uninstall = 'uninstall'
fix = 'fix'
disable = 'disable'
enable = 'enable'
install_model = 'install-model'
class Result(str, Enum):
success = 'success'
failed = 'failed'
skipped = 'skipped'
class BatchOperation(BaseModel):
operation_id: str = Field(..., description='Unique operation identifier')
operation_type: OperationType = Field(..., description='Type of operation')
target: str = Field(
..., description='Target of the operation (node name, model name, etc.)'
)
target_version: Optional[str] = Field(
None, description='Target version for the operation'
)
result: Result = Field(..., description='Operation result')
error_message: Optional[str] = Field(
None, description='Error message if operation failed'
)
start_time: datetime = Field(
..., description='ISO timestamp when operation started'
)
end_time: Optional[datetime] = Field(
None, description='ISO timestamp when operation completed'
)
client_id: Optional[str] = Field(
None, description='Client that initiated the operation'
)
class ComfyUISystemState(BaseModel):
snapshot_time: datetime = Field(
..., description='ISO timestamp when snapshot was taken'
)
comfyui_version: ComfyUIVersionInfo
frontend_version: Optional[str] = Field(
None, description='ComfyUI frontend version if available'
)
python_version: str = Field(..., description='Python interpreter version')
platform_info: str = Field(
..., description='Operating system and platform information'
)
installed_nodes: Optional[Dict[str, InstalledNodeInfo]] = Field(
None, description='Map of installed node packages by name'
)
installed_models: Optional[Dict[str, InstalledModelInfo]] = Field(
None, description='Map of installed models by name'
)
manager_config: Optional[Dict[str, Any]] = Field(
None, description='ComfyUI Manager configuration settings'
)
class BatchExecutionRecord(BaseModel):
batch_id: str = Field(..., description='Unique batch identifier')
start_time: datetime = Field(..., description='ISO timestamp when batch started')
end_time: Optional[datetime] = Field(
None, description='ISO timestamp when batch completed'
)
state_before: ComfyUISystemState
state_after: Optional[ComfyUISystemState] = Field(
None, description='System state after batch execution'
)
operations: Optional[List[BatchOperation]] = Field(
None, description='List of operations performed in this batch'
)
total_operations: Optional[int] = Field(
0, description='Total number of operations in batch', ge=0
)
successful_operations: Optional[int] = Field(
0, description='Number of successful operations', ge=0
)
failed_operations: Optional[int] = Field(
0, description='Number of failed operations', ge=0
)
skipped_operations: Optional[int] = Field(
0, description='Number of skipped operations', ge=0
)
class QueueTaskItem(BaseModel):
ui_id: str = Field(..., description='Unique identifier for the task')
client_id: str = Field(..., description='Client identifier that initiated the task')
kind: Kind = Field(..., description='Type of task being performed')
params: Union[
InstallPackParams,
UpdatePackParams,
UpdateAllPacksParams,
UpdateComfyUIParams,
FixPackParams,
UninstallPackParams,
DisablePackParams,
EnablePackParams,
ModelMetadata,
]
class TaskHistoryItem(BaseModel):
ui_id: str = Field(..., description='Unique identifier for the task')
client_id: str = Field(..., description='Client identifier that initiated the task')
kind: str = Field(..., description='Type of task that was performed')
timestamp: datetime = Field(..., description='ISO timestamp when task completed')
result: str = Field(..., description='Task result message or details')
status: Optional[TaskExecutionStatus] = None
class TaskStateMessage(BaseModel):
history: Dict[str, TaskHistoryItem] = Field(
..., description='Map of task IDs to their history items'
)
running_queue: List[QueueTaskItem] = Field(
..., description='Currently executing tasks'
)
pending_queue: List[QueueTaskItem] = Field(
..., description='Tasks waiting to be executed'
)
installed_packs: Dict[str, ManagerPackInstalled] = Field(
..., description='Map of currently installed node packages by name'
)
class MessageTaskDone(BaseModel):
ui_id: str = Field(..., description='Task identifier')
result: str = Field(..., description='Task result message')
kind: str = Field(..., description='Type of task')
status: Optional[TaskExecutionStatus] = None
timestamp: datetime = Field(..., description='ISO timestamp when task completed')
state: TaskStateMessage
class MessageTaskStarted(BaseModel):
ui_id: str = Field(..., description='Task identifier')
kind: str = Field(..., description='Type of task')
timestamp: datetime = Field(..., description='ISO timestamp when task started')
state: TaskStateMessage
class MessageTaskFailed(BaseModel):
ui_id: str = Field(..., description='Task identifier')
error: str = Field(..., description='Error message')
kind: str = Field(..., description='Type of task')
timestamp: datetime = Field(..., description='ISO timestamp when task failed')
state: TaskStateMessage
class MessageUpdate(
RootModel[Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed]]
):
root: Union[MessageTaskDone, MessageTaskStarted, MessageTaskFailed] = Field(
..., description='Union type for all possible WebSocket message updates'
)
class HistoryResponse(BaseModel):
history: Optional[Dict[str, TaskHistoryItem]] = Field(
None, description='Map of task IDs to their history items'
)

View File

@@ -1,10 +0,0 @@
- Anytime you make a change to the data being sent or received, you should follow this process:
1. Adjust the openapi.yaml file first
2. Verify the syntax of the openapi.yaml file using `yaml.safe_load`
3. Regenerate the types following the instructions in the `data_models/README.md` file
4. Verify the new data model is generated
5. Verify the syntax of the generated types files
6. Run formatting and linting on the generated types files
7. Adjust the `__init__.py` files in the `data_models` directory to match/export the new data model
8. Only then, make the changes to the rest of the codebase
9. Run the CI tests to verify that the changes are working

View File

@@ -1,39 +0,0 @@
from comfy.cli_args import args
SECURITY_MESSAGE_MIDDLE_OR_BELOW = "ERROR: To use this action, a security_level of `middle or below` is required. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_NORMAL_MINUS = "ERROR: To use this feature, you must either set '--listen' to a local IP and set the security level to 'normal-' or lower, or set the security level to 'middle' or 'weak'. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_GENERAL = "ERROR: This installation is not allowed in this security_level. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_NORMAL_MINUS_MODEL = "ERROR: Downloading models that are not in '.safetensors' format is only allowed for models registered in the 'default' channel at this security level. If you want to download this model, set the security level to 'normal-' or lower."
def is_loopback(address):
import ipaddress
try:
return ipaddress.ip_address(address).is_loopback
except ValueError:
return False
is_local_mode = is_loopback(args.listen)
model_dir_name_map = {
"checkpoints": "checkpoints",
"checkpoint": "checkpoints",
"unclip": "checkpoints",
"text_encoders": "text_encoders",
"clip": "text_encoders",
"vae": "vae",
"lora": "loras",
"t2i-adapter": "controlnet",
"t2i-style": "controlnet",
"controlnet": "controlnet",
"clip_vision": "clip_vision",
"gligen": "gligen",
"upscale": "upscale_models",
"embedding": "embeddings",
"embeddings": "embeddings",
"unet": "diffusion_models",
"diffusion_model": "diffusion_models",
}

View File

@@ -63,7 +63,7 @@ def get_default_custom_nodes_path():
try:
import folder_paths
default_custom_nodes_path = folder_paths.get_folder_paths("custom_nodes")[0]
except Exception:
except:
default_custom_nodes_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..'))
return default_custom_nodes_path
@@ -73,7 +73,7 @@ def get_custom_nodes_paths():
try:
import folder_paths
return folder_paths.get_folder_paths("custom_nodes")
except Exception:
except:
custom_nodes_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..'))
return [custom_nodes_path]
@@ -110,11 +110,11 @@ def check_invalid_nodes():
try:
import folder_paths
except Exception:
except:
try:
sys.path.append(context.comfy_path)
import folder_paths
except Exception:
except:
raise Exception(f"Invalid COMFYUI_FOLDERS_BASE_PATH: {context.comfy_path}")
def check(root):
@@ -702,7 +702,7 @@ class UnifiedManager:
if 'id' in x:
if x['id'] not in res:
res[x['id']] = (x, True)
except Exception:
except:
logging.error(f"[ComfyUI-Manager] broken item:{x}")
return res
@@ -755,7 +755,7 @@ class UnifiedManager:
def safe_version(ver_str):
try:
return version.parse(ver_str)
except Exception:
except:
return version.parse("0.0.0")
def execute_install_script(self, url, repo_path, instant_execution=False, lazy_mode=False, no_deps=False):
@@ -775,9 +775,8 @@ class UnifiedManager:
package_name = remap_pip_package(line.strip())
if package_name and not package_name.startswith('#') and package_name not in self.processed_install:
self.processed_install.add(package_name)
clean_package_name = package_name.split('#')[0].strip()
install_cmd = manager_util.make_pip_cmd(["install", clean_package_name])
if clean_package_name != "" and not clean_package_name.startswith('#'):
install_cmd = manager_util.make_pip_cmd(["install", package_name])
if package_name.strip() != "" and not package_name.startswith('#'):
res = res and try_install_script(url, repo_path, install_cmd, instant_execution=instant_execution)
pip_fixer.fix_broken()
@@ -1423,7 +1422,7 @@ def identify_node_pack_from_path(fullpath):
if github_id is None:
try:
github_id = os.path.basename(repo_url)
except Exception:
except:
logging.warning(f"[ComfyUI-Manager] unexpected repo url: {repo_url}")
github_id = module_name
@@ -1602,7 +1601,7 @@ def read_config():
'model_download_by_agent': False,
'downgrade_blacklist': '',
'always_lazy_install': False,
'network_mode': NetworkMode.PUBLIC.value,
'network_mode': NetworkMode.OFFLINE.value,
'security_level': SecurityLevel.NORMAL.value,
'db_mode': DBMode.CACHE.value,
}
@@ -1648,27 +1647,27 @@ def switch_to_default_branch(repo):
default_branch = repo.git.symbolic_ref(f'refs/remotes/{remote_name}/HEAD').replace(f'refs/remotes/{remote_name}/', '')
repo.git.checkout(default_branch)
return True
except Exception:
except:
# try checkout master
# try checkout main if failed
try:
repo.git.checkout(repo.heads.master)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'master', f'{remote_name}/master')
return True
except Exception:
except:
try:
repo.git.checkout(repo.heads.main)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'main', f'{remote_name}/main')
return True
except Exception:
except:
pass
print("[ComfyUI Manager] Failed to switch to the default branch")
@@ -1719,7 +1718,7 @@ def try_install_script(url, repo_path, install_cmd, instant_execution=False):
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version ({comfy_ui_revision})[{comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version.")
print("[WARN] The extension installation feature may not work properly in the current installed ComfyUI version on Windows environment.")
print("###################################################################\n\n")
except Exception:
except:
pass
if code != 0:
@@ -1988,13 +1987,6 @@ def is_valid_url(url):
return False
def extract_url_and_commit_id(s):
index = s.rfind('@')
if index == -1:
return (s, '')
else:
return (s[:index], s[index+1:])
async def gitclone_install(url, instant_execution=False, msg_prefix='', no_deps=False):
await unified_manager.reload('cache')
await unified_manager.get_custom_nodes('default', 'cache')
@@ -2012,11 +2004,8 @@ async def gitclone_install(url, instant_execution=False, msg_prefix='', no_deps=
cnr = unified_manager.get_cnr_by_repo(url)
if cnr:
cnr_id = cnr['id']
return await unified_manager.install_by_id(cnr_id, version_spec=None, channel='default', mode='cache')
return await unified_manager.install_by_id(cnr_id, version_spec='nightly', channel='default', mode='cache')
else:
new_url, commit_id = extract_url_and_commit_id(url)
if commit_id != "":
url = new_url
repo_name = os.path.splitext(os.path.basename(url))[0]
# NOTE: Keep original name as possible if unknown node
@@ -2049,10 +2038,6 @@ async def gitclone_install(url, instant_execution=False, msg_prefix='', no_deps=
return result.fail(f"Failed to clone '{clone_url}' into '{repo_path}'")
else:
repo = git.Repo.clone_from(clone_url, repo_path, recursive=True, progress=GitProgress())
if commit_id!= "":
repo.git.checkout(commit_id)
repo.git.submodule('update', '--init', '--recursive')
repo.git.clear_cache()
repo.close()
@@ -2351,7 +2336,7 @@ def update_to_stable_comfyui(repo_path):
repo = git.Repo(repo_path)
try:
repo.git.checkout(repo.heads.master)
except Exception:
except:
logging.error(f"[ComfyUI-Manager] Failed to checkout 'master' branch.\nrepo_path={repo_path}\nAvailable branches:")
for branch in repo.branches:
logging.error('\t'+branch.name)
@@ -2374,7 +2359,7 @@ def update_to_stable_comfyui(repo_path):
logging.info(f"[ComfyUI-Manager] Updating ComfyUI: {current_tag} -> {latest_tag}")
repo.git.checkout(latest_tag)
return 'updated', latest_tag
except Exception:
except:
traceback.print_exc()
return "fail", None
@@ -2572,7 +2557,7 @@ async def get_current_snapshot(custom_nodes_only = False):
commit_hash = git_utils.get_commit_hash(fullpath)
url = git_utils.git_url(fullpath)
git_custom_nodes[url] = dict(hash=commit_hash, disabled=is_disabled)
except Exception:
except:
print(f"Failed to extract snapshots for the custom node '{path}'.")
elif path.endswith('.py'):
@@ -2630,7 +2615,7 @@ async def extract_nodes_from_workflow(filepath, mode='local', channel_url='defau
with open(filepath, "r", encoding="UTF-8", errors="ignore") as json_file:
try:
workflow = json.load(json_file)
except Exception:
except:
print(f"Invalid workflow file: {filepath}")
exit(-1)
@@ -2643,7 +2628,7 @@ async def extract_nodes_from_workflow(filepath, mode='local', channel_url='defau
else:
try:
workflow = json.loads(img.info['workflow'])
except Exception:
except:
print(f"This is not a valid .png file containing a ComfyUI workflow: {filepath}")
exit(-1)
@@ -2914,7 +2899,7 @@ def populate_github_stats(node_packs, json_obj_github):
v['stars'] = -1
v['last_update'] = -1
v['trust'] = False
except Exception:
except:
logging.error(f"[ComfyUI-Manager] DB item is broken:\n{v}")
@@ -3190,7 +3175,7 @@ def get_comfyui_versions(repo=None):
try:
remote = get_remote_name(repo)
repo.remotes[remote].fetch()
except Exception:
except:
logging.error("[ComfyUI-Manager] Failed to fetch ComfyUI")
versions = [x.name for x in repo.tags if x.name.startswith('v')]
@@ -3259,5 +3244,5 @@ def repo_switch_commit(repo_path, commit_hash):
repo.git.checkout(commit_hash)
return True
except Exception:
except:
return None

View File

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,6 @@ import hashlib
import folder_paths
from server import PromptServer
import logging
def extract_model_file_names(json_data):
@@ -74,7 +73,7 @@ def get_openart_auth():
with open(os.path.join(context.manager_files_path, ".openart_key"), "r") as f:
openart_key = f.read().strip()
return openart_key if openart_key else None
except Exception:
except:
return None
@@ -92,7 +91,7 @@ def get_matrix_auth():
"username": username,
"password": password,
}
except Exception:
except:
return None
@@ -105,7 +104,7 @@ def get_comfyworkflows_auth():
if not share_key.strip():
return None
return share_key
except Exception:
except:
return None
@@ -116,7 +115,7 @@ def get_youml_settings():
with open(os.path.join(context.manager_files_path, ".youml"), "r") as f:
youml_settings = f.read().strip()
return youml_settings if youml_settings else None
except Exception:
except:
return None
@@ -236,7 +235,7 @@ async def share_art(request):
try:
output_to_share = potential_outputs[int(selected_output_index)]
except Exception:
except:
# for now, pick the first output
output_to_share = potential_outputs[0]
@@ -353,7 +352,7 @@ async def share_art(request):
token = client.login(username=matrix_auth['username'], password=matrix_auth['password'])
if not token:
return web.json_response({"error": "Invalid Matrix credentials."}, content_type='application/json', status=400)
except Exception:
except:
return web.json_response({"error": "Invalid Matrix credentials."}, content_type='application/json', status=400)
matrix = MatrixHttpApi(homeserver, token=token)
@@ -372,8 +371,9 @@ async def share_art(request):
matrix.send_message(comfyui_share_room_id, text_content)
matrix.send_content(comfyui_share_room_id, mxc_url, filename, 'm.image')
matrix.send_content(comfyui_share_room_id, workflow_json_mxc_url, 'workflow.json', 'm.file')
except Exception:
logging.exception("An error occurred")
except:
import traceback
traceback.print_exc()
return web.json_response({"error": "An error occurred when sharing your art to Matrix."}, content_type='application/json', status=500)
return web.json_response({

View File

View File

@@ -1,142 +0,0 @@
import os
import git
import logging
import traceback
from comfyui_manager.common import context
import folder_paths
from comfy.cli_args import args
import latent_preview
from comfyui_manager.glob import manager_core as core
from comfyui_manager.common import cm_global
comfy_ui_hash = "-"
comfyui_tag = None
def print_comfyui_version():
global comfy_ui_hash
global comfyui_tag
is_detached = False
try:
repo = git.Repo(os.path.dirname(folder_paths.__file__))
core.comfy_ui_revision = len(list(repo.iter_commits("HEAD")))
comfy_ui_hash = repo.head.commit.hexsha
cm_global.variables["comfyui.revision"] = core.comfy_ui_revision
core.comfy_ui_commit_datetime = repo.head.commit.committed_datetime
cm_global.variables["comfyui.commit_datetime"] = core.comfy_ui_commit_datetime
is_detached = repo.head.is_detached
current_branch = repo.active_branch.name
comfyui_tag = context.get_comfyui_tag()
try:
if (
not os.environ.get("__COMFYUI_DESKTOP_VERSION__")
and core.comfy_ui_commit_datetime.date()
< core.comfy_ui_required_commit_datetime.date()
):
logging.warning(
f"\n\n## [WARN] ComfyUI-Manager: Your ComfyUI version ({core.comfy_ui_revision})[{core.comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version. ##\n\n"
)
except Exception:
pass
# process on_revision_detected -->
if "cm.on_revision_detected_handler" in cm_global.variables:
for k, f in cm_global.variables["cm.on_revision_detected_handler"]:
try:
f(core.comfy_ui_revision)
except Exception:
logging.error(f"[ERROR] '{k}' on_revision_detected_handler")
traceback.print_exc()
del cm_global.variables["cm.on_revision_detected_handler"]
else:
logging.warning(
"[ComfyUI-Manager] Some features are restricted due to your ComfyUI being outdated."
)
# <--
if current_branch == "master":
if comfyui_tag:
logging.info(
f"### ComfyUI Version: {comfyui_tag} | Released on '{core.comfy_ui_commit_datetime.date()}'"
)
else:
logging.info(
f"### ComfyUI Revision: {core.comfy_ui_revision} [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'"
)
else:
if comfyui_tag:
logging.info(
f"### ComfyUI Version: {comfyui_tag} on '{current_branch}' | Released on '{core.comfy_ui_commit_datetime.date()}'"
)
else:
logging.info(
f"### ComfyUI Revision: {core.comfy_ui_revision} on '{current_branch}' [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'"
)
except Exception:
if is_detached:
logging.info(
f"### ComfyUI Revision: {core.comfy_ui_revision} [{comfy_ui_hash[:8]}] *DETACHED | Released on '{core.comfy_ui_commit_datetime.date()}'"
)
else:
logging.info(
"### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)"
)
def set_preview_method(method):
if method == "auto":
args.preview_method = latent_preview.LatentPreviewMethod.Auto
elif method == "latent2rgb":
args.preview_method = latent_preview.LatentPreviewMethod.Latent2RGB
elif method == "taesd":
args.preview_method = latent_preview.LatentPreviewMethod.TAESD
else:
args.preview_method = latent_preview.LatentPreviewMethod.NoPreviews
core.get_config()["preview_method"] = method
def set_update_policy(mode):
core.get_config()["update_policy"] = mode
def set_db_mode(mode):
core.get_config()["db_mode"] = mode
def setup_environment():
git_exe = core.get_config()["git_exe"]
if git_exe != "":
git.Git().update_environment(GIT_PYTHON_GIT_EXECUTABLE=git_exe)
def initialize_environment():
context.comfy_path = os.path.dirname(folder_paths.__file__)
core.js_path = os.path.join(context.comfy_path, "web", "extensions")
# Legacy database paths - kept for potential future use
# local_db_model = os.path.join(manager_util.comfyui_manager_path, "model-list.json")
# local_db_alter = os.path.join(manager_util.comfyui_manager_path, "alter-list.json")
# local_db_custom_node_list = os.path.join(
# manager_util.comfyui_manager_path, "custom-node-list.json"
# )
# local_db_extension_node_mappings = os.path.join(
# manager_util.comfyui_manager_path, "extension-node-map.json"
# )
set_preview_method(core.get_config()["preview_method"])
print_comfyui_version()
setup_environment()
core.check_invalid_nodes()

View File

@@ -1,60 +0,0 @@
import locale
import sys
import re
def handle_stream(stream, prefix):
stream.reconfigure(encoding=locale.getpreferredencoding(), errors="replace")
for msg in stream:
if (
prefix == "[!]"
and ("it/s]" in msg or "s/it]" in msg)
and ("%|" in msg or "it [" in msg)
):
if msg.startswith("100%"):
print("\r" + msg, end="", file=sys.stderr),
else:
print("\r" + msg[:-1], end="", file=sys.stderr),
else:
if prefix == "[!]":
print(prefix, msg, end="", file=sys.stderr)
else:
print(prefix, msg, end="")
def convert_markdown_to_html(input_text):
pattern_a = re.compile(r"\[a/([^]]+)]\(([^)]+)\)")
pattern_w = re.compile(r"\[w/([^]]+)]")
pattern_i = re.compile(r"\[i/([^]]+)]")
pattern_bold = re.compile(r"\*\*([^*]+)\*\*")
pattern_white = re.compile(r"%%([^*]+)%%")
def replace_a(match):
return f"<a href='{match.group(2)}' target='blank'>{match.group(1)}</a>"
def replace_w(match):
return f"<p class='cm-warn-note'>{match.group(1)}</p>"
def replace_i(match):
return f"<p class='cm-info-note'>{match.group(1)}</p>"
def replace_bold(match):
return f"<B>{match.group(1)}</B>"
def replace_white(match):
return f"<font color='white'>{match.group(1)}</font>"
input_text = (
input_text.replace("\\[", "&#91;")
.replace("\\]", "&#93;")
.replace("<", "&lt;")
.replace(">", "&gt;")
)
result_text = re.sub(pattern_a, replace_a, input_text)
result_text = re.sub(pattern_w, replace_w, result_text)
result_text = re.sub(pattern_i, replace_i, result_text)
result_text = re.sub(pattern_bold, replace_bold, result_text)
result_text = re.sub(pattern_white, replace_white, result_text)
return result_text.replace("\n", "<BR>")

View File

@@ -1,74 +0,0 @@
import os
import logging
import folder_paths
from comfyui_manager.glob import manager_core as core
from comfyui_manager.glob.constants import model_dir_name_map
def get_model_dir(data, show_log=False):
if "download_model_base" in folder_paths.folder_names_and_paths:
models_base = folder_paths.folder_names_and_paths["download_model_base"][0][0]
else:
models_base = folder_paths.models_dir
# NOTE: Validate to prevent path traversal.
if any(char in data["filename"] for char in {"/", "\\", ":"}):
return None
def resolve_custom_node(save_path):
save_path = save_path[13:] # remove 'custom_nodes/'
# NOTE: Validate to prevent path traversal.
if save_path.startswith(os.path.sep) or ":" in save_path:
return None
repo_name = save_path.replace("\\", "/").split("/")[
0
] # get custom node repo name
# NOTE: The creation of files within the custom node path should be removed in the future.
repo_path = core.lookup_installed_custom_nodes_legacy(repo_name)
if repo_path is not None and repo_path[0]:
# Returns the retargeted path based on the actually installed repository
return os.path.join(os.path.dirname(repo_path[1]), save_path)
else:
return None
if data["save_path"] != "default":
if ".." in data["save_path"] or data["save_path"].startswith("/"):
if show_log:
logging.info(
f"[WARN] '{data['save_path']}' is not allowed path. So it will be saved into 'models/etc'."
)
base_model = os.path.join(models_base, "etc")
else:
if data["save_path"].startswith("custom_nodes"):
base_model = resolve_custom_node(data["save_path"])
if base_model is None:
if show_log:
logging.info(
f"[ComfyUI-Manager] The target custom node for model download is not installed: {data['save_path']}"
)
return None
else:
base_model = os.path.join(models_base, data["save_path"])
else:
model_dir_name = model_dir_name_map.get(data["type"].lower())
if model_dir_name is not None:
base_model = folder_paths.folder_names_and_paths[model_dir_name][0][0]
else:
base_model = os.path.join(models_base, "etc")
return base_model
def get_model_path(data, show_log=False):
base_model = get_model_dir(data, show_log)
if base_model is None:
return None
else:
if data["filename"] == "<huggingface>":
return os.path.join(base_model, os.path.basename(data["url"]))
else:
return os.path.join(base_model, data["filename"])

View File

@@ -1,65 +0,0 @@
import concurrent.futures
from comfyui_manager.glob import manager_core as core
def check_state_of_git_node_pack(
node_packs, do_fetch=False, do_update_check=True, do_update=False
):
if do_fetch:
print("Start fetching...", end="")
elif do_update:
print("Start updating...", end="")
elif do_update_check:
print("Start update check...", end="")
def process_custom_node(item):
core.check_state_of_git_node_pack_single(
item, do_fetch, do_update_check, do_update
)
with concurrent.futures.ThreadPoolExecutor(4) as executor:
for k, v in node_packs.items():
if v.get("active_version") in ["unknown", "nightly"]:
executor.submit(process_custom_node, v)
if do_fetch:
print("\x1b[2K\rFetching done.")
elif do_update:
update_exists = any(
item.get("updatable", False) for item in node_packs.values()
)
if update_exists:
print("\x1b[2K\rUpdate done.")
else:
print("\x1b[2K\rAll extensions are already up-to-date.")
elif do_update_check:
print("\x1b[2K\rUpdate check done.")
def nickname_filter(json_obj):
preemptions_map = {}
for k, x in json_obj.items():
if "preemptions" in x[1]:
for y in x[1]["preemptions"]:
preemptions_map[y] = k
elif k.endswith("/ComfyUI"):
for y in x[0]:
preemptions_map[y] = k
updates = {}
for k, x in json_obj.items():
removes = set()
for y in x[0]:
k2 = preemptions_map.get(y)
if k2 is not None and k != k2:
removes.add(y)
if len(removes) > 0:
updates[k] = [y for y in x[0] if y not in removes]
for k, v in updates.items():
json_obj[k][0] = v
return json_obj

View File

@@ -1,53 +0,0 @@
from comfyui_manager.glob import manager_core as core
from comfy.cli_args import args
def is_loopback(address):
import ipaddress
try:
return ipaddress.ip_address(address).is_loopback
except ValueError:
return False
def is_allowed_security_level(level):
is_local_mode = is_loopback(args.listen)
if level == "block":
return False
elif level == "high":
if is_local_mode:
return core.get_config()["security_level"] in ["weak", "normal-"]
else:
return core.get_config()["security_level"] == "weak"
elif level == "middle":
return core.get_config()["security_level"] in ["weak", "normal", "normal-"]
else:
return True
async def get_risky_level(files, pip_packages):
json_data1 = await core.get_data_by_mode("local", "custom-node-list.json")
json_data2 = await core.get_data_by_mode(
"cache",
"custom-node-list.json",
channel_url="https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main",
)
all_urls = set()
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
all_urls.update(x.get("files", []))
for x in files:
if x not in all_urls:
return "high"
all_pip_packages = set()
for x in json_data1["custom_nodes"] + json_data2["custom_nodes"]:
all_pip_packages.update(x.get("pip", []))
for p in pip_packages:
if p not in all_pip_packages:
return "block"
return "middle"

View File

@@ -1,50 +0,0 @@
# ComfyUI-Manager: Frontend (js)
This directory contains the JavaScript frontend implementation for ComfyUI-Manager, providing the user interface components that interact with the backend API.
## Core Components
- **comfyui-manager.js**: Main entry point that initializes the manager UI and integrates with ComfyUI.
- **custom-nodes-manager.js**: Implements the UI for browsing, installing, and managing custom nodes.
- **model-manager.js**: Handles the model management interface for downloading and organizing AI models.
- **components-manager.js**: Manages reusable workflow components system.
- **snapshot.js**: Implements the snapshot system for backing up and restoring installations.
## Sharing Components
- **comfyui-share-common.js**: Base functionality for workflow sharing features.
- **comfyui-share-copus.js**: Integration with the ComfyUI Opus sharing platform.
- **comfyui-share-openart.js**: Integration with the OpenArt sharing platform.
- **comfyui-share-youml.js**: Integration with the YouML sharing platform.
## Utility Components
- **cm-api.js**: Client-side API wrapper for communication with the backend.
- **common.js**: Shared utilities and helper functions used across the frontend.
- **node_fixer.js**: Utilities for fixing disconnected links and repairing malformed nodes by recreating them while preserving connections.
- **popover-helper.js**: UI component for popup tooltips and contextual information.
- **turbogrid.esm.js**: Grid component library - https://github.com/cenfun/turbogrid
- **workflow-metadata.js**: Handles workflow metadata parsing, validation and cross-repository compatibility including versioning, dependencies tracking, and resource management.
## Architecture
The frontend follows a modular component-based architecture:
1. **Integration Layer**: Connects with ComfyUI's existing UI system
2. **Manager Components**: Individual functional UI components (node manager, model manager, etc.)
3. **Sharing Components**: Platform-specific sharing implementations
4. **Utility Layer**: Reusable UI components and helpers
## Implementation Details
- The frontend integrates directly with ComfyUI's UI system through `app.js`
- Dialog-based UI for most manager functions to avoid cluttering the main interface
- Asynchronous API calls to handle backend operations without blocking the UI
## Styling
CSS files are included for specific components:
- **custom-nodes-manager.css**: Styling for the node management UI
- **model-manager.css**: Styling for the model management UI
This frontend implementation provides a comprehensive yet user-friendly interface for managing the ComfyUI ecosystem.

View File

@@ -1410,16 +1410,15 @@ export class CustomNodesManager {
let version_cnt = 0;
if(!is_enable) {
if(rowItem.cnr_latest != rowItem.originalData.active_version && obj.length > 0) {
versions.push('latest');
}
if(rowItem.originalData.active_version != 'nightly') {
versions.push('nightly');
default_version = 'nightly';
version_cnt++;
}
if(rowItem.cnr_latest != rowItem.originalData.active_version && obj.length > 0) {
versions.push('latest');
}
}
for(let v of obj) {

View File

@@ -81,13 +81,10 @@ export class ModelManager {
value: ""
}, {
label: "Installed",
value: "installed"
value: "True"
}, {
label: "Not Installed",
value: "not_installed"
}, {
label: "In Workflow",
value: "in_workflow"
value: "False"
}];
this.typeList = [{
@@ -257,31 +254,12 @@ export class ModelManager {
rowFilter: (rowItem) => {
const searchableColumns = ["name", "type", "base", "description", "filename", "save_path"];
const models_extensions = ['.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'];
let shouldShown = grid.highlightKeywordsFilter(rowItem, searchableColumns, this.keywords);
if (shouldShown) {
if(this.filter) {
if (this.filter == "in_workflow") {
rowItem.in_workflow = null;
if (Array.isArray(app.graph._nodes)) {
app.graph._nodes.forEach((item, i) => {
if (Array.isArray(item.widgets_values)) {
item.widgets_values.forEach((_item, i) => {
if (rowItem.in_workflow === null && _item !== null && models_extensions.includes("." + _item.toString().split('.').pop())) {
let filename = _item.match(/([^\/]+)(?=\.\w+$)/)[0];
if (grid.highlightKeywordsFilter(rowItem, searchableColumns, filename)) {
rowItem.in_workflow = "True";
grid.highlightKeywordsFilter(rowItem, searchableColumns, "");
}
}
});
}
});
}
}
return ((this.filter == "installed" && rowItem.installed == "True") || (this.filter == "not_installed" && rowItem.installed == "False") || (this.filter == "in_workflow" && rowItem.in_workflow == "True"));
if(this.filter && rowItem.installed !== this.filter) {
return false;
}
if(this.type && rowItem.type !== this.type) {
@@ -817,4 +795,4 @@ export class ModelManager {
close() {
this.element.style.display = "none";
}
}
}

View File

@@ -153,7 +153,6 @@ app.registerExtension({
app.canvas.graph.add(new_node, false);
node_info_copy(this, new_node, true);
app.canvas.graph.remove(this);
requestAnimationFrame(() => app.canvas.setDirty(true, true))
},
});
});

View File

@@ -70,8 +70,8 @@ class WorkflowMetadataExtension {
if (cnr_id === "comfy-core") return; // don't allow hijacking comfy-core name
if (cnr_id) nodeProperties.cnr_id = cnr_id;
else nodeProperties.aux_id = aux_id;
if (ver) nodeProperties.ver = ver.trim();
} else if (["nodes", "comfy_extras", "comfy_api_nodes"].includes(moduleType)) {
if (ver) nodeProperties.ver = ver;
} else if (["nodes", "comfy_extras"].includes(moduleType)) {
nodeProperties.cnr_id = "comfy-core";
nodeProperties.ver = this.comfyCoreVersion;
}

View File

@@ -45,7 +45,7 @@ version_code = [4, 0]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
DEFAULT_CHANNEL = "https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main"
DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main"
default_custom_nodes_path = None
@@ -63,7 +63,7 @@ def get_default_custom_nodes_path():
try:
import folder_paths
default_custom_nodes_path = folder_paths.get_folder_paths("custom_nodes")[0]
except Exception:
except:
default_custom_nodes_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..'))
return default_custom_nodes_path
@@ -73,7 +73,7 @@ def get_custom_nodes_paths():
try:
import folder_paths
return folder_paths.get_folder_paths("custom_nodes")
except Exception:
except:
custom_nodes_path = os.path.abspath(os.path.join(manager_util.comfyui_manager_path, '..'))
return [custom_nodes_path]
@@ -110,11 +110,11 @@ def check_invalid_nodes():
try:
import folder_paths
except Exception:
except:
try:
sys.path.append(context.comfy_path)
import folder_paths
except Exception:
except:
raise Exception(f"Invalid COMFYUI_FOLDERS_BASE_PATH: {context.comfy_path}")
def check(root):
@@ -702,7 +702,7 @@ class UnifiedManager:
if 'id' in x:
if x['id'] not in res:
res[x['id']] = (x, True)
except Exception:
except:
logging.error(f"[ComfyUI-Manager] broken item:{x}")
return res
@@ -755,7 +755,7 @@ class UnifiedManager:
def safe_version(ver_str):
try:
return version.parse(ver_str)
except Exception:
except:
return version.parse("0.0.0")
def execute_install_script(self, url, repo_path, instant_execution=False, lazy_mode=False, no_deps=False):
@@ -1422,7 +1422,7 @@ def identify_node_pack_from_path(fullpath):
if github_id is None:
try:
github_id = os.path.basename(repo_url)
except Exception:
except:
logging.warning(f"[ComfyUI-Manager] unexpected repo url: {repo_url}")
github_id = module_name
@@ -1601,7 +1601,7 @@ def read_config():
'model_download_by_agent': False,
'downgrade_blacklist': '',
'always_lazy_install': False,
'network_mode': NetworkMode.PUBLIC.value,
'network_mode': NetworkMode.OFFLINE.value,
'security_level': SecurityLevel.NORMAL.value,
'db_mode': DBMode.CACHE.value,
}
@@ -1647,27 +1647,27 @@ def switch_to_default_branch(repo):
default_branch = repo.git.symbolic_ref(f'refs/remotes/{remote_name}/HEAD').replace(f'refs/remotes/{remote_name}/', '')
repo.git.checkout(default_branch)
return True
except Exception:
except:
# try checkout master
# try checkout main if failed
try:
repo.git.checkout(repo.heads.master)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'master', f'{remote_name}/master')
return True
except Exception:
except:
try:
repo.git.checkout(repo.heads.main)
return True
except Exception:
except:
try:
if remote_name is not None:
repo.git.checkout('-b', 'main', f'{remote_name}/main')
return True
except Exception:
except:
pass
print("[ComfyUI Manager] Failed to switch to the default branch")
@@ -1718,7 +1718,7 @@ def try_install_script(url, repo_path, install_cmd, instant_execution=False):
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version ({comfy_ui_revision})[{comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version.")
print("[WARN] The extension installation feature may not work properly in the current installed ComfyUI version on Windows environment.")
print("###################################################################\n\n")
except Exception:
except:
pass
if code != 0:
@@ -2336,7 +2336,7 @@ def update_to_stable_comfyui(repo_path):
repo = git.Repo(repo_path)
try:
repo.git.checkout(repo.heads.master)
except Exception:
except:
logging.error(f"[ComfyUI-Manager] Failed to checkout 'master' branch.\nrepo_path={repo_path}\nAvailable branches:")
for branch in repo.branches:
logging.error('\t'+branch.name)
@@ -2359,7 +2359,7 @@ def update_to_stable_comfyui(repo_path):
logging.info(f"[ComfyUI-Manager] Updating ComfyUI: {current_tag} -> {latest_tag}")
repo.git.checkout(latest_tag)
return 'updated', latest_tag
except Exception:
except:
traceback.print_exc()
return "fail", None
@@ -2557,7 +2557,7 @@ async def get_current_snapshot(custom_nodes_only = False):
commit_hash = git_utils.get_commit_hash(fullpath)
url = git_utils.git_url(fullpath)
git_custom_nodes[url] = dict(hash=commit_hash, disabled=is_disabled)
except Exception:
except:
print(f"Failed to extract snapshots for the custom node '{path}'.")
elif path.endswith('.py'):
@@ -2615,7 +2615,7 @@ async def extract_nodes_from_workflow(filepath, mode='local', channel_url='defau
with open(filepath, "r", encoding="UTF-8", errors="ignore") as json_file:
try:
workflow = json.load(json_file)
except Exception:
except:
print(f"Invalid workflow file: {filepath}")
exit(-1)
@@ -2628,7 +2628,7 @@ async def extract_nodes_from_workflow(filepath, mode='local', channel_url='defau
else:
try:
workflow = json.loads(img.info['workflow'])
except Exception:
except:
print(f"This is not a valid .png file containing a ComfyUI workflow: {filepath}")
exit(-1)
@@ -2899,7 +2899,7 @@ def populate_github_stats(node_packs, json_obj_github):
v['stars'] = -1
v['last_update'] = -1
v['trust'] = False
except Exception:
except:
logging.error(f"[ComfyUI-Manager] DB item is broken:\n{v}")
@@ -3175,7 +3175,7 @@ def get_comfyui_versions(repo=None):
try:
remote = get_remote_name(repo)
repo.remotes[remote].fetch()
except Exception:
except:
logging.error("[ComfyUI-Manager] Failed to fetch ComfyUI")
versions = [x.name for x in repo.tags if x.name.startswith('v')]
@@ -3244,5 +3244,5 @@ def repo_switch_commit(repo_path, commit_hash):
repo.git.checkout(commit_hash)
return True
except Exception:
except:
return None

View File

@@ -36,9 +36,9 @@ logging.info("[ComfyUI-Manager] network_mode: " + network_mode_description)
comfy_ui_hash = "-"
comfyui_tag = None
SECURITY_MESSAGE_MIDDLE_OR_BELOW = "ERROR: To use this action, a security_level of `middle or below` is required. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_NORMAL_MINUS = "ERROR: To use this feature, you must either set '--listen' to a local IP and set the security level to 'normal-' or lower, or set the security level to 'middle' or 'weak'. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_GENERAL = "ERROR: This installation is not allowed in this security_level. Please contact the administrator.\nReference: https://github.com/Comfy-Org/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_MIDDLE_OR_BELOW = "ERROR: To use this action, a security_level of `middle or below` is required. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_NORMAL_MINUS = "ERROR: To use this feature, you must either set '--listen' to a local IP and set the security level to 'normal-' or lower, or set the security level to 'middle' or 'weak'. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_GENERAL = "ERROR: This installation is not allowed in this security_level. Please contact the administrator.\nReference: https://github.com/ltdrdata/ComfyUI-Manager#security-policy"
SECURITY_MESSAGE_NORMAL_MINUS_MODEL = "ERROR: Downloading models that are not in '.safetensors' format is only allowed for models registered in the 'default' channel at this security level. If you want to download this model, set the security level to 'normal-' or lower."
routes = PromptServer.instance.routes
@@ -108,7 +108,7 @@ def is_allowed_security_level(level):
async def get_risky_level(files, pip_packages):
json_data1 = await core.get_data_by_mode('local', 'custom-node-list.json')
json_data2 = await core.get_data_by_mode('cache', 'custom-node-list.json', channel_url='https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main')
json_data2 = await core.get_data_by_mode('cache', 'custom-node-list.json', channel_url='https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main')
all_urls = set()
for x in json_data1['custom_nodes'] + json_data2['custom_nodes']:
@@ -220,7 +220,7 @@ def print_comfyui_version():
try:
if not os.environ.get('__COMFYUI_DESKTOP_VERSION__') and core.comfy_ui_commit_datetime.date() < core.comfy_ui_required_commit_datetime.date():
logging.warning(f"\n\n## [WARN] ComfyUI-Manager: Your ComfyUI version ({core.comfy_ui_revision})[{core.comfy_ui_commit_datetime.date()}] is too old. Please update to the latest version. ##\n\n")
except Exception:
except:
pass
# process on_revision_detected -->
@@ -247,7 +247,7 @@ def print_comfyui_version():
logging.info(f"### ComfyUI Version: {comfyui_tag} on '{current_branch}' | Released on '{core.comfy_ui_commit_datetime.date()}'")
else:
logging.info(f"### ComfyUI Revision: {core.comfy_ui_revision} on '{current_branch}' [{comfy_ui_hash[:8]}] | Released on '{core.comfy_ui_commit_datetime.date()}'")
except Exception:
except:
if is_detached:
logging.info(f"### ComfyUI Revision: {core.comfy_ui_revision} [{comfy_ui_hash[:8]}] *DETACHED | Released on '{core.comfy_ui_commit_datetime.date()}'")
else:
@@ -464,8 +464,6 @@ async def task_worker():
global task_queue
global tasks_in_progress
await core.unified_manager.reload('cache')
async def do_install(item) -> str:
ui_id, node_spec_str, channel, mode, skip_post_install = item
@@ -898,7 +896,7 @@ async def fetch_updates(request):
return web.Response(status=201)
return web.Response(status=200)
except Exception:
except:
traceback.print_exc()
return web.Response(status=400)
@@ -1044,15 +1042,6 @@ async def fetch_customnode_list(request):
for v in node_packs.values():
populate_markdown(v)
if 'comfyui-manager' in node_packs:
del node_packs['comfyui-manager']
if 'https://github.com/ltdrdata/ComfyUI-Manager' in node_packs:
del node_packs['https://github.com/ltdrdata/ComfyUI-Manager']
if 'https://github.com/Comfy-Org/ComfyUI-Manager' in node_packs:
del node_packs['https://github.com/Comfy-Org/ComfyUI-Manager']
if channel != 'local':
found = 'custom'
@@ -1173,7 +1162,7 @@ async def remove_snapshot(request):
os.remove(path)
return web.Response(status=200)
except Exception:
except:
return web.Response(status=400)
@@ -1199,7 +1188,7 @@ async def restore_snapshot(request):
logging.error(f"Snapshot file not found: `{path}`")
return web.Response(status=400)
except Exception:
except:
return web.Response(status=400)
@@ -1207,7 +1196,7 @@ async def restore_snapshot(request):
async def get_current_snapshot_api(request):
try:
return web.json_response(await core.get_current_snapshot(), content_type='application/json')
except Exception:
except:
return web.Response(status=400)
@@ -1216,7 +1205,7 @@ async def save_snapshot(request):
try:
await core.save_snapshot_with_postfix('snapshot')
return web.Response(status=200)
except Exception:
except:
return web.Response(status=400)
@@ -1764,7 +1753,7 @@ async def get_notice(request):
markdown_content = '<P style="text-align: center; color:red; background-color:white; font-weight:bold">Your ComfyUI isn\'t git repo.</P>' + markdown_content
elif core.comfy_ui_required_commit_datetime.date() > core.comfy_ui_commit_datetime.date():
markdown_content = '<P style="text-align: center; color:red; background-color:white; font-weight:bold">Your ComfyUI is too OUTDATED!!!</P>' + markdown_content
except Exception:
except:
pass
return web.Response(text=markdown_content, status=200)
@@ -1843,7 +1832,7 @@ async def save_component(request):
with open(filepath, 'w') as f:
json.dump(components, f, indent=4, sort_keys=True)
return web.Response(text=filepath, status=200)
except Exception:
except:
return web.Response(status=400)
@@ -1921,7 +1910,7 @@ async def default_cache_update():
logging.error(f"[ComfyUI-Manager] Failed to perform initial fetching '{filename}': {e}")
traceback.print_exc()
if core.get_config()['network_mode'] != 'offline':
if core.get_config()['network_mode'] != 'offline' and not manager_util.is_manager_pip_package():
a = get_cache("custom-node-list.json")
b = get_cache("extension-node-map.json")
c = get_cache("model-list.json")

View File

@@ -73,7 +73,7 @@ def get_openart_auth():
with open(os.path.join(context.manager_files_path, ".openart_key"), "r") as f:
openart_key = f.read().strip()
return openart_key if openart_key else None
except Exception:
except:
return None
@@ -91,7 +91,7 @@ def get_matrix_auth():
"username": username,
"password": password,
}
except Exception:
except:
return None
@@ -104,7 +104,7 @@ def get_comfyworkflows_auth():
if not share_key.strip():
return None
return share_key
except Exception:
except:
return None
@@ -115,7 +115,7 @@ def get_youml_settings():
with open(os.path.join(context.manager_files_path, ".youml"), "r") as f:
youml_settings = f.read().strip()
return youml_settings if youml_settings else None
except Exception:
except:
return None
@@ -235,7 +235,7 @@ async def share_art(request):
try:
output_to_share = potential_outputs[int(selected_output_index)]
except Exception:
except:
# for now, pick the first output
output_to_share = potential_outputs[0]
@@ -352,7 +352,7 @@ async def share_art(request):
token = client.login(username=matrix_auth['username'], password=matrix_auth['password'])
if not token:
return web.json_response({"error": "Invalid Matrix credentials."}, content_type='application/json', status=400)
except Exception:
except:
return web.json_response({"error": "Invalid Matrix credentials."}, content_type='application/json', status=400)
matrix = MatrixHttpApi(homeserver, token=token)
@@ -371,7 +371,7 @@ async def share_art(request):
matrix.send_message(comfyui_share_room_id, text_content)
matrix.send_content(comfyui_share_room_id, mxc_url, filename, 'm.image')
matrix.send_content(comfyui_share_room_id, workflow_json_mxc_url, 'workflow.json', 'm.file')
except Exception:
except:
import traceback
traceback.print_exc()
return web.json_response({"error": "An error occurred when sharing your art to Matrix."}, content_type='application/json', status=500)

View File

@@ -37,8 +37,8 @@ else:
security_check.security_check()
cm_global.pip_blacklist = {'torch', 'torchaudio', 'torchsde', 'torchvision'}
cm_global.pip_downgrade_blacklist = ['torch', 'torchaudio', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
cm_global.pip_blacklist = {'torch', 'torchsde', 'torchvision'}
cm_global.pip_downgrade_blacklist = ['torch', 'torchsde', 'torchvision', 'transformers', 'safetensors', 'kornia']
def skip_pip_spam(x):
@@ -65,8 +65,12 @@ comfy_path = os.environ.get('COMFYUI_PATH')
comfy_base_path = os.environ.get('COMFYUI_FOLDERS_BASE_PATH')
if comfy_path is None:
comfy_path = os.path.abspath(os.path.dirname(sys.modules['__main__'].__file__))
os.environ['COMFYUI_PATH'] = comfy_path
try:
comfy_path = os.path.abspath(os.path.dirname(sys.modules['__main__'].__file__))
os.environ['COMFYUI_PATH'] = comfy_path
except:
print("[ComfyUI-Manager] environment variable 'COMFYUI_PATH' is not specified.")
exit(-1)
if comfy_base_path is None:
comfy_base_path = comfy_path
@@ -87,6 +91,9 @@ manager_pip_blacklist_path = os.path.join(manager_files_path, "pip_blacklist.lis
restore_snapshot_path = os.path.join(manager_files_path, "startup-scripts", "restore-snapshot.json")
manager_config_path = os.path.join(manager_files_path, 'config.ini')
cm_cli_path = os.path.join(comfyui_manager_path, "cm-cli.py")
default_conf = {}
def read_config():
@@ -113,17 +120,11 @@ read_config()
read_uv_mode()
check_file_logging()
if sys.version_info < (3, 13):
cm_global.pip_overrides = {'numpy': 'numpy<2'}
else:
cm_global.pip_overrides = {}
cm_global.pip_overrides = {'numpy': 'numpy<2'}
if os.path.exists(manager_pip_overrides_path):
with open(manager_pip_overrides_path, 'r', encoding="UTF-8", errors="ignore") as json_file:
cm_global.pip_overrides = json.load(json_file)
if sys.version_info < (3, 13):
cm_global.pip_overrides['numpy'] = 'numpy<2'
cm_global.pip_overrides['numpy'] = 'numpy<2'
if os.path.exists(manager_pip_blacklist_path):
@@ -336,12 +337,7 @@ try:
log_file.write(message)
else:
log_file.write(f"[{timestamp}] {message}")
try:
log_file.flush()
except Exception:
pass
log_file.flush()
self.last_char = message if message == '' else message[-1]
if not file_only:
@@ -354,10 +350,7 @@ try:
original_stderr.flush()
def flush(self):
try:
log_file.flush()
except Exception:
pass
log_file.flush()
with std_log_lock:
if self.is_stdout:
@@ -445,6 +438,35 @@ except Exception as e:
print(f"[ComfyUI-Manager] Logging failed: {e}")
def ensure_dependencies():
try:
import git # noqa: F401
import toml # noqa: F401
import rich # noqa: F401
import chardet # noqa: F401
except ModuleNotFoundError:
my_path = os.path.dirname(__file__)
requirements_path = os.path.join(my_path, "requirements.txt")
print("## ComfyUI-Manager: installing dependencies. (GitPython)")
try:
subprocess.check_output(manager_util.make_pip_cmd(['install', '-r', requirements_path]))
except subprocess.CalledProcessError:
print("## [ERROR] ComfyUI-Manager: Attempting to reinstall dependencies using an alternative method.")
try:
subprocess.check_output(manager_util.make_pip_cmd(['install', '--user', '-r', requirements_path]))
except subprocess.CalledProcessError:
print("## [ERROR] ComfyUI-Manager: Failed to install the GitPython package in the correct Python environment. Please install it manually in the appropriate environment. (You can seek help at https://app.element.io/#/room/%23comfyui_space%3Amatrix.org)")
try:
print("## ComfyUI-Manager: installing dependencies done.")
except:
# maybe we should sys.exit() here? there is at least two screens worth of error messages still being pumped after our error messages
print("## [ERROR] ComfyUI-Manager: GitPython package seems to be installed, but failed to load somehow. Make sure you have a working git client installed")
ensure_dependencies()
print("** ComfyUI startup time:", current_timestamp())
print("** Platform:", platform.system())
print("** Python version:", sys.version)
@@ -468,7 +490,7 @@ def read_downgrade_blacklist():
items = [x.strip() for x in items if x != '']
cm_global.pip_downgrade_blacklist += items
cm_global.pip_downgrade_blacklist = list(set(cm_global.pip_downgrade_blacklist))
except Exception:
except:
pass
@@ -574,10 +596,7 @@ if os.path.exists(restore_snapshot_path):
if 'COMFYUI_FOLDERS_BASE_PATH' not in new_env:
new_env["COMFYUI_FOLDERS_BASE_PATH"] = comfy_path
if 'COMFYUI_PATH' not in new_env:
new_env['COMFYUI_PATH'] = os.path.dirname(folder_paths.__file__)
cmd_str = [sys.executable, '-m', 'comfyui_manager.cm_cli', 'restore-snapshot', restore_snapshot_path]
cmd_str = [sys.executable, cm_cli_path, 'restore-snapshot', restore_snapshot_path]
exit_code = process_wrap(cmd_str, custom_nodes_base_path, handler=msg_capture, env=new_env)
if exit_code != 0:
@@ -604,7 +623,6 @@ def execute_lazy_install_script(repo_path, executable):
lines = manager_util.robust_readlines(requirements_path)
for line in lines:
package_name = remap_pip_package(line.strip())
package_name = package_name.split('#')[0].strip()
if package_name and not is_installed(package_name):
if '--index-url' in package_name:
s = package_name.split('--index-url')

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,41 +0,0 @@
# ComfyUI-Manager: Documentation
This directory contains documentation for the ComfyUI-Manager, providing guides and tutorials for users in multiple languages.
## Directory Structure
The documentation is organized into language-specific directories:
- **en/**: English documentation
- **ko/**: Korean documentation
## Core Documentation Files
### Command-Line Interface
- **cm-cli.md**: Documentation for the ComfyUI-Manager Command Line Interface (CLI), which allows using manager functionality without the UI.
### Advanced Features
- **use_aria2.md**: Guide for using the aria2 download accelerator with ComfyUI-Manager for faster model downloads.
## Documentation Standards
The documentation follows these standards:
1. **Markdown Format**: All documentation is written in Markdown for easy rendering on GitHub and other platforms
2. **Language-specific Directories**: Content is separated by language to facilitate localization
3. **Feature-focused Documentation**: Each major feature has its own documentation file
4. **Updated with Releases**: Documentation is kept in sync with software releases
## Contributing to Documentation
When contributing new documentation:
1. Place files in the appropriate language directory
2. Use clear, concise language appropriate for the target audience
3. Include examples where helpful
4. Consider adding screenshots or diagrams for complex features
5. Maintain consistent formatting with existing documentation
This documentation directory will continue to grow to support the expanding feature set of ComfyUI-Manager.

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@@ -749,8 +749,8 @@
"save_path": "loras/HyperSD/SDXL",
"description": "Hyper-SD LoRA (4steps) - SDXL",
"reference": "https://huggingface.co/ByteDance/Hyper-SD",
"filename": "Hyper-SDXL-4steps-lora.safetensors",
"url": "https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SDXL-4steps-lora.safetensors",
"filename": "Hyper-SD15-4steps-lora.safetensors",
"url": "https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-4steps-lora.safetensors",
"size": "787MB"
},
{
@@ -4953,107 +4953,6 @@
"filename": "umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"url": "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors",
"size": "6.74GB"
},
{
"name": "lllyasviel/FramePackI2V_HY",
"type": "FramePackI2V",
"base": "FramePackI2V",
"save_path": "diffusers/lllyasviel",
"description": "[SNAPSHOT] This is the f1k1_x_g9_f1k1f2k2f16k4_td FramePack for HY. [w/You cannot download this item on ComfyUI-Manager versions below V3.18]",
"reference": "https://huggingface.co/lllyasviel/FramePackI2V_HY",
"filename": "<huggingface>",
"url": "lllyasviel/FramePackI2V_HY",
"size": "25.75GB"
},
{
"name": "LTX-Video Spatial Upscaler v0.9.7",
"type": "upscale",
"base": "upscale",
"save_path": "default",
"description": "Spatial upscaler model for LTX-Video. This model enhances the spatial resolution of generated videos.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-spatial-upscaler-0.9.7.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-spatial-upscaler-0.9.7.safetensors",
"size": "505MB"
},
{
"name": "LTX-Video Temporal Upscaler v0.9.7",
"type": "upscale",
"base": "upscale",
"save_path": "default",
"description": "Temporal upscaler model for LTX-Video. This model enhances the temporal resolution and smoothness of generated videos.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-temporal-upscaler-0.9.7.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-temporal-upscaler-0.9.7.safetensors",
"size": "524MB"
},
{
"name": "LTX-Video 13B v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "High-resolution quality LTX-Video 13B model.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-dev.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-dev.safetensors",
"size": "28.6GB"
},
{
"name": "LTX-Video 13B FP8 v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Quantized version of the LTX-Video 13B model, optimized for lower VRAM usage while maintaining high quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-dev-fp8.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-dev-fp8.safetensors",
"size": "15.7GB"
},
{
"name": "LTX-Video 13B Distilled v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Distilled version of the LTX-Video 13B model, providing improved efficiency while maintaining high-resolution quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled.safetensors",
"size": "28.6GB"
},
{
"name": "LTX-Video 13B Distilled FP8 v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Quantized distilled version of the LTX-Video 13B model, optimized for even lower VRAM usage while maintaining quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled-fp8.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled-fp8.safetensors",
"size": "15.7GB"
},
{
"name": "LTX-Video 13B Distilled LoRA v0.9.7",
"type": "lora",
"base": "LTX-Video",
"save_path": "loras",
"description": "A LoRA adapter that transforms the standard LTX-Video 13B model into a distilled version when loaded.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled-lora128.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled-lora128.safetensors",
"size": "1.33GB"
},
{
"name": "Latent Bridge Matching for Image Relighting",
"type": "diffusion_model",
"base": "LBM",
"save_path": "diffusion_models/LBM",
"description": "Latent Bridge Matching (LBM) Relighting model",
"reference": "https://huggingface.co/jasperai/LBM_relighting",
"filename": "LBM_relighting.safetensors",
"url": "https://huggingface.co/jasperai/LBM_relighting/resolve/main/model.safetensors",
"size": "5.02GB"
}
]
}

View File

@@ -1,95 +0,0 @@
# ComfyUI-Manager: Node Database (node_db)
This directory contains the JSON database files that power ComfyUI-Manager's legacy node registry system. While the manager is gradually transitioning to the online Custom Node Registry (CNR), these local JSON files continue to provide important metadata about custom nodes, models, and their integrations.
## Directory Structure
The node_db directory is organized into several subdirectories, each serving a specific purpose:
- **dev/**: Development channel files with latest additions and experimental nodes
- **legacy/**: Historical/legacy nodes that may require special handling
- **new/**: New nodes that have passed initial verification but are still being evaluated
- **forked/**: Forks of existing nodes with modifications
- **tutorial/**: Example and tutorial nodes designed for learning purposes
## Core Database Files
Each subdirectory contains a standard set of JSON files:
- **custom-node-list.json**: Primary database of custom nodes with metadata
- **extension-node-map.json**: Maps between extensions and individual nodes they provide
- **model-list.json**: Catalog of models that can be downloaded through the manager
- **alter-list.json**: Alternative implementations of nodes for compatibility or functionality
- **github-stats.json**: GitHub repository statistics for node popularity metrics
## Database Schema
### custom-node-list.json
```json
{
"custom_nodes": [
{
"title": "Node display name",
"name": "Repository name",
"reference": "Original repository if forked",
"files": ["GitHub URL or other source location"],
"install_type": "git",
"description": "Description of the node's functionality",
"pip": ["optional pip dependencies"],
"js": ["optional JavaScript files"],
"tags": ["categorization tags"]
}
]
}
```
### extension-node-map.json
```json
{
"extension-id": [
["list", "of", "node", "classes"],
{
"author": "Author name",
"description": "Extension description",
"nodename_pattern": "Optional regex pattern for node name matching"
}
]
}
```
## Transition to Custom Node Registry (CNR)
This local database system is being progressively replaced by the online Custom Node Registry (CNR), which provides:
- Real-time updates without manual JSON maintenance
- Improved versioning support
- Better security validation
- Enhanced metadata
The Manager supports both systems simultaneously during the transition period.
## Implementation Details
- The database follows a channel-based architecture for different sources
- Multiple database modes are supported: Channel, Local, and Remote
- The system supports differential updates to minimize bandwidth usage
- Security levels are enforced for different node installations based on source
## Usage in the Application
The Manager's backend uses these database files to:
1. Provide browsable lists of available nodes and models
2. Resolve dependencies for installation
3. Track updates and new versions
4. Map node classes to their source repositories
5. Assess risk levels for installation security
## Maintenance Scripts
Each subdirectory contains a `scan.sh` script that assists with:
- Scanning repositories for new nodes
- Updating metadata
- Validating database integrity
- Generating proper JSON structures
This database system enables a flexible, secure, and comprehensive management system for the ComfyUI ecosystem while the transition to CNR continues.

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,461 +1,15 @@
{
"custom_nodes": [
{
"author": "dream-computing",
"title": "SyntaxNodes - Image Processing Effects for ComfyUI [REMOVED]",
"reference": "https://github.com/dream-computing/syntax-nodes",
"files": [
"https://github.com/dream-computing/syntax-nodes"
],
"author": "#NOTICE_1.13",
"title": "NOTICE: This channel is not the default channel.",
"reference": "https://github.com/ltdrdata/ComfyUI-Manager",
"files": [],
"install_type": "git-clone",
"description": "A collection of custom nodes for ComfyUI designed to apply various image processing effects, stylizations, and analyses."
},
{
"author": "UD1sto",
"title": "plugin-utils-nodes [DEPRECATED]",
"reference": "https://github.com/its-DeFine/plugin-utils-nodes",
"files": [
"https://github.com/its-DeFine/plugin-utils-nodes"
],
"install_type": "git-clone",
"description": "NODES: Compare Images (SimHash), Image Selector, Temporal Consistency, Update Image Reference, Frame Blend."
},
{
"author": "hanyingcho",
"title": "ComfyUI LLM Promp [REMOVED]",
"reference": "https://github.com/hanyingcho/comfyui-llmprompt",
"files": [
"https://github.com/hanyingcho/comfyui-llmprompt"
],
"install_type": "git-clone",
"description": "NODES: Load llm, Generate Text with LLM, Inference Qwen2VL, Inference Qwen2"
},
{
"author": "WASasquatch",
"title": "WAS Node Suite [DEPRECATED]",
"id": "was",
"reference": "https://github.com/WASasquatch/was-node-suite-comfyui",
"pip": ["numba"],
"files": [
"https://github.com/WASasquatch/was-node-suite-comfyui"
],
"install_type": "git-clone",
"description": "A node suite for ComfyUI with many new nodes, such as image processing, text processing, and more."
},
{
"author": "TOM1063",
"title": "ComfyUI-SamuraiTools [REMOVED]",
"reference": "https://github.com/TOM1063/ComfyUI-SamuraiTools",
"files": [
"https://github.com/TOM1063/ComfyUI-SamuraiTools"
],
"install_type": "git-clone",
"description": "ComfyUI custom node for switching integer values based on boolean conditions"
},
{
"author": "whitemoney293",
"title": "ComfyUI-MediaUtilities [REMOVED]",
"reference": "https://github.com/ThanaritKanjanametawatAU/ComfyUI-MediaUtilities",
"files": [
"https://github.com/ThanaritKanjanametawatAU/ComfyUI-MediaUtilities"
],
"install_type": "git-clone",
"description": "Custom nodes for loading and previewing media from URLs in ComfyUI."
},
{
"author": "pureexe",
"title": "DiffusionLight-ComfyUI [REMOVED]",
"reference": "https://github.com/pureexe/DiffusionLight-ComfyUI",
"files": [
"https://github.com/pureexe/DiffusionLight-ComfyUI"
],
"install_type": "git-clone",
"description": "DiffusionLight (Turbo) implemented in ComfyUI"
},
{
"author": "gondar-software",
"title": "comfyui-custom-padding [REMOVED]",
"reference": "https://github.com/gondar-software/comfyui-custom-padding",
"files": [
"https://github.com/gondar-software/comfyui-custom-padding"
],
"install_type": "git-clone",
"description": "NODES: Adaptive image padding, Adaptive image unpadding"
},
{
"author": "Charonartist",
"title": "ComfyUI-EagleExporter [REMOVED]",
"reference": "https://github.com/Charonartist/ComfyUI-EagleExporter",
"files": [
"https://github.com/Charonartist/ComfyUI-EagleExporter"
],
"install_type": "git-clone",
"description": "This is an extension that automatically saves video files generated with ComfyUI's 'video combine' extension to the Eagle library."
},
{
"author": "pomePLaszlo-collablyu",
"title": "comfyui_ejam [REMOVED]",
"reference": "https://github.com/PLaszlo-collab/comfyui_ejam",
"files": [
"https://github.com/PLaszlo-collab/comfyui_ejam"
],
"install_type": "git-clone",
"description": "Ejam nodes for comfyui"
},
{
"author": "jonnydolake",
"title": "ComfyUI-AIR-Nodes [REMOVED]",
"reference": "https://github.com/jonnydolake/ComfyUI-AIR-Nodes",
"files": [
"https://github.com/jonnydolake/ComfyUI-AIR-Nodes"
],
"install_type": "git-clone",
"description": "NODES: String List To Prompt Schedule, Force Minimum Batch Size, Target Location (Crop), Target Location (Paste), Image Composite Chained, Match Image Count To Mask Count, Random Character Prompts, Parallax Test, Easy Parallax, Parallax GPU Test"
},
{
"author": "solution9th",
"title": "Comfyui_mobilesam [REMOVED]",
"reference": "https://github.com/solution9th/Comfyui_mobilesam",
"files": [
"https://github.com/solution9th/Comfyui_mobilesam"
],
"install_type": "git-clone",
"description": "NODES: Mobile SAM Model Loader, Mobile SAM Detector, Mobile SAM Predictor"
},
{
"author": "syaofox",
"title": "ComfyUI_fnodes [REMOVED]",
"reference": "https://github.com/syaofox/ComfyUI_fnodes",
"files": [
"https://github.com/syaofox/ComfyUI_fnodes"
],
"install_type": "git-clone",
"description": "ComfyUI_fnodes is a collection of custom nodes designed for ComfyUI. These nodes provide additional functionality that can enhance your ComfyUI workflows.\nFile manipulation tools, Image resizing tools, IPAdapter tools, Image processing tools, Mask tools, Face analysis tools, Sampler tools, Miscellaneous tools"
},
{
"author": "Hangover3832",
"title": "ComfyUI-Hangover-Moondream [DEPRECATED]",
"reference": "https://github.com/Hangover3832/ComfyUI-Hangover-Moondream",
"files": [
"https://github.com/Hangover3832/ComfyUI-Hangover-Moondream"
],
"install_type": "git-clone",
"description": "Moondream is a lightweight multimodal large language model.\n[w/WARN:Additional python code will be downloaded from huggingface and executed. You have to trust this creator if you want to use this node!]"
},
{
"author": "Hangover3832",
"title": "Recognize Anything Model (RAM) for ComfyUI [DEPRECATED]",
"reference": "https://github.com/Hangover3832/ComfyUI-Hangover-Recognize_Anything",
"files": [
"https://github.com/Hangover3832/ComfyUI-Hangover-Recognize_Anything"
],
"install_type": "git-clone",
"description": "This is an image recognition node for ComfyUI based on the RAM++ model from [a/xinyu1205](https://huggingface.co/xinyu1205).\nThis node outputs a string of tags with all the recognized objects and elements in the image in English or Chinese language.\nFor image tagging and captioning."
},
{
"author": "Hangover3832",
"title": "ComfyUI-Hangover-Nodes [DEPRECATED]",
"reference": "https://github.com/Hangover3832/ComfyUI-Hangover-Nodes",
"files": [
"https://github.com/Hangover3832/ComfyUI-Hangover-Nodes"
],
"install_type": "git-clone",
"description": "Nodes: MS kosmos-2 Interrogator, Save Image w/o Metadata, Image Scale Bounding Box. An implementation of Microsoft [a/kosmos-2](https://huggingface.co/microsoft/kosmos-2-patch14-224) image to text transformer."
},
{
"author": "SirLatore",
"title": "ComfyUI-IPAdapterWAN [REMOVED]",
"reference": "https://github.com/SirLatore/ComfyUI-IPAdapterWAN",
"files": [
"https://github.com/SirLatore/ComfyUI-IPAdapterWAN"
],
"install_type": "git-clone",
"description": "This extension adapts the [a/InstantX IP-Adapter for SD3.5-Large](https://huggingface.co/InstantX/SD3.5-Large-IP-Adapter) to work with Wan 2.1 and other UNet-based video/image models in ComfyUI.\nUnlike the original SD3 version (which depends on joint_blocks from MMDiT), this version performs sampling-time identity conditioning by dynamically injecting into attention layers — making it compatible with models like Wan 2.1, AnimateDiff, and other non-SD3 pipelines."
},
{
"author": "Jpzz",
"title": "ComfyUI-VirtualInteraction [UNSAFE/REMOVED]",
"reference": "https://github.com/Jpzz/ComfyUI-VirtualInteraction",
"files": [
"https://github.com/Jpzz/ComfyUI-VirtualInteraction"
],
"install_type": "git-clone",
"description": "NODES: virtual interaction custom node when using generative movie\n[w/This nodepack contains a node which is reading arbitrary excel file.]"
},
{
"author": "satche",
"title": "Prompt Factory [REMOVED]",
"reference": "https://github.com/satche/comfyui-prompt-factory",
"files": [
"https://github.com/satche/comfyui-prompt-factory"
],
"install_type": "git-clone",
"description": "A modular system that adds randomness to prompt generation"
},
{
"author": "MITCAP",
"title": "ComfyUI OpenAI DALL-E 3 Node [REMOVED]",
"reference": "https://github.com/MITCAP/OpenAI-ComfyUI",
"files": [
"https://github.com/MITCAP/OpenAI-ComfyUI"
],
"install_type": "git-clone",
"description": "This project provides custom nodes for ComfyUI that integrate with OpenAI's DALL-E 3 and GPT-4o models. The nodes allow users to generate images and describe images using OpenAI's API.\nNOTE: The files in the repo are not organized."
},
{
"author": "raspie10032",
"title": "ComfyUI NAI Prompt Converter [REMOVED]",
"reference": "https://github.com/raspie10032/ComfyUI_RS_NAI_Local_Prompt_converter",
"files": [
"https://github.com/raspie10032/ComfyUI_RS_NAI_Local_Prompt_converter"
],
"install_type": "git-clone",
"description": "A custom node extension for ComfyUI that enables conversion between different prompt formats: NovelAI V4, ComfyUI, and old NovelAI."
},
{
"author": "holchan",
"title": "ComfyUI-ModelDownloader [REMOVED]",
"reference": "https://github.com/holchan/ComfyUI-ModelDownloader",
"files": [
"https://github.com/holchan/ComfyUI-ModelDownloader"
],
"install_type": "git-clone",
"description": "A ComfyUI node to download models(Checkpoints and LoRA) from external links and act as an output standalone node."
},
{
"author": "Kur0butiMegane",
"title": "Comfyui-StringUtils [DEPRECATED]",
"reference": "https://github.com/Kur0butiMegane/Comfyui-StringUtils",
"files": [
"https://github.com/Kur0butiMegane/Comfyui-StringUtils"
],
"install_type": "git-clone",
"description": "NODES: Prompt Normalizer, String Splitter, String Line Selector, Extract Markup Value"
},
{
"author": "Apache0ne",
"title": "ComfyUI-LantentCompose [REMOVED]",
"reference": "https://github.com/Apache0ne/ComfyUI-LantentCompose",
"files": [
"https://github.com/Apache0ne/ComfyUI-LantentCompose"
],
"install_type": "git-clone",
"description": "Interpolate sdxl latents using slerp with and without a mask. use with unsample nodes for best effect.\nNOTE: The files in the repo are not organized."
},
{
"author": "jax-explorer",
"title": "ComfyUI-H-flow [REMOVED]",
"reference": "https://github.com/jax-explorer/ComfyUI-H-flow",
"files": [
"https://github.com/jax-explorer/ComfyUI-H-flow"
],
"install_type": "git-clone",
"description": "NODES: Wan2-1 Image To Video, LLM Task, Save Image, Save Video, Show Text, FluxPro Ultra, IdeogramV2 Turbo, Runway Image To Video, Kling Image To Video, Replace Text, Join Text, Test Image, Test Text"
},
{
"author": "Apache0ne",
"title": "SambaNova [REMOVED]",
"id": "SambaNovaAPI",
"reference": "https://github.com/Apache0ne/SambaNova",
"files": [
"https://github.com/Apache0ne/SambaNova"
],
"install_type": "git-clone",
"description": "Super Fast LLM's llama3.1-405B,70B,8B and more"
},
{
"author": "Apache0ne",
"title": "ComfyUI-EasyUrlLoader [REMOVED]",
"id": "easy-url-loader",
"reference": "https://github.com/Apache0ne/ComfyUI-EasyUrlLoader",
"files": [
"https://github.com/Apache0ne/ComfyUI-EasyUrlLoader"
],
"install_type": "git-clone",
"description": "A simple YT downloader node for ComfyUI using video Urls. Can be used with VHS nodes etc."
},
{
"author": "nxt5656",
"title": "ComfyUI-Image2OSS [REMOVED]",
"reference": "https://github.com/nxt5656/ComfyUI-Image2OSS",
"files": [
"https://github.com/nxt5656/ComfyUI-Image2OSS"
],
"install_type": "git-clone",
"description": "Upload the image to Alibaba Cloud OSS."
},
{
"author": "ainewsto",
"title": "Comfyui_Comfly",
"reference": "https://github.com/ainewsto/Comfyui_Comfly",
"files": [
"https://github.com/ainewsto/Comfyui_Comfly"
],
"install_type": "git-clone",
"description": "NODES: Comfly_Mj, Comfly_mjstyle, Comfly_upload, Comfly_Mju, Comfly_Mjv, Comfly_kling_videoPreview\nNOTE: Comfyui_Comfly_v2 is introduced."
},
{
"author": "shinich39",
"title": "comfyui-to-inpaint",
"reference": "https://github.com/shinich39/comfyui-to-inpaint",
"files": [
"https://github.com/shinich39/comfyui-to-inpaint"
],
"install_type": "git-clone",
"description": "Send preview image to inpaint workflow."
},
{
"author": "magic-quill",
"title": "ComfyUI_MagicQuill [NOT MAINTAINED]",
"id": "MagicQuill",
"reference": "https://github.com/magic-quill/ComfyUI_MagicQuill",
"files": [
"https://github.com/magic-quill/ComfyUI_MagicQuill"
],
"install_type": "git-clone",
"description": "Towards GPT-4 like large language and visual assistant.\nNOTE: The current version has not been maintained for a long time and does not work. Please use https://github.com/brantje/ComfyUI_MagicQuill instead."
},
{
"author": "shinich39",
"title": "comfyui-event-handler [USAFE/REMOVED]",
"reference": "https://github.com/shinich39/comfyui-event-handler",
"files": [
"https://github.com/shinich39/comfyui-event-handler"
],
"install_type": "git-clone",
"description": "Javascript code will run when an event fires. [w/This node allows you to execute arbitrary JavaScript code as input for the workflow.]"
},
{
"author": "Moooonet",
"title": "ComfyUI-ArteMoon [REMOVED]",
"reference": "https://github.com/Moooonet/ComfyUI-ArteMoon",
"files": [
"https://github.com/Moooonet/ComfyUI-ArteMoon"
],
"install_type": "git-clone",
"description": "This plugin works with [a/IF_AI_Tools](https://github.com/if-ai/ComfyUI-IF_AI_tools) to build a workflow in ComfyUI that uses AI to assist in generating prompts."
},
{
"author": "ryanontheinside",
"title": "ComfyUI-MediaPipe-Vision [REMOVED]",
"reference": "https://github.com/ryanontheinside/ComfyUI-MediaPipe-Vision",
"files": [
"https://github.com/ryanontheinside/ComfyUI-MediaPipe-Vision"
],
"install_type": "git-clone",
"description": "A centralized wrapper of all MediaPipe vision tasks for ComfyUI."
},
{
"author": "shinich39",
"title": "comfyui-textarea-command [REMOVED]",
"reference": "https://github.com/shinich39/comfyui-textarea-command",
"files": [
"https://github.com/shinich39/comfyui-textarea-command"
],
"install_type": "git-clone",
"description": "Add command and comment in textarea. (e.g. // Disabled line)"
},
{
"author": "shinich39",
"title": "comfyui-parse-image [REMOVED]",
"reference": "https://github.com/shinich39/comfyui-parse-image",
"files": [
"https://github.com/shinich39/comfyui-parse-image"
],
"install_type": "git-clone",
"description": "Extract metadata from image."
},
{
"author": "shinich39",
"title": "comfyui-put-image [REMOVED]",
"reference": "https://github.com/shinich39/comfyui-put-image",
"files": [
"https://github.com/shinich39/comfyui-put-image"
],
"install_type": "git-clone",
"description": "Load image from directory."
},
{
"author": "fredconex",
"title": "TripoSG Nodes for ComfyUI [REMOVED]",
"reference": "https://github.com/fredconex/ComfyUI-TripoSG",
"files": [
"https://github.com/fredconex/ComfyUI-TripoSG"
],
"install_type": "git-clone",
"description": "Created by Alfredo Fernandes inspired by Hunyuan3D nodes by Kijai. This extension adds TripoSG 3D mesh generation capabilities to ComfyUI, allowing you to generate 3D meshes from a single image using the TripoSG model."
},
{
"author": "fredconex",
"title": "ComfyUI-PaintTurbo [REMOVED]",
"reference": "https://github.com/fredconex/ComfyUI-PaintTurbo",
"files": [
"https://github.com/fredconex/ComfyUI-PaintTurbo"
],
"install_type": "git-clone",
"description": "NODES: Hunyuan3D Texture Mesh"
},
{
"author": "zhuanqianfish",
"title": "TaesdDecoder [REMOVED]",
"reference": "https://github.com/zhuanqianfish/TaesdDecoder",
"files": [
"https://github.com/zhuanqianfish/TaesdDecoder"
],
"install_type": "git-clone",
"description": "use TAESD decoded image.you need donwload taesd_decoder.pth and taesdxl_decoder.pth to vae_approx folder first.\n It will result in a slight loss of image quality and a significant decrease in peak video memory during decoding."
},
{
"author": "myAiLemon",
"title": "MagicAutomaticPicture [REMOVED]",
"reference": "https://github.com/myAiLemon/MagicAutomaticPicture",
"files": [
"https://github.com/myAiLemon/MagicAutomaticPicture"
],
"install_type": "git-clone",
"description": "A comfyui node package that can generate pictures and automatically save positive prompts and eliminate unwanted prompts"
},
{
"author": "thisiseddy-ab",
"title": "ComfyUI-Edins-Ultimate-Pack [REMOVED]",
"reference": "https://github.com/thisiseddy-ab/ComfyUI-Edins-Ultimate-Pack",
"files": [
"https://github.com/thisiseddy-ab/ComfyUI-Edins-Ultimate-Pack"
],
"install_type": "git-clone",
"description": "Well i needet a Tiled Ksampler that still works for Comfy UI there were none so i made one, in this Package i will put all Nodes i will develop for Comfy Ui still in beta alot will change.."
},
{
"author": "Davros666",
"title": "safetriggers [REMOVED]",
"reference": "https://github.com/Davros666/safetriggers",
"files": [
"https://github.com/Davros666/safetriggers"
],
"install_type": "git-clone",
"description": "ComfyUI Nodes for READING TRIGGERS, TRIGGER-WORDS, TRIGGER-PHRASES FROM LoRAs"
},
{
"author": "cubiq",
"title": "Simple Math [REMOVED]",
"id": "simplemath",
"reference": "https://github.com/cubiq/ComfyUI_SimpleMath",
"files": [
"https://github.com/cubiq/ComfyUI_SimpleMath"
],
"install_type": "git-clone",
"description": "custom node for ComfyUI to perform simple math operations"
},
{
"author": "lucafoscili",
"title": "LF Nodes [DEPRECATED]",
"reference": "https://github.com/lucafoscili/comfyui-lf",
"files": [
"https://github.com/lucafoscili/comfyui-lf"
],
"install_type": "git-clone",
"description": "Custom nodes with a touch of extra UX, including: history for primitives, JSON manipulation, logic switches with visual feedback, LLM chat... and more!"
"description": "If you see this message, your ComfyUI-Manager is outdated.\nLegacy channel provides only the list of the deprecated nodes. If you want to find the complete node list, please go to the Default channel."
},
{
"author": "AI2lab",
"title": "comfyUI-tool-2lab [REMOVED]",

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,106 +1,5 @@
{
"models": [
{
"name": "Latent Bridge Matching for Image Relighting",
"type": "diffusion_model",
"base": "LBM",
"save_path": "diffusion_models/LBM",
"description": "Latent Bridge Matching (LBM) Relighting model",
"reference": "https://huggingface.co/jasperai/LBM_relighting",
"filename": "LBM_relighting.safetensors",
"url": "https://huggingface.co/jasperai/LBM_relighting/resolve/main/model.safetensors",
"size": "5.02GB"
},
{
"name": "LTX-Video 13B Distilled v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Distilled version of the LTX-Video 13B model, providing improved efficiency while maintaining high-resolution quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled.safetensors",
"size": "28.6GB"
},
{
"name": "LTX-Video 13B Distilled FP8 v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Quantized distilled version of the LTX-Video 13B model, optimized for even lower VRAM usage while maintaining quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled-fp8.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled-fp8.safetensors",
"size": "15.7GB"
},
{
"name": "LTX-Video 13B Distilled LoRA v0.9.7",
"type": "lora",
"base": "LTX-Video",
"save_path": "loras",
"description": "A LoRA adapter that transforms the standard LTX-Video 13B model into a distilled version when loaded.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-distilled-lora128.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-distilled-lora128.safetensors",
"size": "1.33GB"
},
{
"name": "lllyasviel/FramePackI2V_HY",
"type": "FramePackI2V",
"base": "FramePackI2V",
"save_path": "diffusers/lllyasviel",
"description": "[SNAPSHOT] This is the f1k1_x_g9_f1k1f2k2f16k4_td FramePack for HY. [w/You cannot download this item on ComfyUI-Manager versions below V3.18]",
"reference": "https://huggingface.co/lllyasviel/FramePackI2V_HY",
"filename": "<huggingface>",
"url": "lllyasviel/FramePackI2V_HY",
"size": "25.75GB"
},
{
"name": "LTX-Video Spatial Upscaler v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Spatial upscaler model for LTX-Video. This model enhances the spatial resolution of generated videos.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-spatial-upscaler-0.9.7.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-spatial-upscaler-0.9.7.safetensors",
"size": "505MB"
},
{
"name": "LTX-Video Temporal Upscaler v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Temporal upscaler model for LTX-Video. This model enhances the temporal resolution and smoothness of generated videos.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-temporal-upscaler-0.9.7.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-temporal-upscaler-0.9.7.safetensors",
"size": "524MB"
},
{
"name": "LTX-Video 13B v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "High-resolution quality LTX-Video 13B model.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-dev.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-dev.safetensors",
"size": "28.6GB"
},
{
"name": "LTX-Video 13B FP8 v0.9.7",
"type": "checkpoint",
"base": "LTX-Video",
"save_path": "checkpoints/LTXV",
"description": "Quantized version of the LTX-Video 13B model, optimized for lower VRAM usage while maintaining high quality.",
"reference": "https://huggingface.co/Lightricks/LTX-Video",
"filename": "ltxv-13b-0.9.7-dev-fp8.safetensors",
"url": "https://huggingface.co/Lightricks/LTX-Video/resolve/main/ltxv-13b-0.9.7-dev-fp8.safetensors",
"size": "15.7GB"
},
{
"name": "Comfy-Org/Wan2.1 i2v 480p 14B (bf16)",
"type": "diffusion_model",
@@ -691,6 +590,121 @@
"filename": "sigclip_vision_patch14_384.safetensors",
"url": "https://huggingface.co/Comfy-Org/sigclip_vision_384/resolve/main/sigclip_vision_patch14_384.safetensors",
"size": "857MB"
},
{
"name": "comfyanonymous/flux_text_encoders - t5xxl (fp16)",
"type": "clip",
"base": "t5",
"save_path": "text_encoders/t5",
"description": "Text Encoders for FLUX (fp16)",
"reference": "https://huggingface.co/comfyanonymous/flux_text_encoders",
"filename": "t5xxl_fp16.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors",
"size": "9.79GB"
},
{
"name": "comfyanonymous/flux_text_encoders - t5xxl (fp8_e4m3fn)",
"type": "clip",
"base": "t5",
"save_path": "text_encoders/t5",
"description": "Text Encoders for FLUX (fp8_e4m3fn)",
"reference": "https://huggingface.co/comfyanonymous/flux_text_encoders",
"filename": "t5xxl_fp8_e4m3fn.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors",
"size": "4.89GB"
},
{
"name": "comfyanonymous/flux_text_encoders - t5xxl (fp8_e4m3fn_scaled)",
"type": "clip",
"base": "t5",
"save_path": "text_encoders/t5",
"description": "Text Encoders for FLUX (fp16)",
"reference": "https://huggingface.co/comfyanonymous/flux_text_encoders",
"filename": "t5xxl_fp8_e4m3fn_scaled.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn_scaled.safetensors",
"size": "5.16GB"
},
{
"name": "FLUX.1 [Dev] Diffusion model (scaled fp8)",
"type": "diffusion_model",
"base": "FLUX.1",
"save_path": "diffusion_models/FLUX1",
"description": "FLUX.1 [Dev] Diffusion model (scaled fp8)[w/Due to the large size of the model, it is recommended to download it through a browser if possible.]",
"reference": "https://huggingface.co/comfyanonymous/flux_dev_scaled_fp8_test",
"filename": "flux_dev_fp8_scaled_diffusion_model.safetensors",
"url": "https://huggingface.co/comfyanonymous/flux_dev_scaled_fp8_test/resolve/main/flux_dev_fp8_scaled_diffusion_model.safetensors",
"size": "11.9GB"
},
{
"name": "kijai/MoGe_ViT_L_fp16.safetensors",
"type": "MoGe",
"base": "MoGe",
"save_path": "MoGe",
"description": "Safetensors versions of [a/https://github.com/microsoft/MoGe](https://github.com/microsoft/MoGe)",
"reference": "https://huggingface.co/Kijai/MoGe_safetensors",
"filename": "MoGe_ViT_L_fp16.safetensors",
"url": "https://huggingface.co/Kijai/MoGe_safetensors/resolve/main/MoGe_ViT_L_fp16.safetensors",
"size": "628MB"
},
{
"name": "kijai/MoGe_ViT_L_fp16.safetensors",
"type": "MoGe",
"base": "MoGe",
"save_path": "MoGe",
"description": "Safetensors versions of [a/https://github.com/microsoft/MoGe](https://github.com/microsoft/MoGe)",
"reference": "https://huggingface.co/Kijai/MoGe_safetensors",
"filename": "MoGe_ViT_L_fp16.safetensors",
"url": "https://huggingface.co/Kijai/MoGe_safetensors/resolve/main/MoGe_ViT_L_fp16.safetensors",
"size": "1.26GB"
},
{
"name": "pulid_flux_v0.9.1.safetensors",
"type": "PuLID",
"base": "FLUX",
"save_path": "pulid",
"description": "This is required for PuLID (FLUX)",
"reference": "https://huggingface.co/guozinan/PuLID",
"filename": "pulid_flux_v0.9.1.safetensors",
"url": "https://huggingface.co/guozinan/PuLID/resolve/main/pulid_flux_v0.9.1.safetensors",
"size": "1.14GB"
},
{
"name": "pulid_v1.1.safetensors",
"type": "PuLID",
"base": "SDXL",
"save_path": "pulid",
"description": "This is required for PuLID (SDXL)",
"reference": "https://huggingface.co/guozinan/PuLID",
"filename": "pulid_v1.1.safetensors",
"url": "https://huggingface.co/guozinan/PuLID/resolve/main/pulid_v1.1.safetensors",
"size": "984MB"
},
{
"name": "Kolors-IP-Adapter-Plus.bin (Kwai-Kolors/Kolors-IP-Adapter-Plus)",
"type": "IP-Adapter",
"base": "Kolors",
"save_path": "ipadapter",
"description": "You can use this model in the [a/ComfyUI IPAdapter plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus) extension.",
"reference": "https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-Plus",
"filename": "Kolors-IP-Adapter-Plus.bin",
"url": "https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-Plus/resolve/main/ip_adapter_plus_general.bin",
"size": "1.01GB"
},
{
"name": "Kolors-IP-Adapter-FaceID-Plus.bin (Kwai-Kolors/Kolors-IP-Adapter-Plus)",
"type": "IP-Adapter",
"base": "Kolors",
"save_path": "ipadapter",
"description": "You can use this model in the [a/ComfyUI IPAdapter plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus) extension.",
"reference": "https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",
"filename": "Kolors-IP-Adapter-FaceID-Plus.bin",
"url": "https://huggingface.co/Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus/resolve/main/ipa-faceid-plus.bin",
"size": "2.39GB"
}
]
}

View File

@@ -1,15 +1,5 @@
{
"custom_nodes": [
{
"author": "Comfy-Org",
"title": "ComfyUI React Extension Template",
"reference": "https://github.com/Comfy-Org/ComfyUI-React-Extension-Template",
"files": [
"https://github.com/Comfy-Org/ComfyUI-React-Extension-Template"
],
"install_type": "git-clone",
"description": "A minimal template for creating React/TypeScript frontend extensions for ComfyUI, with complete boilerplate setup including internationalization and unit testing."
},
{
"author": "Suzie1",
"title": "Guide To Making Custom Nodes in ComfyUI",

View File

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "comfyui-manager"
license = { text = "GPL-3.0-only" }
version = "4.0.0-beta.4"
version = "4.0.0-beta.1"
requires-python = ">= 3.9"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
readme = "README.md"
@@ -13,9 +13,9 @@ keywords = ["comfyui", "comfyui-manager"]
maintainers = [
{ name = "Dr.Lt.Data", email = "dr.lt.data@gmail.com" },
{ name = "Yoland Yan", email = "yoland@comfy.org" },
{ name = "Yoland Yan", email = "yoland@drip.art" },
{ name = "James Kwon", email = "hongilkwon316@gmail.com" },
{ name = "Robin Huang", email = "robin@comfy.org" },
{ name = "Robin Huang", email = "robin@drip.art" },
]
classifiers = [
@@ -48,9 +48,6 @@ Repository = "https://github.com/ltdrdata/ComfyUI-Manager"
where = ["."]
include = ["comfyui_manager*"]
[project.scripts]
cm-cli = "comfyui_manager.cm_cli.__main__:main"
[tool.ruff]
line-length = 120
target-version = "py39"

View File

@@ -1,13 +0,0 @@
[tool:pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
-v
--tb=short
--strict-markers
--disable-warnings
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
integration: marks tests as integration tests

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env python3
"""
Simple test runner for ComfyUI-Manager tests.
Usage:
python run_tests.py # Run all tests
python run_tests.py -k test_task_queue # Run specific tests
python run_tests.py --cov # Run with coverage
"""
import sys
import subprocess
from pathlib import Path
def main():
"""Run pytest with appropriate arguments"""
# Ensure we're in the project directory
project_root = Path(__file__).parent
# Base pytest command
cmd = [sys.executable, "-m", "pytest"]
# Add any command line arguments passed to this script
cmd.extend(sys.argv[1:])
# Add default arguments if none provided
if len(sys.argv) == 1:
cmd.extend([
"tests/",
"-v",
"--tb=short"
])
print(f"Running: {' '.join(cmd)}")
print(f"Working directory: {project_root}")
# Run pytest
result = subprocess.run(cmd, cwd=project_root)
sys.exit(result.returncode)
if __name__ == "__main__":
main()

View File

@@ -94,7 +94,7 @@ def extract_nodes(code_text):
return s
else:
return set()
except Exception:
except:
return set()
@@ -102,8 +102,12 @@ def extract_nodes(code_text):
def scan_in_file(filename, is_builtin=False):
global builtin_nodes
with open(filename, encoding='utf-8', errors='ignore') as file:
code = file.read()
try:
with open(filename, encoding='utf-8') as file:
code = file.read()
except UnicodeDecodeError:
with open(filename, encoding='cp949') as file:
code = file.read()
pattern = r"_CLASS_MAPPINGS\s*=\s*{([^}]*)}"
regex = re.compile(pattern, re.MULTILINE | re.DOTALL)
@@ -293,7 +297,7 @@ def update_custom_nodes():
pass
def is_rate_limit_exceeded():
return g.rate_limiting[0] <= 20
return g.rate_limiting[0] == 0
if is_rate_limit_exceeded():
print(f"GitHub API Rate Limit Exceeded: remained - {(g.rate_limiting_resettime - datetime.datetime.now().timestamp())/60:.2f} min")
@@ -396,7 +400,7 @@ def update_custom_nodes():
try:
download_url(url, temp_dir)
except Exception:
except:
print(f"[ERROR] Cannot download '{url}'")
with concurrent.futures.ThreadPoolExecutor(10) as executor:

View File

@@ -1,89 +0,0 @@
# ComfyUI-Manager Tests
This directory contains unit tests for ComfyUI-Manager components.
## Running Tests
### Using the Virtual Environment
```bash
# From the project root
/path/to/comfyui/.venv/bin/python -m pytest tests/ -v
```
### Using the Test Runner
```bash
# Run all tests
python run_tests.py
# Run specific tests
python run_tests.py -k test_task_queue
# Run with coverage
python run_tests.py --cov
```
## Test Structure
### test_task_queue.py
Comprehensive tests for the TaskQueue functionality including:
- **Basic Operations**: Initialization, adding/removing tasks, state management
- **Batch Tracking**: Automatic batch creation, history saving, finalization
- **Thread Safety**: Concurrent access, worker lifecycle management
- **Integration Testing**: Full task processing workflow
- **Edge Cases**: Empty queues, invalid data, exception handling
**Key Features Tested:**
- ✅ Task queueing with Pydantic model validation
- ✅ Batch history tracking and persistence
- ✅ Thread-safe concurrent operations
- ✅ Worker thread lifecycle management
- ✅ WebSocket message tracking
- ✅ State snapshots and transitions
### MockTaskQueue
The tests use a `MockTaskQueue` class that:
- Isolates testing from global state and external dependencies
- Provides dependency injection for mocking external services
- Maintains the same API as the real TaskQueue
- Supports both synchronous and asynchronous testing patterns
## Test Categories
- **Unit Tests**: Individual method testing with mocked dependencies
- **Integration Tests**: Full workflow testing with real threading
- **Concurrency Tests**: Multi-threaded access verification
- **Edge Case Tests**: Error conditions and boundary cases
## Dependencies
Tests require:
- `pytest` - Test framework
- `pytest-asyncio` - Async test support
- `pydantic` - Data model validation
Install with: `pip install -e ".[dev]"`
## Design Notes
### Handling Singleton Pattern
The real TaskQueue uses a singleton pattern which makes testing challenging. The MockTaskQueue avoids this by:
- Not setting global instance variables
- Creating fresh instances per test
- Providing controlled dependency injection
### Thread Management
Tests handle threading complexities by:
- Using controlled mock workers for predictable behavior
- Providing synchronization primitives for timing-sensitive tests
- Testing both successful workflows and exception scenarios
### Heapq Compatibility
The original TaskQueue uses `heapq` with Pydantic models, which don't support comparison by default. Tests solve this by wrapping items in comparable tuples with priority values, maintaining FIFO order while enabling heap operations.

View File

@@ -1 +0,0 @@
"""Test suite for ComfyUI-Manager"""

View File

@@ -1,510 +0,0 @@
"""
Tests for TaskQueue functionality.
This module tests the core TaskQueue operations including:
- Task queueing and processing
- Batch tracking
- Thread lifecycle management
- State management
- WebSocket message delivery
"""
import asyncio
import json
import threading
import time
import uuid
from datetime import datetime
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, Mock, patch
from typing import Any, Dict, Optional
import pytest
from comfyui_manager.data_models import (
QueueTaskItem,
TaskExecutionStatus,
TaskStateMessage,
InstallPackParams,
ManagerDatabaseSource,
ManagerChannel,
)
class MockTaskQueue:
"""
A testable version of TaskQueue that allows for dependency injection
and isolated testing without global state.
"""
def __init__(self, history_dir: Optional[Path] = None):
# Don't set the global instance for testing
self.mutex = threading.RLock()
self.not_empty = threading.Condition(self.mutex)
self.current_index = 0
self.pending_tasks = []
self.running_tasks = {}
self.history_tasks = {}
self.task_counter = 0
self.batch_id = None
self.batch_start_time = None
self.batch_state_before = None
self._worker_task = None
self._history_dir = history_dir
# Mock external dependencies
self.mock_core = MagicMock()
self.mock_prompt_server = MagicMock()
def is_processing(self) -> bool:
"""Check if the queue is currently processing tasks"""
return (
self._worker_task is not None
and self._worker_task.is_alive()
)
def start_worker(self, mock_task_worker=None) -> bool:
"""Start the task worker. Can inject a mock worker for testing."""
if self._worker_task is not None and self._worker_task.is_alive():
return False # Already running
if mock_task_worker:
self._worker_task = threading.Thread(target=mock_task_worker)
else:
# Use a simple test worker that processes one task then stops
self._worker_task = threading.Thread(target=self._test_worker)
self._worker_task.start()
return True
def _test_worker(self):
"""Simple test worker that processes tasks without external dependencies"""
while True:
task = self.get(timeout=1.0) # Short timeout for tests
if task is None:
if self.total_count() == 0:
break
continue
item, task_index = task
# Simulate task processing
self.running_tasks[task_index] = item
# Simulate work
time.sleep(0.1)
# Mark as completed
status = TaskExecutionStatus(
status_str="success",
completed=True,
messages=["Test task completed"]
)
self.mark_done(task_index, item, status, "Test result")
# Clean up
if task_index in self.running_tasks:
del self.running_tasks[task_index]
def get_current_state(self) -> TaskStateMessage:
"""Get current queue state with mocked dependencies"""
return TaskStateMessage(
history=self.get_history(),
running_queue=self.get_current_queue()[0],
pending_queue=self.get_current_queue()[1],
installed_packs={} # Mocked empty
)
def send_queue_state_update(self, msg: str, update, client_id: Optional[str] = None):
"""Mock implementation that tracks calls instead of sending WebSocket messages"""
if not hasattr(self, '_sent_updates'):
self._sent_updates = []
self._sent_updates.append({
'msg': msg,
'update': update,
'client_id': client_id
})
# Copy the essential methods from the real TaskQueue
def put(self, item) -> None:
"""Add a task to the queue. Item can be a dict or QueueTaskItem model."""
with self.mutex:
# Start a new batch if this is the first task after queue was empty
if (
self.batch_id is None
and len(self.pending_tasks) == 0
and len(self.running_tasks) == 0
):
self._start_new_batch()
# Convert to Pydantic model if it's a dict
if isinstance(item, dict):
item = QueueTaskItem(**item)
import heapq
# Wrap in tuple with priority to make it comparable
# Use task_counter as priority to maintain FIFO order
priority_item = (self.task_counter, item)
heapq.heappush(self.pending_tasks, priority_item)
self.task_counter += 1
self.not_empty.notify()
def _start_new_batch(self) -> None:
"""Start a new batch session for tracking operations."""
self.batch_id = (
f"test_batch_{datetime.now().strftime('%Y%m%d_%H%M%S')}_{uuid.uuid4().hex[:8]}"
)
self.batch_start_time = datetime.now().isoformat()
self.batch_state_before = {"test": "state"} # Simplified for testing
def get(self, timeout: Optional[float] = None):
"""Get next task from queue"""
with self.not_empty:
while len(self.pending_tasks) == 0:
self.not_empty.wait(timeout=timeout)
if timeout is not None and len(self.pending_tasks) == 0:
return None
import heapq
priority_item = heapq.heappop(self.pending_tasks)
task_index, item = priority_item # Unwrap the tuple
return item, task_index
def total_count(self) -> int:
"""Get total number of tasks (pending + running)"""
return len(self.pending_tasks) + len(self.running_tasks)
def done_count(self) -> int:
"""Get number of completed tasks"""
return len(self.history_tasks)
def get_current_queue(self):
"""Get current running and pending queues"""
running = list(self.running_tasks.values())
# Extract items from the priority tuples
pending = [item for priority, item in self.pending_tasks]
return running, pending
def get_history(self):
"""Get task history"""
return self.history_tasks
def mark_done(self, task_index: int, item: QueueTaskItem, status: TaskExecutionStatus, result: str):
"""Mark a task as completed"""
from comfyui_manager.data_models import TaskHistoryItem
history_item = TaskHistoryItem(
ui_id=item.ui_id,
client_id=item.client_id,
kind=item.kind.value if hasattr(item.kind, 'value') else str(item.kind),
timestamp=datetime.now().isoformat(),
result=result,
status=status
)
self.history_tasks[item.ui_id] = history_item
def finalize(self):
"""Finalize batch (simplified for testing)"""
if self._history_dir and self.batch_id:
batch_file = self._history_dir / f"{self.batch_id}.json"
batch_record = {
"batch_id": self.batch_id,
"start_time": self.batch_start_time,
"state_before": self.batch_state_before,
"operations": [] # Simplified
}
with open(batch_file, 'w') as f:
json.dump(batch_record, f, indent=2)
class TestTaskQueue:
"""Test suite for TaskQueue functionality"""
@pytest.fixture
def task_queue(self, tmp_path):
"""Create a clean TaskQueue instance for each test"""
return MockTaskQueue(history_dir=tmp_path)
@pytest.fixture
def sample_task(self):
"""Create a sample task for testing"""
return QueueTaskItem(
ui_id=str(uuid.uuid4()),
client_id="test_client",
kind="install",
params=InstallPackParams(
id="test-node",
version="1.0.0",
selected_version="1.0.0",
mode=ManagerDatabaseSource.cache,
channel=ManagerChannel.dev
)
)
def test_task_queue_initialization(self, task_queue):
"""Test TaskQueue initializes with correct default state"""
assert task_queue.total_count() == 0
assert task_queue.done_count() == 0
assert not task_queue.is_processing()
assert task_queue.batch_id is None
assert len(task_queue.pending_tasks) == 0
assert len(task_queue.running_tasks) == 0
assert len(task_queue.history_tasks) == 0
def test_put_task_starts_batch(self, task_queue, sample_task):
"""Test that adding first task starts a new batch"""
assert task_queue.batch_id is None
task_queue.put(sample_task)
assert task_queue.batch_id is not None
assert task_queue.batch_id.startswith("test_batch_")
assert task_queue.batch_start_time is not None
assert task_queue.total_count() == 1
def test_put_multiple_tasks(self, task_queue, sample_task):
"""Test adding multiple tasks to queue"""
task_queue.put(sample_task)
# Create second task
task2 = QueueTaskItem(
ui_id=str(uuid.uuid4()),
client_id="test_client_2",
kind="install",
params=sample_task.params
)
task_queue.put(task2)
assert task_queue.total_count() == 2
assert len(task_queue.pending_tasks) == 2
def test_put_task_with_dict(self, task_queue):
"""Test adding task as dictionary gets converted to QueueTaskItem"""
task_dict = {
"ui_id": str(uuid.uuid4()),
"client_id": "test_client",
"kind": "install",
"params": {
"id": "test-node",
"version": "1.0.0",
"selected_version": "1.0.0",
"mode": "cache",
"channel": "dev"
}
}
task_queue.put(task_dict)
assert task_queue.total_count() == 1
# Verify it was converted to QueueTaskItem
item, _ = task_queue.get(timeout=0.1)
assert isinstance(item, QueueTaskItem)
assert item.ui_id == task_dict["ui_id"]
def test_get_task_from_queue(self, task_queue, sample_task):
"""Test retrieving task from queue"""
task_queue.put(sample_task)
item, task_index = task_queue.get(timeout=0.1)
assert item == sample_task
assert isinstance(task_index, int)
assert task_queue.total_count() == 0 # Should be removed from pending
def test_get_task_timeout(self, task_queue):
"""Test get with timeout on empty queue returns None"""
result = task_queue.get(timeout=0.1)
assert result is None
def test_start_stop_worker(self, task_queue):
"""Test worker thread lifecycle"""
assert not task_queue.is_processing()
# Mock worker that stops immediately
stop_event = threading.Event()
def mock_worker():
stop_event.wait(0.1) # Brief delay then stop
started = task_queue.start_worker(mock_worker)
assert started is True
assert task_queue.is_processing()
# Try to start again - should return False
started_again = task_queue.start_worker(mock_worker)
assert started_again is False
# Wait for worker to finish
stop_event.set()
task_queue._worker_task.join(timeout=1.0)
assert not task_queue.is_processing()
def test_task_processing_integration(self, task_queue, sample_task):
"""Test full task processing workflow"""
# Add task to queue
task_queue.put(sample_task)
assert task_queue.total_count() == 1
# Start worker
started = task_queue.start_worker()
assert started is True
# Wait for processing to complete
for _ in range(50): # Max 5 seconds
if task_queue.done_count() > 0:
break
time.sleep(0.1)
# Verify task was processed
assert task_queue.done_count() == 1
assert task_queue.total_count() == 0
assert sample_task.ui_id in task_queue.history_tasks
# Stop worker
task_queue._worker_task.join(timeout=1.0)
def test_get_current_state(self, task_queue, sample_task):
"""Test getting current queue state"""
task_queue.put(sample_task)
state = task_queue.get_current_state()
assert isinstance(state, TaskStateMessage)
assert len(state.pending_queue) == 1
assert len(state.running_queue) == 0
assert state.pending_queue[0] == sample_task
def test_batch_finalization(self, task_queue, tmp_path):
"""Test batch history is saved correctly"""
task_queue.put(QueueTaskItem(
ui_id=str(uuid.uuid4()),
client_id="test_client",
kind="install",
params=InstallPackParams(
id="test-node",
version="1.0.0",
selected_version="1.0.0",
mode=ManagerDatabaseSource.cache,
channel=ManagerChannel.dev
)
))
batch_id = task_queue.batch_id
task_queue.finalize()
# Check batch file was created
batch_file = tmp_path / f"{batch_id}.json"
assert batch_file.exists()
# Verify content
with open(batch_file) as f:
batch_data = json.load(f)
assert batch_data["batch_id"] == batch_id
assert "start_time" in batch_data
assert "state_before" in batch_data
def test_concurrent_access(self, task_queue):
"""Test thread-safe concurrent access to queue"""
num_tasks = 10
added_tasks = []
def add_tasks():
for i in range(num_tasks):
task = QueueTaskItem(
ui_id=f"task_{i}",
client_id=f"client_{i}",
kind="install",
params=InstallPackParams(
id=f"node_{i}",
version="1.0.0",
selected_version="1.0.0",
mode=ManagerDatabaseSource.cache,
channel=ManagerChannel.dev
)
)
task_queue.put(task)
added_tasks.append(task)
# Start multiple threads adding tasks
threads = []
for _ in range(3):
thread = threading.Thread(target=add_tasks)
threads.append(thread)
thread.start()
# Wait for all threads to complete
for thread in threads:
thread.join()
# Verify all tasks were added
assert task_queue.total_count() == num_tasks * 3
assert len(added_tasks) == num_tasks * 3
@pytest.mark.asyncio
async def test_queue_state_updates_tracking(self, task_queue, sample_task):
"""Test that queue state updates are tracked properly"""
# Mock the update tracking
task_queue.send_queue_state_update("test-message", {"test": "data"}, "client1")
# Verify update was tracked
assert hasattr(task_queue, '_sent_updates')
assert len(task_queue._sent_updates) == 1
update = task_queue._sent_updates[0]
assert update['msg'] == "test-message"
assert update['update'] == {"test": "data"}
assert update['client_id'] == "client1"
class TestTaskQueueEdgeCases:
"""Test edge cases and error conditions"""
@pytest.fixture
def task_queue(self):
return MockTaskQueue()
def test_empty_queue_operations(self, task_queue):
"""Test operations on empty queue"""
assert task_queue.total_count() == 0
assert task_queue.done_count() == 0
# Getting from empty queue should timeout
result = task_queue.get(timeout=0.1)
assert result is None
# State should be empty
state = task_queue.get_current_state()
assert len(state.pending_queue) == 0
assert len(state.running_queue) == 0
def test_invalid_task_data(self, task_queue):
"""Test handling of invalid task data"""
# This should raise ValidationError due to missing required fields
with pytest.raises(Exception): # ValidationError from Pydantic
task_queue.put({
"ui_id": "test",
# Missing required fields
})
def test_worker_cleanup_on_exception(self, task_queue):
"""Test worker cleanup when worker function raises exception"""
exception_raised = threading.Event()
def failing_worker():
exception_raised.set()
raise RuntimeError("Test exception")
started = task_queue.start_worker(failing_worker)
assert started is True
# Wait for exception to be raised
exception_raised.wait(timeout=1.0)
# Worker should eventually stop
task_queue._worker_task.join(timeout=1.0)
assert not task_queue.is_processing()
if __name__ == "__main__":
# Allow running tests directly
pytest.main([__file__])