comfy-env 0.0.65__py3-none-any.whl → 0.0.66__py3-none-any.whl

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 (55) hide show
  1. comfy_env/__init__.py +70 -122
  2. comfy_env/cli.py +78 -7
  3. comfy_env/config/__init__.py +19 -0
  4. comfy_env/config/parser.py +151 -0
  5. comfy_env/config/types.py +64 -0
  6. comfy_env/install.py +83 -361
  7. comfy_env/isolation/__init__.py +9 -0
  8. comfy_env/isolation/wrap.py +351 -0
  9. comfy_env/nodes.py +2 -2
  10. comfy_env/pixi/__init__.py +48 -0
  11. comfy_env/pixi/core.py +356 -0
  12. comfy_env/{resolver.py → pixi/resolver.py} +1 -14
  13. comfy_env/prestartup.py +60 -0
  14. comfy_env/templates/comfy-env-instructions.txt +30 -87
  15. comfy_env/templates/comfy-env.toml +69 -128
  16. comfy_env/workers/__init__.py +21 -32
  17. comfy_env/workers/base.py +1 -1
  18. comfy_env/workers/{torch_mp.py → mp.py} +47 -14
  19. comfy_env/workers/{venv.py → subprocess.py} +397 -443
  20. {comfy_env-0.0.65.dist-info → comfy_env-0.0.66.dist-info}/METADATA +2 -1
  21. comfy_env-0.0.66.dist-info/RECORD +34 -0
  22. comfy_env/decorator.py +0 -700
  23. comfy_env/env/__init__.py +0 -46
  24. comfy_env/env/config.py +0 -191
  25. comfy_env/env/config_file.py +0 -706
  26. comfy_env/env/manager.py +0 -636
  27. comfy_env/env/security.py +0 -267
  28. comfy_env/ipc/__init__.py +0 -55
  29. comfy_env/ipc/bridge.py +0 -476
  30. comfy_env/ipc/protocol.py +0 -265
  31. comfy_env/ipc/tensor.py +0 -371
  32. comfy_env/ipc/torch_bridge.py +0 -401
  33. comfy_env/ipc/transport.py +0 -318
  34. comfy_env/ipc/worker.py +0 -221
  35. comfy_env/isolation.py +0 -310
  36. comfy_env/pixi.py +0 -760
  37. comfy_env/stub_imports.py +0 -270
  38. comfy_env/stubs/__init__.py +0 -1
  39. comfy_env/stubs/comfy/__init__.py +0 -6
  40. comfy_env/stubs/comfy/model_management.py +0 -58
  41. comfy_env/stubs/comfy/utils.py +0 -29
  42. comfy_env/stubs/folder_paths.py +0 -71
  43. comfy_env/workers/pool.py +0 -241
  44. comfy_env-0.0.65.dist-info/RECORD +0 -48
  45. /comfy_env/{env/cuda_gpu_detection.py → pixi/cuda_detection.py} +0 -0
  46. /comfy_env/{env → pixi}/platform/__init__.py +0 -0
  47. /comfy_env/{env → pixi}/platform/base.py +0 -0
  48. /comfy_env/{env → pixi}/platform/darwin.py +0 -0
  49. /comfy_env/{env → pixi}/platform/linux.py +0 -0
  50. /comfy_env/{env → pixi}/platform/windows.py +0 -0
  51. /comfy_env/{registry.py → pixi/registry.py} +0 -0
  52. /comfy_env/{wheel_sources.yml → pixi/wheel_sources.yml} +0 -0
  53. {comfy_env-0.0.65.dist-info → comfy_env-0.0.66.dist-info}/WHEEL +0 -0
  54. {comfy_env-0.0.65.dist-info → comfy_env-0.0.66.dist-info}/entry_points.txt +0 -0
  55. {comfy_env-0.0.65.dist-info → comfy_env-0.0.66.dist-info}/licenses/LICENSE +0 -0
