Files
sammykumar-ComfyUI-SwissArm…/__init__.py
T
Sam Kumar 69dac5ea9d ✨ (init.py): add get_version() function to read version from pyproject.toml for cache busting
📝 (GET_VERSION_IMPORT_FIX.md): document the import error fix for get_version() function
⬆️ (pyproject.toml): bump version from 2.0.0 to 2.0.1 to reflect new changes
2025-10-01 17:49:59 -05:00

44 lines
1.6 KiB
Python

import os
from .utils.nodes import NODE_CLASS_MAPPINGS as MAIN_NODE_CLASS_MAPPINGS
from .utils.nodes import NODE_DISPLAY_NAME_MAPPINGS as MAIN_NODE_DISPLAY_NAME_MAPPINGS
from .utils.helper_nodes import HELPER_NODE_CLASS_MAPPINGS
from .utils.helper_nodes import HELPER_NODE_DISPLAY_NAME_MAPPINGS
# Import lora_manager nodes
try:
from .utils.lora_manager import NODE_CLASS_MAPPINGS as LORA_MANAGER_NODE_CLASS_MAPPINGS
from .utils.lora_manager import NODE_DISPLAY_NAME_MAPPINGS as LORA_MANAGER_NODE_DISPLAY_NAME_MAPPINGS
except ImportError as e:
print(f"Warning: Could not import lora_manager nodes: {e}")
LORA_MANAGER_NODE_CLASS_MAPPINGS = {}
LORA_MANAGER_NODE_DISPLAY_NAME_MAPPINGS = {}
# Get version from pyproject.toml for cache busting
def get_version():
try:
import tomllib
pyproject_path = os.path.join(os.path.dirname(__file__), "pyproject.toml")
with open(pyproject_path, "rb") as f:
data = tomllib.load(f)
return data["project"]["version"]
except Exception:
# Fallback to timestamp if version reading fails
import time
return str(int(time.time()))
# Combine main nodes, helper nodes, and lora_manager nodes
NODE_CLASS_MAPPINGS = {
**MAIN_NODE_CLASS_MAPPINGS,
**HELPER_NODE_CLASS_MAPPINGS,
**LORA_MANAGER_NODE_CLASS_MAPPINGS
}
NODE_DISPLAY_NAME_MAPPINGS = {
**MAIN_NODE_DISPLAY_NAME_MAPPINGS,
**HELPER_NODE_DISPLAY_NAME_MAPPINGS,
**LORA_MANAGER_NODE_DISPLAY_NAME_MAPPINGS
}
WEB_DIRECTORY = "./web"
VERSION = get_version()
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY", "VERSION"]