From 8bf508abf27faacdd6227150ff791f92461ba7e7 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 9 Jul 2024 18:29:06 -0700 Subject: [PATCH 1/4] Add optional annotated types. --- comfy_cli/cmdline.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/comfy_cli/cmdline.py b/comfy_cli/cmdline.py index 8042710..2c74670 100644 --- a/comfy_cli/cmdline.py +++ b/comfy_cli/cmdline.py @@ -172,7 +172,7 @@ def install( bool, typer.Option(show_default=False, help="Skip installing requirements.txt") ] = False, nvidia: Annotated[ - bool, + Optional[bool], typer.Option( show_default=False, help="Install for Nvidia gpu", @@ -183,7 +183,7 @@ def install( CUDAVersion, typer.Option(show_default=True) ] = CUDAVersion.v12_1, amd: Annotated[ - bool, + Optional[bool], typer.Option( show_default=False, help="Install for AMD gpu", @@ -191,7 +191,7 @@ def install( ), ] = None, m_series: Annotated[ - bool, + Optional[bool], typer.Option( show_default=False, help="Install for Mac M-Series gpu", @@ -199,7 +199,7 @@ def install( ), ] = None, intel_arc: Annotated[ - bool, + Optional[bool], typer.Option( hidden=True, show_default=False, @@ -208,7 +208,7 @@ def install( ), ] = None, cpu: Annotated[ - bool, + Optional[bool], typer.Option( show_default=False, help="Install for CPU", From c3b3bc3a69b01b23092b0562ccb572714940166e Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 9 Jul 2024 18:32:03 -0700 Subject: [PATCH 2/4] Add types. --- comfy_cli/cmdline.py | 4 +-- comfy_cli/command/custom_nodes/command.py | 30 ++++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/comfy_cli/cmdline.py b/comfy_cli/cmdline.py index 2c74670..a378ee1 100644 --- a/comfy_cli/cmdline.py +++ b/comfy_cli/cmdline.py @@ -366,11 +366,11 @@ def update( def run( workflow: Annotated[str, typer.Option(help="Path to the workflow API json file.")], wait: Annotated[ - Optional[bool], + bool, typer.Option(help="If the command should wait until execution completes."), ] = True, verbose: Annotated[ - Optional[bool], + bool, typer.Option(help="Enables verbose output of the execution process."), ] = False, host: Annotated[ diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index fded2a4..68efcba 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -226,7 +226,7 @@ def execute_install_script(repo_path): @tracking.track_command("node") def save_snapshot( output: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the output file path. (.json/.yaml)" ), @@ -383,7 +383,7 @@ def show( autocompletion=show_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -422,7 +422,7 @@ def simple_show( autocompletion=show_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -461,7 +461,7 @@ def install( ..., help="List of custom nodes to install", autocompletion=node_completer ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -490,7 +490,7 @@ def reinstall( ..., help="List of custom nodes to reinstall", autocompletion=node_completer ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -519,7 +519,7 @@ def uninstall( ..., help="List of custom nodes to uninstall", autocompletion=node_completer ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -577,7 +577,7 @@ def update( autocompletion=node_or_all_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -606,7 +606,7 @@ def disable( autocompletion=node_or_all_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -633,7 +633,7 @@ def enable( autocompletion=node_or_all_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -660,7 +660,7 @@ def fix( autocompletion=node_or_all_completer, ), channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -685,13 +685,15 @@ def fix( @tracking.track_command("node") def install_deps( deps: Annotated[ - str, typer.Option(show_default=False, help="Dependency spec file (.json)") + Optional[str], + typer.Option(show_default=False, help="Dependency spec file (.json)"), ] = None, workflow: Annotated[ - str, typer.Option(show_default=False, help="Workflow file (.json/.png)") + Optional[str], + typer.Option(show_default=False, help="Workflow file (.json/.png)"), ] = None, channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", @@ -749,7 +751,7 @@ def deps_in_workflow( str, typer.Option(show_default=False, help="Output file (.json)") ], channel: Annotated[ - str, + Optional[str], typer.Option( show_default=False, help="Specify the operation mode", From f814601fa17e8d9276f3fc88f475bb301521619b Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 9 Jul 2024 21:28:13 -0700 Subject: [PATCH 3/4] Add check disk space. --- .github/workflows/run-on-gpu.yml | 4 ++++ comfy_cli/test_cmdline.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 comfy_cli/test_cmdline.py diff --git a/.github/workflows/run-on-gpu.yml b/.github/workflows/run-on-gpu.yml index ec413c7..e132116 100644 --- a/.github/workflows/run-on-gpu.yml +++ b/.github/workflows/run-on-gpu.yml @@ -40,6 +40,10 @@ jobs: run: | pip install -e . + - name: Check disk space + run: | + df -h + - name: Run Core Functionality run: | comfy --skip-prompt --no-enable-telemetry env diff --git a/comfy_cli/test_cmdline.py b/comfy_cli/test_cmdline.py new file mode 100644 index 0000000..bd1d476 --- /dev/null +++ b/comfy_cli/test_cmdline.py @@ -0,0 +1,15 @@ +from typer.testing import CliRunner + +from .cmdline import app + +runner = CliRunner() + + +def test_app(): + result = runner.invoke( + app, + ["--here", "install", "--cpu"], + ) + print("Stdout:") + print(result.stdout) + assert result.exit_code == 0 From 0512a95547385362eccb6ec8b1aa085143b50b34 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 9 Jul 2024 21:30:43 -0700 Subject: [PATCH 4/4] Update. --- comfy_cli/test_cmdline.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 comfy_cli/test_cmdline.py diff --git a/comfy_cli/test_cmdline.py b/comfy_cli/test_cmdline.py deleted file mode 100644 index bd1d476..0000000 --- a/comfy_cli/test_cmdline.py +++ /dev/null @@ -1,15 +0,0 @@ -from typer.testing import CliRunner - -from .cmdline import app - -runner = CliRunner() - - -def test_app(): - result = runner.invoke( - app, - ["--here", "install", "--cpu"], - ) - print("Stdout:") - print(result.stdout) - assert result.exit_code == 0