comfy-env 0.1.18__tar.gz → 0.1.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {comfy_env-0.1.18 → comfy_env-0.1.20}/PKG-INFO +1 -1
  2. {comfy_env-0.1.18 → comfy_env-0.1.20}/pyproject.toml +1 -1
  3. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/workers/mp.py +17 -6
  4. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/workers/subprocess.py +15 -0
  5. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/wrap.py +7 -3
  6. {comfy_env-0.1.18 → comfy_env-0.1.20}/.github/workflows/ci.yml +0 -0
  7. {comfy_env-0.1.18 → comfy_env-0.1.20}/.github/workflows/publish.yml +0 -0
  8. {comfy_env-0.1.18 → comfy_env-0.1.20}/.gitignore +0 -0
  9. {comfy_env-0.1.18 → comfy_env-0.1.20}/LICENSE +0 -0
  10. {comfy_env-0.1.18 → comfy_env-0.1.20}/README.md +0 -0
  11. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/__init__.py +0 -0
  12. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/cli.py +0 -0
  13. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/config/__init__.py +0 -0
  14. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/config/parser.py +0 -0
  15. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/config/types.py +0 -0
  16. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/detection/__init__.py +0 -0
  17. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/detection/cuda.py +0 -0
  18. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/detection/gpu.py +0 -0
  19. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/detection/platform.py +0 -0
  20. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/detection/runtime.py +0 -0
  21. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/environment/__init__.py +0 -0
  22. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/environment/cache.py +0 -0
  23. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/environment/libomp.py +0 -0
  24. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/environment/paths.py +0 -0
  25. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/environment/setup.py +0 -0
  26. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/install.py +0 -0
  27. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/__init__.py +0 -0
  28. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/tensor_utils.py +0 -0
  29. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/workers/__init__.py +0 -0
  30. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/isolation/workers/base.py +0 -0
  31. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/__init__.py +0 -0
  32. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/apt.py +0 -0
  33. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/cuda_wheels.py +0 -0
  34. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/node_dependencies.py +0 -0
  35. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/pixi.py +0 -0
  36. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/packages/toml_generator.py +0 -0
  37. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/templates/comfy-env-instructions.txt +0 -0
  38. {comfy_env-0.1.18 → comfy_env-0.1.20}/src/comfy_env/templates/comfy-env.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comfy-env
3
- Version: 0.1.18
3
+ Version: 0.1.20
4
4
  Summary: Environment management for ComfyUI custom nodes - CUDA wheel resolution and process isolation
5
5
  Project-URL: Homepage, https://github.com/PozzettiAndrea/comfy-env
6
6
  Project-URL: Repository, https://github.com/PozzettiAndrea/comfy-env
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "comfy-env"
3
- version = "0.1.18"
3
+ version = "0.1.20"
4
4
  description = "Environment management for ComfyUI custom nodes - CUDA wheel resolution and process isolation"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -565,7 +565,9 @@ class MPWorker(Worker):
565
565
  interpreter without inherited state from the parent.
566
566
  """
567
567
 
568
- def __init__(self, name: Optional[str] = None, sys_path: Optional[list] = None, lib_path: Optional[str] = None, env_vars: Optional[dict] = None):
568
+ def __init__(self, name: Optional[str] = None, sys_path: Optional[list] = None,
569
+ lib_path: Optional[str] = None, env_vars: Optional[dict] = None,
570
+ python: Optional[str] = None):
569
571
  """
570
572
  Initialize the worker.
571
573
 
@@ -574,11 +576,15 @@ class MPWorker(Worker):
574
576
  sys_path: Optional list of paths to add to sys.path in worker process.
575
577
  lib_path: Optional path to add to LD_LIBRARY_PATH (for conda libraries).
576
578
  env_vars: Optional environment variables to set in worker process.
