Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: single python environment #89

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,34 @@
import subprocess
import argparse
import logging
import pathlib

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

def ensure_init_files(workspace: str):
"""Create __init__.py files in comfy/ and comfy_extras/ directories if they don't exist"""
base_dirs = ['comfy', 'comfy_extras']
for base_dir in base_dirs:
base_path = os.path.join(workspace, base_dir)
if not os.path.exists(base_path):
continue

# Create __init__.py in the root of base_dir first
root_init = os.path.join(base_path, "__init__.py")
if not os.path.exists(root_init):
logger.info(f"Creating {root_init}")
with open(root_init, 'w') as f:
f.write("")

# Then walk subdirectories
for root, dirs, files in os.walk(base_path):
init_path = os.path.join(root, "__init__.py")
if not os.path.exists(init_path):
logger.info(f"Creating {init_path}")
with open(init_path, 'w') as f:
f.write("")

def install_custom_node_req(workspace: str):
custom_nodes_path = os.path.join(workspace, "custom_nodes")
for folder in os.listdir(custom_nodes_path):
Expand All @@ -26,4 +50,8 @@ def install_custom_node_req(workspace: str):

logger.info("Installing custom node requirements...")
install_custom_node_req(args.workspace)
logger.info("Custom node requirements installed successfully.")

logger.info("Ensuring __init__.py files exist in ComfyUI directories...")
ensure_init_files(args.workspace)

logger.info("Installation completed successfully.")