This guide provides an overview of how to develop in this repository.
-
Clone the repo, create and activate a conda env. Minimum Python version is 3.9.
-
Install the package to local
pip install -e .
- Set ENVIRONMENT variable to DEV.
export ENVIRONMENT=dev
- Test script running
comfy --help
- Use pre commit hook
pre-commit install
You can add following config to your VSCode launch.json
to launch debugger.
{
"name": "Python Debugger: Run",
"type": "debugpy",
"request": "launch",
"module": "comfy_cli.__main__",
"args": [],
"console": "integratedTerminal"
}
There is a potential need for you to reinstall the package. You can do this by
either run pip install -e .
again (which will reinstall), or manually
uninstall pip uninstall comfy-cli
and reinstall, or even cleaning your conda
env and reinstalling the package (pip install -e .
)
- Register it under
comfy_cli/cmdline.py
If it's contains subcommand, create folder under comfy_cli/command/[new_command] and add the following boilerplate
comfy_cli/command/[new_command]/__init__.py
from .command import app
comfy_cli/command/[new_command]command.py
import typer
app = typer.Typer()
@app.command()
def option_a(name: str):
"""Add a new custom node"""
print(f"Adding a new custom node: {name}")
@app.command()
def remove(name: str):
"""Remove a custom node"""
print(f"Removing a custom node: {name}")
- Use
typer
for all command args management - Use
rich
for all console output- For progress reporting, use either
rich.progress
- For progress reporting, use either
- Fork your own branches of
comfy-cli
andComfyUI-Manager
, make changes - Be sure to commit any changes to
ComfyUI-Manager
to a new branch, and push to remote
- clone the changed branch of
comfy-cli
, then live installcomfy-cli
:
pip install -e comfy-cli
- Go to a test dir and run:
comfy --here install --manager-url=<path-or-url-to-fork-of-ComfyUI-Manager>
- Run:
cd ComfyUI/custom_nodes/ComfyUI-Manager/ && git checkout <changed-branch> && cd -
- Further changes can be pulled into these copies of the
comfy-cli
andComfyUI-Manager
repos
- Follow instructions above to get working install with changes
- Add breakpoints directly to code:
import ipdb; ipdb.set_trace()
- Execute relevant
comfy-cli
command
If you have any questions or need further assistance, please contact the project maintainer at ???.
Happy coding!