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 your conda env.
pip install -e .
- Set ENVIRONMENT variable to DEV.
export ENVIRONMENT=dev
- Check if the "comfy" package can run.
comfy --help
- Install the pre-commit hook to ensure that your code won't need reformatting later.
pre-commit install
- To save time during code review, it's recommended that you also manually run the unit tests before submitting a pull request (see below).
- Install pytest into your conda env. You should preferably be using Python 3.9 in your conda env, since it's the version we are targeting for compatibility.
pip install pytest pytest-cov
- Verify that all unit tests run successfully.
pytest --cov=comfy_cli --cov-report=xml .
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 .)
comfy node pack and comfy node publish now read an optional .comfyignore
file in the project root. The syntax matches .gitignore (implemented with
PathSpec's gitwildmatch rules), so you can reuse familiar patterns to keep
development-only artifacts out of your published archive.
- Patterns are evaluated against paths relative to the directory you run the command from (usually the repo root).
- Files required by the pack command itself (e.g.
__init__.py,web/*) are still forced into the archive even if they match an ignore pattern. - If no
.comfyignoreis present the command falls back to the original behavior and zips every git-tracked file.
Example .comfyignore:
docs/
frontend/
tests/
*.psdCommit the file alongside your node so teammates and CI pipelines produce the same trimmed package.
- 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
typerfor all command args management - Use
richfor all console output- For progress reporting, use either
rich.progress
- For progress reporting, use either
ComfyUI-Manager is now installed as a pip package (via manager_requirements.txt
in the ComfyUI root) rather than being git-cloned into custom_nodes/.
- Fork your own branches of
comfy-cliandComfyUI-Manager, make changes. - Live-install
comfy-cli:pip install -e /path/to/comfy-cli
- Live-install your fork of
ComfyUI-Managerin editable mode:pip install -e /path/to/ComfyUI-Manager
- This makes the
cm-clientry point available and points it at your local source.
- Install both packages in editable mode as described above.
- Go to a test dir and run:
comfy --here install
- The
cm-clicommand will resolve to your locally installed editable package.
- Follow instructions above to get working install with changes.
- Add breakpoints directly to code:
import ipdb; ipdb.set_trace() - Execute relevant
comfy-clicommand.
E2E tests perform real comfy install, comfy launch, and comfy node operations.
They are disabled by default and must be explicitly enabled.
TEST_E2E=true pytest tests/e2e/For pre-release testing against alternate ComfyUI repositories (e.g. Manager v4):
TEST_E2E=true \
TEST_E2E_COMFY_URL="https://github.com/ltdrdata/ComfyUI.git@dr-bump-manager" \
pytest tests/e2e/ -vSee docs/TESTING-e2e.md for the full guide including environment variables, test suite details, and scenario descriptions.
If you have any questions or need further assistance, please contact the project maintainer at ???.
Happy coding!