Skip to content

Commit

Permalink
Merge branch 'main' into feat/install_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Aug 24, 2024
2 parents 20d43a7 + 7ce59eb commit a5c2abe
Show file tree
Hide file tree
Showing 53 changed files with 3,529 additions and 903 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
runs-on: ${{ matrix.os }}
env:
PYTHONIOENCODING: "utf8"

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9"]
Expand All @@ -30,9 +31,13 @@ jobs:

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Run Tests
- name: Test e2e
env:
PYTHONPATH: ${{ github.workspace }}
TEST_E2E: true
run: |
comfy --skip-prompt --no-enable-telemetry env
comfy --skip-prompt install --cpu
pytest tests/e2e
26 changes: 13 additions & 13 deletions .github/workflows/publish_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ jobs:
- name: Build distribution
run: python -m build --sdist --wheel --outdir dist/

- name: Publish distribution to TestPyPI for Validation
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
repository_url: https://test.pypi.org/legacy/
# - name: Publish distribution to TestPyPI for Validation
# uses: pypa/gh-action-pypi-publish@v1.8.14
# with:
# repository_url: https://test.pypi.org/legacy/

- name: Clear pip cache
run: pip cache purge

- name: Install Comfy CLI from Test Pypi and Test
run: |
for i in {1..3}; do
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple comfy-cli==${{env.VERSION}} && break || sleep 5
done
comfy --help
# - name: Clear pip cache
# run: pip cache purge

# - name: Install Comfy CLI from Test Pypi and Test
# run: |
# for i in {1..3}; do
# pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple comfy-cli==${{env.VERSION}} && break || sleep 5
# done
# comfy --help

- name: Publish distribution to Official PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/pylint.yml

This file was deleted.

8 changes: 7 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Run pytest

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/ruff_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ruff_check

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ruff_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: install ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: lint check and then format check with ruff
run: |
ruff check
ruff format --check
67 changes: 67 additions & 0 deletions .github/workflows/run-on-gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Test CLI Tool on GPU runners"

on:
push:
branches:
- main
paths:
- "comfy_cli/**"
- "!comfy_cli/test_**"
pull_request:
branches:
- main
paths:
- "comfy_cli/**"
- "!comfy_cli/test_**"

jobs:
test-cli-gpu:
name: "Run Tests on GPU Runners"
runs-on:
group: gpu-runners
labels: ${{ matrix.os }}-x64-gpu #
strategy:
fail-fast: false
matrix:
os: [linux]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Check Nvidia
run: |
nvidia-smi
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Check disk space
run: |
df -h
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .
- name: Test e2e
id: test-e2e
env:
PYTHONPATH: ${{ github.workspace }}
TEST_E2E: true
TEST_E2E_COMFY_INSTALL_FLAGS: --nvidia --cuda-version 11.8
TEST_E2E_COMFY_LAUNCH_FLAGS_EXTRA: ""
run: |
pytest tests/e2e
- name: Retry test e2e but without gpu
if: ${{ failure() && steps.test-e2e.conclusion == 'failure' }}
env:
PYTHONPATH: ${{ github.workspace }}
TEST_E2E: true
run: |
pytest tests/e2e
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ __pycache__/

#COMMON CONFIGs
.DS_Store
.ruff_cache
.src_port
.webpack_watch.log
*.swp
*.swo
.vscode/settings.json
.idea/
.vscode/
*.code-workspace
.history

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -44,4 +48,9 @@ share/python-wheels/
*.manifest
*.spec

# temporary files created by tests
tests/temp/

venv/

bisect_state.json
18 changes: 8 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.1
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/pylint-dev/pylint
rev: v2.16.2
hooks:
- id: pylint
args:
- --disable=R,C,W,E0401
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
16 changes: 0 additions & 16 deletions .pylintrc

This file was deleted.

43 changes: 41 additions & 2 deletions DEV_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,33 @@ This guide provides an overview of how to develop in this repository.

`pip install -e .`

3. Test script running
3. Set ENVIRONMENT variable to DEV.

`export ENVIRONMENT=dev`

4. Test script running

`comfy --help`

