User wants GaussianPack fully self-contained — no comfy-env in the runtime path. Three swaps + one orphan deletion: 1. prestartup_script.py: `comfy_env.copy_files(src, dst)` -> stdlib shutil.copy2 loop. Same semantics (top-level files, non-clobbering), 6 lines. Fixes the NameError that snuck in earlier when the `from comfy_env import copy_files` line was removed without replacement; in the test workspace `apple.ply` actually lands in `input/` now. 2. __init__.py: `comfy_env.register_nodes()` -> `from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS`. That's literally what register_nodes() boils down to when no nodes/comfy-env.toml is present (the no-isolation branch). Hyphenated parent package names are fine for relative imports — verified earlier in this session with a Foo-Bar fixture via importlib.import_module. 3. nodes/__init__.py: docstring update — drop the "calls comfy_env.register_nodes()" mention now that the root does the relative import directly. 4. comfy-env-root.toml: deleted. The [node_reqs] section only had meaning for comfy-env's isolation discovery; with no comfy-env in play it was dead metadata. `comfy-test.toml` stays (that's a different tool — comfy-test, not comfy-env). `requirements.txt` stays (numpy + plyfile + NanoGS git). `grep -rn comfy_env` across the repo returns 0 hits. Import smoke test in the worker pixi env resolves all 5 nodes (PreviewGaussians, GaussianMerge, LoadPLY, GaussianAnalysis, GaussianExport).
21 lines
788 B
Python
21 lines
788 B
Python
"""ComfyUI-GaussianPack Prestartup Script."""
|
|
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
SCRIPT_DIR = Path(__file__).resolve().parent
|
|
COMFYUI_DIR = SCRIPT_DIR.parent.parent
|
|
ASSETS_DIR = SCRIPT_DIR / "assets"
|
|
INPUT_DIR = COMFYUI_DIR / "input"
|
|
|
|
# Copy bundled example assets (apple.ply, ...) into ComfyUI's input/
|
|
# so workflows that reference them by basename work on a fresh
|
|
# install. Non-clobbering — pre-existing files in input/ are left
|
|
# alone, so user edits survive restarts. Only top-level files
|
|
# (subdirectories like .ipynb_checkpoints/ are skipped).
|
|
if ASSETS_DIR.is_dir():
|
|
INPUT_DIR.mkdir(parents=True, exist_ok=True)
|
|
for src in ASSETS_DIR.iterdir():
|
|
if src.is_file() and not (INPUT_DIR / src.name).exists():
|
|
shutil.copy2(src, INPUT_DIR / src.name)
|