From cb82e8a528b4ae471ca0c0a7b65ba107dba1038f Mon Sep 17 00:00:00 2001 From: woolion Date: Wed, 14 Aug 2024 19:02:07 +0200 Subject: [PATCH] Use configargparse to give the option to use config files --- .gitignore | 1 + comfy/cli_args.py | 6 ++++-- requirements.txt | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b212b029..fb4900e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.comfyui.rc __pycache__/ *.py[cod] /output/ diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 2397de3d..5d318570 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -1,4 +1,4 @@ -import argparse +import configargparse as argparse import enum import os from typing import Optional @@ -34,7 +34,9 @@ class EnumAction(argparse.Action): setattr(namespace, self.dest, value) -parser = argparse.ArgumentParser() +parser = argparse.ArgumentParser(default_config_files=["./.comfyui.rc", "~/.comfyui.rc"]) + +parser.add("-c", "--config", is_config_file=True, help="config file path") parser.add_argument("--listen", type=str, default="127.0.0.1", metavar="IP", nargs="?", const="0.0.0.0", help="Specify the IP address to listen on (default: 127.0.0.1). If --listen is provided without an argument, it defaults to 0.0.0.0. (listens on all)") parser.add_argument("--port", type=int, default=8188, help="Set the listen port.") diff --git a/requirements.txt b/requirements.txt index 4c2c0b2b..a20cc672 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +configargparse torch torchsde torchvision