4. Use pre commit hook
5. Use pre commit hook

`pre-commit install`

## Debug

You can add following config to your VSCode `launch.json` to launch debugger.

```json
{
"name": "Python Debugger: Run",
"type": "debugpy",
"request": "launch",
"module": "comfy_cli.__main__",
"args": [],
"console": "integratedTerminal"
}
```

## Make changes to the code base

There is a potential need for you to reinstall the package. You can do this by
Expand Down Expand Up @@ -64,6 +83,26 @@ def remove(name: str):
- Use `rich` for all console output
- For progress reporting, use either [`rich.progress`](https://rich.readthedocs.io/en/stable/progress.html)

## Develop comfy-cli and ComfyUI-Manager (cm-cli) together
### Make changes to both
1. Fork your own branches of `comfy-cli` and `ComfyUI-Manager`, make changes
2. Be sure to commit any changes to `ComfyUI-Manager` to a new branch, and push to remote

### Try out changes to both
1. clone the changed branch of `comfy-cli`, then live install `comfy-cli`:
- `pip install -e comfy-cli`
2. Go to a test dir and run:
- `comfy --here install --manager-url=<path-or-url-to-fork-of-ComfyUI-Manager>`
3. Run:
- `cd ComfyUI/custom_nodes/ComfyUI-Manager/ && git checkout <changed-branch> && cd -`
4. Further changes can be pulled into these copies of the `comfy-cli` and `ComfyUI-Manager` repos

### Debug both simultaneously
1. Follow instructions above to get working install with changes
2. Add breakpoints directly to code: `import ipdb; ipdb.set_trace()`
3. Execute relevant `comfy-cli` command


## Contact

If you have any questions or need further assistance, please contact the project maintainer at [???](mailto:???@drip.art).
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Comfy-Cli: A Command Line Tool for ComfyUI
[![Test ComfyUI Example Workflows](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows.yaml)
[![Test ComfyUI Windows with Default Workflow](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml/badge.svg)](https://github.com/Comfy-Org/ComfyUI-Mirror/actions/workflows/test-workflows-windows.yaml)

comfy-cli is a command line tool that helps users easily install and manage
[ComfyUI](https://github.com/comfyanonymous/ComfyUI), a powerful open-source
machine learning framework. With comfy-cli, you can quickly set up ComfyUI,
install packages, and manage custom nodes, all from the convenience of your
terminal.



## Demo

<img src="https://github.com/yoland68/comfy-cli/raw/main/assets/comfy-demo.gif" width="400" alt="Comfy Command Demo">
Expand Down Expand Up @@ -158,23 +162,33 @@ comfy node [show|simple-show] [installed|enabled|not-installed|disabled|all|snap

- Generate deps:

`comfy node deps-in-workflow --workflow=<workflow .json/.png file>`
`comfy node deps-in-workflow --workflow=<workflow .json/.png file> --output=<output deps .json file>`

#### Bisect custom nodes

If you encounter bugs only with custom nodes enabled, and want to find out which custom node(s) causes the bug,
the bisect tool can help you pinpoint the custom node that causes the issue.

- `comfy node bisect start`: Start a new bisect session with optional ComfyUI launch args. It automatically marks the starting state as bad, and takes all enabled nodes when the command executes as the test set.
- `comfy node bisect good`: Mark the current active set as good, indicating the problem is not within the test set.
- `comfy node bisect bad`: Mark the current active set as bad, indicating the problem is within the test set.
- `comfy node bisect reset`: Reset the current bisect session.

### Managing Models

- Model downloading

`comfy model get`
`comfy model download --url <URL> ?[--relative-path <PATH>] ?[--set-civitai-api-token <TOKEN>]`

\*Downloading models that have already been installed will
* URL: CivitAI, huggingface file url, ...

- Model remove

`comfy model enable-gui`
`comfy model remove ?[--relative-path <PATH>] --model-names <model names>`

- Model list

`comfy model list`
`comfy model list ?[--relative-path <PATH>]`

### Managing ComfyUI-Manager

Expand Down
Loading

0 comments on commit a5c2abe

Please sign in to comment.