Chaoses-Ib / ComfyScript

A Python frontend and library for ComfyUI
https://discord.gg/arqJbtEg7w
MIT License
431 stars 24 forks source link

How ComfyScript handle the missing node? #17

Open thhung opened 10 months ago

thhung commented 10 months ago

As the title. Do we need to connect to Comfy to install it by ourself? It is more convenience to be able to install all the missing node from ComfyScript.

Chaoses-Ib commented 10 months ago

Currently, yes. One problem about this is how to handle all the edge cases. Dependencies may be installed by requirements.txt, git submodules and install.py. It's also possible that installing dependencies for one node will break another. And if the node already exists, then updating may be needed. It's a bit complex to handle all these in code robustly.

Another question is how to install nodes if ComfyScript is installed as a package. Many custom nodes don't have pyproject.toml and can't be installed as packages. A temp directory may be needed to clone these nodes.

It's also possible to reuse ComfyUI Manager's data to detect missing nodes, though it's licensed under GPL and I'm not sure if using its data via URL will require changing the license from MIT to GPL too.

Anyway, some basic support will be made in the following versions.

Chaoses-Ib commented 10 months ago

Another question is how to install nodes if ComfyScript is installed as a package. Many custom nodes don't have pyproject.toml and can't be installed as packages. A temp directory may be needed to clone these nodes.

For this question, I've found a simple enough way to make nodes installable: https://github.com/hiddenswitch/ComfyUI/pull/2. If ComfyScript is installed as a package, then only installable nodes will be able to be used directly. For nodes that are not installable, the user can fork them and make changes, or clone them themselves and provided the path to load them.

Chaoses-Ib commented 10 months ago

One problem about this is how to handle all the edge cases. Dependencies may be installed by requirements.txt, git submodules and install.py. It's also possible that installing dependencies for one node will break another. And if the node already exists, then updating may be needed. It's a bit complex to handle all these in code robustly.

And for this part, I decided to transfer the responsibility to ComfyUI Manager: If ComfyUI Manager is installed, then ComfyScript will call it to install nodes; if not, a list of missing nodes and their repositories will be printed, so that the user can install them manually.