579
+ python: Optional path to venv Python executable for true process isolation.
580
+ When provided, spawn uses this Python instead of sys.executable,
581
+ avoiding Windows issues where spawn re-imports main.py.
577
582
  """
578
583
  self.name = name or "MPWorker"
579
584
  self._sys_path = sys_path or []
580
585
  self._lib_path = lib_path
581
586
  self._env_vars = env_vars or {}
587
+ self._python = python # Venv Python for true isolation (like pyisolate)
582
588
  self._process = None
583
589
  self._queue_in = None
584
590
  self._queue_out = None
@@ -635,13 +641,18 @@ class MPWorker(Worker):
635
641
  # Use spawn to get clean subprocess (no inherited CUDA context)
636
642
  ctx = mp.get_context('spawn')
637
643
 
638
- # Explicitly set the spawn executable to the current Python
639
- # This prevents pixi/conda from hijacking the spawn process
644
+ # Set the spawn executable for true process isolation (like pyisolate)
645
+ # When venv python is provided, use it to avoid Windows spawn importing main.py
640
646
  import multiprocessing.spawn as mp_spawn
641
647
  original_exe = mp_spawn.get_executable()
642
- if original_exe != sys.executable.encode() and original_exe != sys.executable:
643
- print(f"[comfy-env] Warning: spawn executable was {original_exe}, forcing to {sys.executable}")
644
- mp_spawn.set_executable(sys.executable)
648
+ if self._python:
649
+ # True isolation: use venv Python (fixes Windows spawn __main__ issue)
650
+ mp_spawn.set_executable(self._python)
651
+ else:
652
+ # Fallback: use current Python (may fail on Windows with ComfyUI)
653
+ if original_exe != sys.executable.encode() and original_exe != sys.executable:
654
+ print(f"[comfy-env] Warning: spawn executable was {original_exe}, forcing to {sys.executable}")
655
+ mp_spawn.set_executable(sys.executable)
645
656
 
646
657
  self._queue_in = ctx.Queue()
647
658
  self._queue_out = ctx.Queue()
@@ -533,6 +533,21 @@ if sys.platform == "win32":
533
533
  from multiprocessing import shared_memory as shm
534
534
  import numpy as np
535
535
 
536
+
537
+ def _prepare_trimesh_for_pickle(mesh):
538
+ """
539
+ Prepare a trimesh object for cross-Python-version pickling.
540
+ Strips native extension helpers that cause import errors.
541
+ """
542
+ mesh = mesh.copy()
543
+ for attr in ('ray', '_ray', 'permutate', 'nearest'):
544
+ try:
545
+ delattr(mesh, attr)
546
+ except AttributeError:
547
+ pass
548
+ return mesh
549
+
550
+
536
551
  def _to_shm(obj, registry, visited=None):
537
552
  """Serialize to shared memory. Returns JSON-safe metadata."""
538
553
  if visited is None:
@@ -74,16 +74,20 @@ def _get_worker(env_dir: Path, working_dir: Path, sys_path: list[str],
74
74
 
75
75
  host_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
76
76
  iso_ver = _get_python_version(env_dir)
77
+ python = env_dir / ("python.exe" if sys.platform == "win32" else "bin/python")
77
78
 
78
79
  if iso_ver and iso_ver != host_ver:
80
+ # Different Python version - must use SubprocessWorker
79
81
  from .workers.subprocess import SubprocessWorker
80
- python = env_dir / ("python.exe" if sys.platform == "win32" else "bin/python")
81
82
  print(f"[comfy-env] SubprocessWorker: {python} ({iso_ver} vs {host_ver})")
82
83
  worker = SubprocessWorker(python=str(python), working_dir=working_dir, sys_path=sys_path, name=working_dir.name)
83
84
  else:
85
+ # Same version - use MPWorker with venv Python for true isolation (like pyisolate)
86
+ # This fixes Windows where spawn would otherwise re-import main.py
84
87
  from .workers.mp import MPWorker
85
- print(f"[comfy-env] MPWorker: {env_dir}")
86
- worker = MPWorker(name=working_dir.name, sys_path=sys_path, lib_path=lib_path, env_vars=env_vars)
88
+ print(f"[comfy-env] MPWorker: {python}")
89
+ worker = MPWorker(name=working_dir.name, sys_path=sys_path, lib_path=lib_path,
90
+ env_vars=env_vars, python=str(python))
87
91
 
88
92
  _workers[cache_key] = worker
89
93
  return worker
File without changes
File without changes
File without changes