Skip to content

[pull] master from comfyanonymous:master #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion comfy_config/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List, Optional

Expand Down Expand Up @@ -50,6 +50,7 @@ class ComfyConfig(BaseModel):
icon: str = Field(default="", alias="Icon")
models: List[Model] = Field(default_factory=list, alias="Models")
includes: List[str] = Field(default_factory=list)
web: Optional[str] = None


class License(BaseModel):
Expand All @@ -66,6 +67,18 @@ class ProjectConfig(BaseModel):
license: License = Field(default_factory=License)
urls: URLs = Field(default_factory=URLs)

@field_validator('license', mode='before')
@classmethod
def validate_license(cls, v):
if isinstance(v, str):
return License(text=v)
elif isinstance(v, dict):
return License(**v)
elif isinstance(v, License):
return v
else:
return License()


class PyProjectConfig(BaseModel):
project: ProjectConfig = Field(default_factory=ProjectConfig)
Expand Down
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
os.environ['HF_HUB_DISABLE_TELEMETRY'] = '1'
os.environ['DO_NOT_TRACK'] = '1'


setup_logger(log_level=args.verbose, use_stdout=args.log_stdout)

def apply_custom_paths():
Expand Down Expand Up @@ -310,6 +309,9 @@ async def start_all():
logging.info("Python version: {}".format(sys.version))
logging.info("ComfyUI version: {}".format(comfyui_version.__version__))

if sys.version_info.major == 3 and sys.version_info.minor < 10:
logging.warning("WARNING: You are using a python version older than 3.10, please upgrade to a newer one. 3.12 and above is recommended.")

event_loop, _, start_all_func = start_comfyui()
try:
x = start_all_func()
Expand Down
19 changes: 19 additions & 0 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,25 @@ def load_custom_node(module_path: str, ignore=set(), module_parent="custom_nodes

LOADED_MODULE_DIRS[module_name] = os.path.abspath(module_dir)

try:
from comfy_config import config_parser

project_config = config_parser.extract_node_configuration(module_path)

web_dir_name = project_config.tool_comfy.web

if web_dir_name:
web_dir_path = os.path.join(module_path, web_dir_name)

if os.path.isdir(web_dir_path):
project_name = project_config.project.name

EXTENSION_WEB_DIRS[project_name] = web_dir_path

logging.info("Automatically register web folder {} for {}".format(web_dir_name, project_name))
except Exception as e:
logging.warning(f"Unable to parse pyproject.toml due to lack dependency pydantic-settings, please run 'pip install -r requirements.txt': {e}")

if hasattr(module, "WEB_DIRECTORY") and getattr(module, "WEB_DIRECTORY") is not None:
web_dir = os.path.abspath(os.path.join(module_dir, getattr(module, "WEB_DIRECTORY")))
if os.path.isdir(web_dir):
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
comfyui-frontend-package==1.21.7
comfyui-workflow-templates==0.1.27
comfyui-workflow-templates==0.1.25
comfyui-embedded-docs==0.2.0
torch
torchsde
Expand Down Expand Up @@ -27,3 +27,4 @@ spandrel
soundfile
av>=14.2.0
pydantic~=2.0
pydantic-settings~=2.0
Loading