Skip to content

Commit

Permalink
Change comfynode.toml -> pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjhuang committed May 8, 2024
1 parent fff9de7 commit 1bbf03e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions comfy_cli/command/custom_nodes/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,12 @@ def publish():
@app.command("init", help="Init scaffolding for custom node")
@tracking.track_command("node")
def scaffold():
if os.path.exists("comfynode.toml"):
typer.echo("Warning: 'comfynode.toml' already exists. Will not overwrite.")
if os.path.exists("pyproject.toml"):
typer.echo("Warning: 'pyproject.toml' already exists. Will not overwrite.")
raise typer.Exit(code=1)

typer.echo("Initializing metadata...")
initialize_project_config()
typer.echo(
"comfynode.toml created successfully. Defaults were filled in. Please check before publishing."
"pyproject.toml created successfully. Defaults were filled in. Please check before publishing."
)
15 changes: 7 additions & 8 deletions comfy_cli/registry/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,16 @@ def create_comfynode_config():

# Write the TOML document to a file
try:
with open("comfynode.toml", "w") as toml_file:
with open("pyproject.toml", "w") as toml_file:
toml_file.write(tomlkit.dumps(document))
print("comfynode.toml has been created successfully in the current directory.")
except IOError as e:
raise Exception(f"Failed to write 'comfynode.toml': {str(e)}")
raise Exception(f"Failed to write 'pyproject.toml': {str(e)}")


def initialize_project_config():
create_comfynode_config()

with open("comfynode.toml", "r") as file:
with open("pyproject.toml", "r") as file:
document = tomlkit.parse(file.read())

# Get the current git remote URL
Expand Down Expand Up @@ -100,15 +99,15 @@ def initialize_project_config():

# Write the updated config to a new file in the current directory
try:
with open("comfynode.toml", "w") as toml_file:
with open("pyproject.toml", "w") as toml_file:
toml_file.write(tomlkit.dumps(document))
print("comfynode.toml has been created successfully in the current directory.")
print("pyproject.toml has been created successfully in the current directory.")
except IOError as e:
raise IOError(f"Failed to write 'comfynode.toml': {str(e)}")
raise IOError(f"Failed to write 'pyproject.toml': {str(e)}")


def extract_node_configuration(
path: str = os.path.join(os.getcwd(), "comfynode.toml"),
path: str = os.path.join(os.getcwd(), "pyproject.toml"),
) -> PyProjectConfig:
import tomlkit

Expand Down

0 comments on commit 1bbf03e

Please sign in to comment.