comfy-env 0.0.16__py3-none-any.whl → 0.0.18__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.
comfy_env/cli.py CHANGED
@@ -47,7 +47,7 @@ def main(args: Optional[List[str]] = None) -> int:
47
47
  install_parser = subparsers.add_parser(
48
48
  "install",
49
49
  help="Install dependencies from config",
50
- description="Install CUDA wheels and dependencies from comfyui_env.toml",
50
+ description="Install CUDA wheels and dependencies from comfy-env.toml",
51
51
  )
52
52
  install_parser.add_argument(
53
53
  "--config", "-c",
@@ -450,7 +450,7 @@ def cmd_list_packages(args) -> int:
450
450
  print("=" * 60)
451
451
  print()
452
452
  print("These packages can be installed without specifying wheel_sources.")
453
- print("Just add them to your comfyui_env.toml:")
453
+ print("Just add them to your comfy-env.toml:")
454
454
  print()
455
455
  print(" [cuda]")
456
456
  print(" torch-scatter = \"2.1.2\"")
comfy_env/decorator.py CHANGED
@@ -153,7 +153,7 @@ def _get_or_create_worker(config: WorkerConfig, log_fn: Callable):
153
153
  # Same Python - use TorchMPWorker (fast, zero-copy)
154
154
  from .workers import TorchMPWorker
155
155
  log_fn(f"Creating TorchMPWorker (same Python, zero-copy tensors)")
156
- worker = TorchMPWorker(name=config.env_name)
156
+ worker = TorchMPWorker(name=config.env_name, sys_path=config.sys_path)
157
157
  else:
158
158
  # Different Python - use PersistentVenvWorker
159
159
  from .workers.venv import PersistentVenvWorker
@@ -369,6 +369,11 @@ def isolated(
369
369
  # Get module name for import in worker
370
370
  module_name = cls.__module__
371
371
 
372
+ # Handle ComfyUI's dynamic import which can set __module__ to a path
373
+ if module_name.startswith('/') or module_name.startswith('\\'):
374
+ # Module name is a filesystem path - use the source file stem instead
375
+ module_name = source_file.stem
376
+
372
377
  # Call worker using appropriate method
373
378
  if worker_config.python is None:
374
379
  # TorchMPWorker - use call_method protocol (avoids pickle issues)
comfy_env/env/config.py CHANGED
@@ -34,7 +34,7 @@ class ToolConfig:
34
34
  @dataclass
35
35
  class EnvManagerConfig:
36
36
  """
37
- Full configuration parsed from comfyui_env.toml.
37
+ Full configuration parsed from comfy-env.toml.
38
38
 
39
39
  Supports the v2 schema:
40
40
  [local.cuda] - CUDA packages for host environment
comfy_env/install.py CHANGED
@@ -12,10 +12,10 @@ Example:
12
12
  install()
13
13
 
14
14
  # In-place with explicit config
15
- install(config="comfyui_env.toml", mode="inplace")
15
+ install(config="comfy-env.toml", mode="inplace")
16
16
 
17
17
  # Isolated environment
18
- install(config="comfyui_env.toml", mode="isolated")
18
+ install(config="comfy-env.toml", mode="isolated")
19
19
  """
20
20
 
21
21
  import shutil
@@ -42,7 +42,7 @@ def install(
42
42
  verify_wheels: bool = False,
43
43
  ) -> bool:
44
44
  """
45
- Install dependencies from a comfyui_env.toml configuration.
45
+ Install dependencies from a comfy-env.toml configuration.
46
46
 
47
47
  This is the main entry point for installing CUDA dependencies.
48
48
 
@@ -67,7 +67,7 @@ def install(
67
67
  install()
68
68
 
69
69
  # Explicit config file
70
- install(config="comfyui_env.toml")
70
+ install(config="comfy-env.toml")
71
71
 
72
72
  # Isolated mode
73
73
  install(mode="isolated")
@@ -83,7 +83,7 @@ def install(
83
83
  if full_config is None:
84
84
  raise FileNotFoundError(
85
85
  "No configuration file found. "
86
- "Create comfyui_env.toml or specify path explicitly."
86
+ "Create comfy-env.toml or specify path explicitly."
87
87
  )
88
88
 
89
89
  # Install tools first (e.g., Blender)
@@ -238,7 +238,11 @@ def _get_install_info(
238
238
  index_url = _substitute_template(config.get("index_url", ""), env)
239
239
 
240
240
  if method == "index":
241
- return {"method": method, "description": f"from index {index_url}"}
241
+ version_info = ""
242
+ if "version_template" in config:
243
+ resolved_version = _substitute_template(config["version_template"], env)
244
+ version_info = f" (version {resolved_version})"
245
+ return {"method": method, "description": f"from index {index_url}{version_info}"}
242
246
  elif method == "github_index":
243
247
  return {"method": method, "description": f"from {index_url}"}
244
248
  elif method == "find_links":
@@ -277,8 +281,13 @@ def _install_cuda_package(
277
281
  if method == "index":
278
282
  # PEP 503 index - use pip --extra-index-url
279
283
  index_url = _substitute_template(config["index_url"], env)
280
- pkg_spec = f"{package}=={version}" if version else package
281
- log(f" Installing {package} from PyG index...")
284
+ # Check for version_template (e.g., detectron2 with embedded torch/cuda version)
285
+ if "version_template" in config:
286
+ resolved_version = _substitute_template(config["version_template"], env)
287
+ pkg_spec = f"{package}=={resolved_version}"
288
+ else:
289
+ pkg_spec = f"{package}=={version}" if version else package
290
+ log(f" Installing {package} from index...")
282
291
  _pip_install_with_index(pkg_spec, index_url, log)
283
292
 
284
293
  elif method == "github_index":
@@ -120,6 +120,18 @@ packages:
120
120
  method: pypi
121
121
  description: Triton compiler for custom CUDA kernels
122
122
 
123
+ # ===========================================================================
124
+ # detectron2 - Facebook's detection library
125
+ # https://github.com/facebookresearch/detectron2
126
+ # Prebuilt wheels from miropsota's torch_packages_builder
127
+ # Version format: 0.6+<commit>pt<torch_version>cu<cuda_short>
128
+ # ===========================================================================
129
+ detectron2:
130
+ method: index
131
+ index_url: "https://miropsota.github.io/torch_packages_builder"
132
+ version_template: "0.6+2a420edpt{torch_version}cu{cuda_short}"
133
+ description: Detectron2 - Facebook's detection and segmentation library
134
+
123
135
  # ===========================================================================
124
136
  # flash-attn - Multi-source prebuilt wheels
125
137
  # ===========================================================================
@@ -40,7 +40,7 @@ _SHUTDOWN = object()
40
40
  _CALL_METHOD = "call_method"
41
41
 
42
42
 
43
- def _worker_loop(queue_in, queue_out):
43
+ def _worker_loop(queue_in, queue_out, sys_path_additions=None):
44
44
  """
45
45
  Worker process main loop.
46
46
 
@@ -54,10 +54,22 @@ def _worker_loop(queue_in, queue_out):
54
54
  import importlib
55
55
  import os
56
56
  import sys
57
+ from pathlib import Path
57
58
 
58
59
  # Set worker mode env var
59
60
  os.environ["COMFYUI_ISOLATION_WORKER"] = "1"
60
61
 
62
+ # Add stubs directory for folder_paths etc. (same as PersistentVenvWorker)
63
+ stubs_dir = Path(__file__).parent.parent / "stubs"
64
+ if str(stubs_dir) not in sys.path:
65
+ sys.path.insert(0, str(stubs_dir))
66
+
67
+ # Add custom paths to sys.path for module discovery
68
+ if sys_path_additions:
69
+ for path in sys_path_additions:
70
+ if path not in sys.path:
71
+ sys.path.insert(0, path)
72
+
61
73
  while True:
62
74
  try:
63
75
  item = queue_in.get()
@@ -151,14 +163,16 @@ class TorchMPWorker(Worker):
151
163
  interpreter without inherited state from the parent.
152
164
  """
153
165
 
154
- def __init__(self, name: Optional[str] = None):
166
+ def __init__(self, name: Optional[str] = None, sys_path: Optional[list] = None):
155
167
  """
156
168
  Initialize the worker.
157
169
 
158
170
  Args:
159
171
  name: Optional name for logging/debugging.
172
+ sys_path: Optional list of paths to add to sys.path in worker process.
160
173
  """
161
174
  self.name = name or "TorchMPWorker"
175
+ self._sys_path = sys_path or []
162
176
  self._process = None
163
177
  self._queue_in = None
164
178
  self._queue_out = None
@@ -185,7 +199,7 @@ class TorchMPWorker(Worker):
185
199
  self._queue_out = ctx.Queue()
186
200
  self._process = ctx.Process(
187
201
  target=_worker_loop,
188
- args=(self._queue_in, self._queue_out),
202
+ args=(self._queue_in, self._queue_out, self._sys_path),
189
203
  daemon=True,
190
204
  )
191
205
  self._process.start()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comfy-env
3
- Version: 0.0.16
3
+ Version: 0.0.18
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,13 +1,13 @@
1
1
  comfy_env/__init__.py,sha256=76gIAh7qFff_v_bAolXVzuWzcgvD3bp-yQGCNzba_Iw,3287
2
- comfy_env/cli.py,sha256=q4y_tlPyqKMZhge7XeO9VdbFVZ4dl9LZsgnnTVQYXD4,15979
3
- comfy_env/decorator.py,sha256=daFR5aLzshkmo5sRKhSGPcTUgIUWml7Gs6A1bfnDuyc,15718
2
+ comfy_env/cli.py,sha256=X-GCQMP0mtMcE3ZgkT-VLQ4Gq3UUvcb_Ux_NClEFhgI,15975
3
+ comfy_env/decorator.py,sha256=FwM6O0eIYK1FlKmniE4sJyzLLIr4mVg3ON-PnuTF2cw,16056
4
4
  comfy_env/errors.py,sha256=8hN8NDlo8oBUdapc-eT3ZluigI5VBzfqsSBvQdfWlz4,9943
5
- comfy_env/install.py,sha256=uk7mtmoDrcCs6MCfz-5WuyYtgd9JFaByarBWgSUc7Dk,20518
5
+ comfy_env/install.py,sha256=K0sayQ8HVG5t7XpxrAouhicFYnqSXpaQeDa5DgHO6L4,21064
6
6
  comfy_env/registry.py,sha256=uFCtGmWYvwGCqObXgzmArX7o5JsFNsHXxayofk3m6no,2569
7
7
  comfy_env/resolver.py,sha256=l-AnmCE1puG6CvdpDB-KrsfG_cn_3uO2DryYizUnG_4,12474
8
8
  comfy_env/tools.py,sha256=mFNB_uq64ON5hlreH_0wTLONahDo3pBHxhQYTcTHxXE,6554
9
9
  comfy_env/env/__init__.py,sha256=imQdoQEQvrRT-QDtyNpFlkVbm2fBzgACdpQwRPd09fI,1157
10
- comfy_env/env/config.py,sha256=6KZPhRiW8ShhuDnX-e6_yjZHMdO_xBm02w00Q3NBJXM,5980
10
+ comfy_env/env/config.py,sha256=h2EJqg1bf5GamBwXV2uXeYZ4fBpW9nqs0WG1Xzlqjmc,5978
11
11
  comfy_env/env/config_file.py,sha256=tJ9xfmf2RghzK6PUxwTrhpvqV_5pecjC6IYYBoZ0U58,21890
12
12
  comfy_env/env/cuda_gpu_detection.py,sha256=YLuXUdWg6FeKdNyLlQAHPlveg4rTenXJ2VbeAaEi9QE,9755
13
13
  comfy_env/env/manager.py,sha256=bbV1MpURNGuBJ1sSWg_2oSU0J-dW-FhBCuHHHQxgrSM,24785
@@ -30,11 +30,11 @@ comfy_env/workers/__init__.py,sha256=IKZwOvrWOGqBLDUIFAalg4CdqzJ_YnAdxo2Ha7gZTJ0
30
30
  comfy_env/workers/base.py,sha256=ZILYXlvGCWuCZXmjKqfG8VeD19ihdYaASdlbasl2BMo,2312
31
31
  comfy_env/workers/pool.py,sha256=MtjeOWfvHSCockq8j1gfnxIl-t01GSB79T5N4YB82Lg,6956
32
32
  comfy_env/workers/tensor_utils.py,sha256=TCuOAjJymrSbkgfyvcKtQ_KbVWTqSwP9VH_bCaFLLq8,6409
33
- comfy_env/workers/torch_mp.py,sha256=DsfxE3LBAWEuGtk-p-YL0UhVQ7VDh73KT_TFRxYN4-Q,12563
33
+ comfy_env/workers/torch_mp.py,sha256=1cNhcrCWZ9E6AHCIEMC3vDLo_qjyV2wuQh5iZslg0Hg,13222
34
34
  comfy_env/workers/venv.py,sha256=_ekHfZPqBIPY08DjqiXm6cTBQH4DrbxRWR3AAv3mit8,31589
35
- comfy_env/wheel_sources.yml,sha256=ubVuQllCQGkZhLNQaG54divCwn0zLzYg4turzhnIZQ8,7150
36
- comfy_env-0.0.16.dist-info/METADATA,sha256=jj04Wmh8ojLkTKSOwyRug1kSWT4SrpsY5PKfgbuq0NE,5399
37
- comfy_env-0.0.16.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
38
- comfy_env-0.0.16.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
39
- comfy_env-0.0.16.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
40
- comfy_env-0.0.16.dist-info/RECORD,,
35
+ comfy_env/wheel_sources.yml,sha256=nSZ8XB_I5JXQGB7AgC6lHs_IXMd9Kcno10artNL8BKw,7775
36
+ comfy_env-0.0.18.dist-info/METADATA,sha256=2AL5DPZlU5EXPmtM9OhEt-FZ8wlIw6lzs5kGMGW4dKI,5399
37
+ comfy_env-0.0.18.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
38
+ comfy_env-0.0.18.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
39
+ comfy_env-0.0.18.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
40
+ comfy_env-0.0.18.dist-info/RECORD,,