Browse Source

support disable.py/enable.py scripts

pull/33/head
Dr.Lt.Data 1 year ago
parent
commit
3dcf04e324
  1. 30
      README.md
  2. 11
      __init__.py
  3. 2
      custom-node-list.json
  4. 90
      extension-node-map.json
  5. 11
      prestartup_script.py

30
README.md

@ -74,6 +74,7 @@ You can execute ComfyUI by running either `./run_gpu.sh` or `./run_cpu.sh` depen
* Please submit a pull request to update either the custom-node-list.json or model-list.json file. * Please submit a pull request to update either the custom-node-list.json or model-list.json file.
* The scanner currently provides a detection function for missing nodes, which is capable of detecting nodes described by the following two patterns. * The scanner currently provides a detection function for missing nodes, which is capable of detecting nodes described by the following two patterns.
* Or you can provide manually `node_list.js` file.
``` ```
NODE_CLASS_MAPPINGS = { NODE_CLASS_MAPPINGS = {
@ -88,6 +89,16 @@ NODE_CLASS_MAPPINGS.update({
}) })
``` ```
* **Special purpose files** (optional)
* `node_list.js` - When your custom nodes pattern of NODE_CLASS_MAPPINGS is not conventional, it is used to manually provide a list of nodes for reference. ([example](https://github.com/melMass/comfy_mtb/raw/main/node_list.json))
* `requirements.txt` - When installing, this pip requirements will be installed automatically
* `install.py` - When installing, it is automatically called
* `uninstall.py` - When uninstalling, it is automatically called
* `disable.py` - When disabled, it is automatically called
* When installing a custom node setup `.js` file, it is recommended to write this script for disabling.
* `enable.py` - When enabled, it is automatically called
# Support of missing nodes installation # Support of missing nodes installation
![missing-menu](misc/missing-menu.png) ![missing-menu](misc/missing-menu.png)
@ -115,15 +126,16 @@ NODE_CLASS_MAPPINGS.update({
# Roadmap # Roadmap
* installation from git url - [x] category/keyword filter
* 3rd party repository - [x] Automatic recognition of missing custom nodes
* category/keyword filter - [x] Automatic installation suggestion of missing custom nodes
* Specification of custom nodes - [ ] installation from git url
* Specification scanner - [ ] 3rd party repository
* Search extension by node name - [ ] Specification of custom nodes
* Automatic recognition of missing custom nodes - [ ] Specification scanner
* Automatic installation suggestion of missing custom nodes - [ ] Search extension by node name
* workflow downloader - [ ] workflow downloader
# Disclaimer # Disclaimer

11
__init__.py

@ -32,7 +32,7 @@ sys.path.append('../..')
from torchvision.datasets.utils import download_url from torchvision.datasets.utils import download_url
# ensure .js # ensure .js
print("### Loading: ComfyUI-Manager (V0.13)") print("### Loading: ComfyUI-Manager (V0.14)")
comfy_ui_revision = "Unknown" comfy_ui_revision = "Unknown"
@ -656,6 +656,15 @@ def gitclone_set_active(files, is_disable):
os.rename(current_path, new_path) os.rename(current_path, new_path)
if is_disable:
if os.path.exists(os.path.join(new_path, "disable.py")):
disable_script = [sys.executable, "disable.py"]
try_install_script(url, new_path, disable_script)
else:
if os.path.exists(os.path.join(new_path, "enable.py")):
enable_script = [sys.executable, "enable.py"]
try_install_script(url, new_path, enable_script)
except Exception as e: except Exception as e:
print(f"{action_name}(git-clone) error: {url} / {e}") print(f"{action_name}(git-clone) error: {url} / {e}")
return False return False

2
custom-node-list.json

@ -756,7 +756,7 @@
"https://github.com/ArtVentureX/comfyui-animatediff" "https://github.com/ArtVentureX/comfyui-animatediff"
], ],
"install_type": "git-clone", "install_type": "git-clone",
"description": "AnimateDiff integration for ComfyUI, adapts from sd-webui-animatediff." "description": "AnimateDiff integration for ComfyUI, adapts from sd-webui-animatediff.<br><p style='background-color: black; color: red;'>You only need to download one of <a href='https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v14.ckpt'>mm_sd_v14.ckpt</a> | <a href='https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15.ckpt'>mm_sd_v15.ckpt</a>. Put the model weights under <b>comfyui-animatediff/models/<b>. DO NOT change model filename.</p>"
}, },
{ {
"author": "twri", "author": "twri",

90
extension-node-map.json

@ -725,51 +725,51 @@
"Swap Color Mode" "Swap Color Mode"
], ],
"https://github.com/evanspearman/ComfyMath": [ "https://github.com/evanspearman/ComfyMath": [
"BreakoutVec2", "CM_BreakoutVec2",
"BreakoutVec3", "CM_BreakoutVec3",
"BreakoutVec4", "CM_BreakoutVec4",
"ComposeVec2", "CM_ComposeVec2",
"ComposeVec3", "CM_ComposeVec3",
"ComposeVec4", "CM_ComposeVec4",
"FloatToInt", "CM_FloatBinaryCondition",
"FloatToNumber", "CM_FloatBinaryOperation",
"IntToFloat", "CM_FloatToInt",
"IntToNumber", "CM_FloatToNumber",
"NumberToFloat", "CM_FloatUnaryCondition",
"NumberToInt", "CM_FloatUnaryOperation",
"Vec2Add", "CM_IntBinaryCondition",
"Vec2Cross", "CM_IntBinaryOperation",
"Vec2Distance", "CM_IntToFloat",
"Vec2Dot", "CM_IntToNumber",
"Vec2Eq", "CM_IntUnaryCondition",
"Vec2Ne", "CM_IntUnaryOperation",
"Vec2Neg", "CM_NumberBinaryCondition",
"Vec2Norm", "CM_NumberBinaryOperation",
"Vec2Normalize", "CM_NumberToFloat",
"Vec2ScalarMul", "CM_NumberToInt",
"Vec2Sub", "CM_NumberUnaryCondition",
"Vec3Add", "CM_NumberUnaryOperation",
"Vec3Cross", "CM_Vec2BinaryCondition",
"Vec3Distance", "CM_Vec2BinaryOperation",
"Vec3Dot", "CM_Vec2ScalarOperation",
"Vec3Eq", "CM_Vec2ToScalarBinaryOperation",
"Vec3Ne", "CM_Vec2ToScalarUnaryOperation",
"Vec3Neg", "CM_Vec2UnaryCondition",
"Vec3Norm", "CM_Vec2UnaryOperation",
"Vec3Normalize", "CM_Vec3BinaryCondition",
"Vec3ScalarMul", "CM_Vec3BinaryOperation",
"Vec3Sub", "CM_Vec3ScalarOperation",
"Vec4Add", "CM_Vec3ToScalarBinaryOperation",
"Vec4Cross", "CM_Vec3ToScalarUnaryOperation",
"Vec4Distance", "CM_Vec3UnaryCondition",
"Vec4Dot", "CM_Vec3UnaryOperation",
"Vec4Eq", "CM_Vec4BinaryCondition",
"Vec4Ne", "CM_Vec4BinaryOperation",
"Vec4Neg", "CM_Vec4ScalarOperation",
"Vec4Norm", "CM_Vec4ToScalarBinaryOperation",
"Vec4Normalize", "CM_Vec4ToScalarUnaryOperation",
"Vec4ScalarMul", "CM_Vec4UnaryCondition",
"Vec4Sub" "CM_Vec4UnaryOperation"
], ],
"https://github.com/filipemeneses/comfy_pixelization": [ "https://github.com/filipemeneses/comfy_pixelization": [
"Pixelization" "Pixelization"

11
prestartup_script.py

@ -6,7 +6,7 @@ script_list_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "st
# Check if script_list_path exists # Check if script_list_path exists
if os.path.exists(script_list_path): if os.path.exists(script_list_path):
print("\n#######################################################################") print("\n#######################################################################")
print("[ComfyUI-Manager] Starting dependency installation for the extension\n") print("[ComfyUI-Manager] Starting dependency installation/(de)activation for the extension\n")
executed = set() executed = set()
# Read each line from the file and convert it to a list using eval # Read each line from the file and convert it to a list using eval
@ -19,19 +19,18 @@ if os.path.exists(script_list_path):
try: try:
script = eval(line) script = eval(line)
print(f"\n## Install dependency for '{script[0]}'") print(f"\n## Execute install/(de)activation script for '{script[0]}'")
code = subprocess.run(script[1:], cwd=script[0]) code = subprocess.run(script[1:], cwd=script[0])
if code.returncode != 0: if code.returncode != 0:
print(f"install script failed: {script[0]}") print(f"install/(de)activation script failed: {script[0]}")
except Exception as e: except Exception as e:
print(f"[ERROR] Failed to install: {line} / {e}") print(f"[ERROR] Failed to execute install/(de)activation script: {line} / {e}")
# Remove the script_list_path file # Remove the script_list_path file
if os.path.exists(script_list_path): if os.path.exists(script_list_path):
os.remove(script_list_path) os.remove(script_list_path)
print("\n[ComfyUI-Manager] Dependency installation completed.") print("\n[ComfyUI-Manager] Startup script completed.")
print("#######################################################################\n") print("#######################################################################\n")

Loading…
Cancel
Save