comfy_env/env/__init__.py DELETED
@@ -1,46 +0,0 @@
1
- """Environment management for comfyui-isolation."""
2
-
3
- from .config import IsolatedEnv
4
- from .manager import IsolatedEnvManager
5
- from .cuda_gpu_detection import (
6
- GPUInfo,
7
- CUDAEnvironment,
8
- detect_cuda_environment,
9
- detect_cuda_version,
10
- detect_gpu_info,
11
- detect_gpus,
12
- get_gpu_summary,
13
- get_recommended_cuda_version,
14
- )
15
- from .platform import get_platform, PlatformProvider, PlatformPaths
16
- from .security import (
17
- normalize_env_name,
18
- validate_dependency,
19
- validate_dependencies,
20
- validate_path_within_root,
21
- validate_wheel_url,
22
- )
23
-
24
- __all__ = [
25
- "IsolatedEnv",
26
- "IsolatedEnvManager",
27
- # GPU Detection
28
- "GPUInfo",
29
- "CUDAEnvironment",
30
- "detect_cuda_environment",
31
- "detect_cuda_version",
32
- "detect_gpu_info",
33
- "detect_gpus",
34
- "get_gpu_summary",
35
- "get_recommended_cuda_version",
36
- # Platform
37
- "get_platform",
38
- "PlatformProvider",
39
- "PlatformPaths",
40
- # Security
41
- "normalize_env_name",
42
- "validate_dependency",
43
- "validate_dependencies",
44
- "validate_path_within_root",
45
- "validate_wheel_url",
46
- ]
comfy_env/env/config.py DELETED
@@ -1,191 +0,0 @@
1
- """Configuration for isolated environments."""
2
-
3
- from dataclasses import dataclass, field
4
- from pathlib import Path
5
- from typing import Dict, List, Optional
6
-
7
-
8
- @dataclass
9
- class SystemConfig:
10
- """Configuration for system-level packages.
11
-
12
- These are OS-level packages (apt, brew, etc.) that need to be installed
13
- before Python packages can work properly.
14
- """
15
- linux: List[str] = field(default_factory=list) # apt packages
16
- darwin: List[str] = field(default_factory=list) # brew packages (future)
17
- windows: List[str] = field(default_factory=list) # winget packages (future)
18
-
19
-
20
- @dataclass
21
- class LocalConfig:
22
- """Configuration for local (host environment) installs.
23
-
24
- These packages are installed into ComfyUI's main environment,
25
- not into an isolated venv.
26
- """
27
- cuda_packages: Dict[str, str] = field(default_factory=dict) # package -> version
28
- requirements: List[str] = field(default_factory=list)
29
-
30
-
31
- @dataclass
32
- class CondaConfig:
33
- """Configuration for conda packages (installed via pixi).
34
-
35
- When present, the environment uses pixi as the backend instead of uv.
36
- Pixi manages both conda and pip packages in a unified environment.
37
- """
38
- channels: List[str] = field(default_factory=list) # conda channels
39
- packages: List[str] = field(default_factory=list) # conda packages
40
-
41
-
42
- @dataclass
43
- class NodeReq:
44
- """A node dependency (another ComfyUI node pack)."""
45
- name: str
46
- repo: str # GitHub repo path, e.g., "Kosinkadink/ComfyUI-VideoHelperSuite"
47
-
48
-
49
- @dataclass
50
- class EnvManagerConfig:
51
- """
52
- Full configuration parsed from comfy-env.toml.
53
-
54
- Supports the v2 schema:
55
- [system] - System-level packages (apt, brew, etc.)
56
- [local.cuda] - CUDA packages for host environment
57
- [local.packages] - Regular packages for host environment
58
- [envname] - Isolated env definition
59
- [envname.cuda] - CUDA packages for isolated env
60
- [envname.packages] - Regular packages for isolated env
61
- [node_reqs] - Node dependencies
62
- [wheel_sources] - Custom wheel URL templates (override registry)
63
- """
64
- system: SystemConfig = field(default_factory=SystemConfig)
65
- local: LocalConfig = field(default_factory=LocalConfig)
66
- envs: Dict[str, "IsolatedEnv"] = field(default_factory=dict)
67
- node_reqs: List[NodeReq] = field(default_factory=list)
68
- wheel_sources: Dict[str, str] = field(default_factory=dict) # package -> wheel_template URL
69
-
70
- @property
71
- def has_system(self) -> bool:
72
- """Check if there are system packages to install."""
73
- return bool(self.system.linux or self.system.darwin or self.system.windows)
74
-
75
- @property
76
- def has_local(self) -> bool:
77
- """Check if there are local packages to install."""
78
- return bool(self.local.cuda_packages or self.local.requirements)
79
-
80
- @property
81
- def has_envs(self) -> bool:
82
- """Check if there are isolated environments defined."""
83
- return bool(self.envs)
84
-
85
- def get_env(self, name: str) -> Optional["IsolatedEnv"]:
86
- """Get an isolated environment by name."""
87
- return self.envs.get(name)
88
-
89
- @property
90
- def default_env(self) -> Optional["IsolatedEnv"]:
91
- """Get the first/only isolated environment, or None."""
92
- if self.envs:
93
- return next(iter(self.envs.values()))
94
- return None
95
-
96
-
97
- @dataclass
98
- class IsolatedEnv:
99
- """
100
- Configuration for an isolated Python environment.
101
-
102
- This defines what Python version, CUDA version, and dependencies
103
- should be installed in the isolated environment.
104
-
105
- Args:
106
- name: Unique name for this environment (used for caching)
107
- python: Python version (e.g., "3.10", "3.11")
108
- cuda: CUDA version (e.g., "12.4", "12.8") or None for CPU-only
109
- requirements: List of pip requirements (e.g., ["torch==2.8.0", "numpy"])
110
- requirements_file: Path to requirements.txt file
111
- wheel_sources: List of URLs for --find-links (custom wheel repos)
112
- index_urls: List of URLs for --extra-index-url
113
- env_dir: Custom directory for the venv (default: auto-generated)
114
- pytorch_version: Specific PyTorch version (auto-detected if None)
115
- worker_package: Worker package directory (e.g., "worker" -> worker/__main__.py)
116
- worker_script: Worker script file (e.g., "worker.py")
117
-
118
- Example:
119
- env = IsolatedEnv(
120
- name="my-node",
121
- python="3.10",
122
- cuda="12.8",
123
- requirements=["torch==2.8.0", "nvdiffrast"],
124
- wheel_sources=["https://my-wheels.github.io/"],
125
- )
126
- """
127
-
128
- name: str
129
- python: str = "3.10"
130
- cuda: Optional[str] = None
131
- requirements: list[str] = field(default_factory=list)
132
- no_deps_requirements: list[str] = field(default_factory=list) # Install with --no-deps
133
- # Platform-specific requirements (merged at install time)
134
- windows_requirements: list[str] = field(default_factory=list)
135
- linux_requirements: list[str] = field(default_factory=list)
136
- darwin_requirements: list[str] = field(default_factory=list)
137
- requirements_file: Optional[Path] = None
138
- wheel_sources: list[str] = field(default_factory=list)
139
- index_urls: list[str] = field(default_factory=list)
140
- env_dir: Optional[Path] = None
141
- pytorch_version: Optional[str] = None
142
- # Worker configuration
143
- worker_package: Optional[str] = None # e.g., "worker" -> worker/__main__.py
144
- worker_script: Optional[str] = None # e.g., "worker.py" -> worker.py
145
- # Conda configuration (uses pixi backend when present)
146
- conda: Optional["CondaConfig"] = None
147
- # Runtime isolation - run node FUNCTION methods in isolated subprocess
148
- isolated: bool = False
149
- # Environment variables for install (e.g., CMAKE_ARGS for build flags)
150
- env_vars: Dict[str, str] = field(default_factory=dict)
151
-
152
- def __post_init__(self):
153
- """Validate and normalize configuration."""
154
- # Normalize paths
155
- if self.requirements_file is not None:
156
- self.requirements_file = Path(self.requirements_file)
157
- if self.env_dir is not None:
158
- self.env_dir = Path(self.env_dir)
159
-
160
- # Validate Python version
161
- if not self.python.replace(".", "").isdigit():
162
- raise ValueError(f"Invalid Python version: {self.python}")
163
-
164
- # Validate CUDA version if specified
165
- if self.cuda is not None:
166
- cuda_clean = self.cuda.replace(".", "")
167
- if not cuda_clean.isdigit():
168
- raise ValueError(f"Invalid CUDA version: {self.cuda}")
169
-
170
- @property
171
- def cuda_short(self) -> Optional[str]:
172
- """Get CUDA version without dots (e.g., '128' for '12.8')."""
173
- if self.cuda is None:
174
- return None
175
- return self.cuda.replace(".", "")
176
-
177
- @property
178
- def python_short(self) -> str:
179
- """Get Python version without dots (e.g., '310' for '3.10')."""
180
- return self.python.replace(".", "")
181
-
182
- def get_default_env_dir(self, base_dir: Path) -> Path:
183
- """Get the default environment directory path."""
184
- if self.env_dir is not None:
185
- return self.env_dir
186
- return base_dir / f"_env_{self.name}"
187
-
188
- @property
189
- def uses_conda(self) -> bool:
190
- """Check if this environment uses conda packages (pixi backend)."""
191
- return self.conda is not None and bool(self.conda.packages)