comfy-env 0.0.8__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.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: comfy-env
3
+ Version: 0.0.8
4
+ Summary: Environment management for ComfyUI custom nodes - CUDA wheel resolution and process isolation
5
+ Project-URL: Homepage, https://github.com/PozzettiAndrea/comfy-env
6
+ Project-URL: Repository, https://github.com/PozzettiAndrea/comfy-env
7
+ Project-URL: Issues, https://github.com/PozzettiAndrea/comfy-env/issues
8
+ Author: Andrea Pozzetti
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: comfyui,cuda,environment,isolation,process,venv,wheels
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: tomli>=2.0.0; python_version < '3.11'
21
+ Requires-Dist: uv>=0.4.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: mypy; extra == 'dev'
24
+ Requires-Dist: pytest; extra == 'dev'
25
+ Requires-Dist: ruff; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # comfy-env
29
+
30
+ Environment management for ComfyUI custom nodes. Provides:
31
+
32
+ 1. **CUDA Wheel Resolution** - Install pre-built CUDA wheels (nvdiffrast, pytorch3d) without compilation
33
+ 2. **Process Isolation** - Run nodes in separate Python environments with their own dependencies
34
+
35
+ ## Why?
36
+
37
+ ComfyUI custom nodes face two challenges:
38
+
39
+ **Type 1: Dependency Conflicts**
40
+ - Node A needs `torch==2.1.0` with CUDA 11.8
41
+ - Node B needs `torch==2.8.0` with CUDA 12.8
42
+
43
+ **Type 2: CUDA Package Installation**
44
+ - Users don't have compilers installed
45
+ - Building from source takes forever
46
+ - pip install fails with cryptic errors
47
+
48
+ This package solves both problems.
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ pip install comfy-env
54
+ ```
55
+
56
+ Requires [uv](https://github.com/astral-sh/uv) for fast environment creation:
57
+
58
+ ```bash
59
+ curl -LsSf https://astral.sh/uv/install.sh | sh
60
+ ```
61
+
62
+ ## Quick Start
63
+
64
+ ### In-Place Installation (Type 2 - CUDA Wheels)
65
+
66
+ Create a `comfy-env.toml` in your node directory:
67
+
68
+ ```toml
69
+ [env]
70
+ name = "my-node"
71
+ python = "3.10"
72
+ cuda = "auto"
73
+
74
+ [packages]
75
+ requirements = ["transformers>=4.56", "pillow"]
76
+ no_deps = ["nvdiffrast==0.4.0", "pytorch3d>=0.7.8"]
77
+
78
+ [sources]
79
+ wheel_sources = ["https://github.com/PozzettiAndrea/nvdiffrast-full-wheels/releases/download/"]
80
+ ```
81
+
82
+ Then in your `__init__.py`:
83
+
84
+ ```python
85
+ from comfy_env import install
86
+
87
+ # Install CUDA wheels into current environment
88
+ install()
89
+ ```
90
+
91
+ ### Process Isolation (Type 1 - Separate Venv)
92
+
93
+ For nodes that need completely separate dependencies:
94
+
95
+ ```python
96
+ from comfy_env import isolated
97
+
98
+ @isolated(env="my-node")
99
+ class MyNode:
100
+ FUNCTION = "process"
101
+ RETURN_TYPES = ("IMAGE",)
102
+
103
+ def process(self, image):
104
+ # Runs in isolated subprocess with its own venv
105
+ import conflicting_package
106
+ return (result,)
107
+ ```
108
+
109
+ ## CLI
110
+
111
+ ```bash
112
+ # Show detected environment
113
+ comfy-env info
114
+
115
+ # Install from config
116
+ comfy-env install
117
+
118
+ # Dry run (show what would be installed)
119
+ comfy-env install --dry-run
120
+
121
+ # Resolve wheel URLs without installing
122
+ comfy-env resolve nvdiffrast==0.4.0
123
+
124
+ # Verify installation
125
+ comfy-env doctor
126
+ ```
127
+
128
+ ## Configuration
129
+
130
+ ### comfy-env.toml
131
+
132
+ ```toml
133
+ [env]
134
+ name = "my-node" # Unique name for caching
135
+ python = "3.10" # Python version
136
+ cuda = "auto" # "auto", "12.8", "12.4", or null
137
+
138
+ [packages]
139
+ requirements = [ # Regular pip packages
140
+ "transformers>=4.56",
141
+ "pillow",
142
+ ]
143
+ no_deps = [ # CUDA packages (installed with --no-deps)
144
+ "nvdiffrast==0.4.0",
145
+ "pytorch3d>=0.7.8",
146
+ ]
147
+
148
+ [sources]
149
+ wheel_sources = [ # GitHub releases with pre-built wheels
150
+ "https://github.com/.../releases/download/",
151
+ ]
152
+ index_urls = [ # Extra pip index URLs
153
+ "https://pypi.org/simple/",
154
+ ]
155
+
156
+ [worker] # For isolation mode
157
+ package = "worker" # worker/__main__.py
158
+ ```
159
+
160
+ ### Template Variables
161
+
162
+ Wheel URLs support these template variables:
163
+
164
+ | Variable | Example | Description |
165
+ |----------|---------|-------------|
166
+ | `{cuda_version}` | `12.8` | Full CUDA version |
167
+ | `{cuda_short}` | `128` | CUDA without dot |
168
+ | `{torch_version}` | `2.8.0` | PyTorch version |
169
+ | `{torch_mm}` | `28` | PyTorch major.minor |
170
+ | `{py_version}` | `3.10` | Python version |
171
+ | `{py_short}` | `310` | Python without dot |
172
+ | `{platform}` | `linux_x86_64` | Platform tag |
173
+
174
+ ## API Reference
175
+
176
+ ### install()
177
+
178
+ ```python
179
+ from comfy_env import install
180
+
181
+ # Auto-discover config
182
+ install()
183
+
184
+ # Explicit config
185
+ install(config="comfy-env.toml")
186
+
187
+ # Isolated mode (creates separate venv)
188
+ install(mode="isolated")
189
+
190
+ # Dry run
191
+ install(dry_run=True)
192
+ ```
193
+
194
+ ### WheelResolver
195
+
196
+ ```python
197
+ from comfy_env import RuntimeEnv, WheelResolver
198
+
199
+ env = RuntimeEnv.detect()
200
+ resolver = WheelResolver()
201
+
202
+ url = resolver.resolve("nvdiffrast", "0.4.0", env)
203
+ print(url) # https://github.com/.../nvdiffrast-0.4.0+cu128torch28-...whl
204
+ ```
205
+
206
+ ### Workers (for isolation)
207
+
208
+ ```python
209
+ from comfy_env import TorchMPWorker
210
+
211
+ # Same-venv isolation (zero-copy tensors)
212
+ worker = TorchMPWorker()
213
+ result = worker.call(my_function, image=tensor)
214
+ ```
215
+
216
+ ## GPU Detection
217
+
218
+ ```python
219
+ from comfy_env import detect_cuda_version, get_gpu_summary
220
+
221
+ cuda = detect_cuda_version() # "12.8", "12.4", or None
222
+ print(get_gpu_summary())
223
+ # GPU 0: NVIDIA GeForce RTX 5090 (sm_120) [Blackwell - CUDA 12.8]
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT - see LICENSE file.
@@ -0,0 +1,39 @@
1
+ comfy_env/__init__.py,sha256=U5XtB2UeXZi8JPBhlh0XjQprLsAuVslPoJNWOSvCFhs,4249
2
+ comfy_env/cli.py,sha256=9GvQYrXlJRl0ZaCuFHvRtVxWQ34Axd5Brgu5FWRONp4,11424
3
+ comfy_env/decorator.py,sha256=daFR5aLzshkmo5sRKhSGPcTUgIUWml7Gs6A1bfnDuyc,15718
4
+ comfy_env/errors.py,sha256=egeyXY-j7KpxyA0s67TcJLEfJX23LCAD3v1P4FgQIGE,10917
5
+ comfy_env/install.py,sha256=JaatBM5PyY4Ua6E2HgkLAlFZ2TSEjlI-lAwJ-Hl7wU8,18876
6
+ comfy_env/registry.py,sha256=iZprw2iIAJl-Vvotsf_B_PofzqE-6IiVfNPBHYUYg6g,11577
7
+ comfy_env/resolver.py,sha256=xz7GPlxy02iwwpocIzzbdGnrwnSpi-D5IzpL8SQSgvI,12893
8
+ comfy_env/runner.py,sha256=0YUqzK93u--7pKV6_yVC564AJE9rS3y81t5ZhQi2t4Y,9696
9
+ comfy_env/env/__init__.py,sha256=sybOBrxJCfL4Xry9NNd5xwn9hXIHudXlXDa7SpJkPCE,811
10
+ comfy_env/env/config.py,sha256=fL2P0ScoioPktZEHQnoo1dy-VB5intJEYLHm5fuOmF8,5406
11
+ comfy_env/env/config_file.py,sha256=QLf3WPCqx46v1kVzM4jV_QAz919zmkk0_FRtLD3jO8s,19507
12
+ comfy_env/env/detection.py,sha256=Co8BJmTRCq1ZHDsm6832jF87za0GRAhH7zF04-5QwcE,4949
13
+ comfy_env/env/manager.py,sha256=ysIVlpxRD5x-5X47ESmfly2Vz6jv-9yA6863szHf7-8,24131
14
+ comfy_env/env/security.py,sha256=dNSitAnfBNVdvxgBBntYw33AJaCs_S1MHb7KJhAVYzM,8171
15
+ comfy_env/env/platform/__init__.py,sha256=Nb5MPZIEeanSMEWwqU4p4bnEKTJn1tWcwobnhq9x9IY,614
16
+ comfy_env/env/platform/base.py,sha256=iS0ptTTVjXRwPU4qWUdvHI7jteuzxGSjWr5BUQ7hGiU,2453
17
+ comfy_env/env/platform/darwin.py,sha256=HK3VkLT6DfesAnIXwx2IaUFHTBclF0xTQnC7azWY6Kc,1552
18
+ comfy_env/env/platform/linux.py,sha256=xLp8FEbFqZLQrzIZBI9z3C4g23Ab1ASTHLsXDzsdCoA,2062
19
+ comfy_env/env/platform/windows.py,sha256=nD1-bKU2rGmEJlS-cc5yWXMSA51YQtVupn-lQEO5UYA,14840
20
+ comfy_env/ipc/__init__.py,sha256=pTjgJn5YJxLXmEvuKh3lkCEJQs-6W6_F01jfkFMUi0c,1375
21
+ comfy_env/ipc/bridge.py,sha256=kEy__kco8FVQNj5MyadF5k00YEivcGmifAJAOfr643U,17645
22
+ comfy_env/ipc/protocol.py,sha256=gfWe5yEDUn4QWhcdWFcxn40GqxlW1Uf23j0edOzPPng,7951
23
+ comfy_env/ipc/tensor.py,sha256=DyU28GymKkLPVwzZyKdm2Av222hdaycMgv3KdL5mtO0,12009
24
+ comfy_env/ipc/torch_bridge.py,sha256=WzdwDJa3N_1fEl9OeZxikvMbwryO5P63o0WmEDpS18A,13206
25
+ comfy_env/ipc/transport.py,sha256=XQlRcfQsd4nd909KIYnZKvsS3ksGpGjyVucn8jvmLIU,9698
26
+ comfy_env/ipc/worker.py,sha256=oxTLF9xXrl8CRx_JVNBdkxZh35NuzfkdxhaUtUuXogs,6661
27
+ comfy_env/stubs/__init__.py,sha256=jMeWEKY30y8QqYX9AUyuZbmm607erQTc4N7YaDoAH00,38
28
+ comfy_env/stubs/folder_paths.py,sha256=KEH9ntMH6HOgE595G5dBL9kSTEUvf_shYtQKIyiiDbk,1586
29
+ comfy_env/workers/__init__.py,sha256=IKZwOvrWOGqBLDUIFAalg4CdqzJ_YnAdxo2Ha7gZTJ0,1467
30
+ comfy_env/workers/base.py,sha256=ZILYXlvGCWuCZXmjKqfG8VeD19ihdYaASdlbasl2BMo,2312
31
+ comfy_env/workers/pool.py,sha256=MtjeOWfvHSCockq8j1gfnxIl-t01GSB79T5N4YB82Lg,6956
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
34
+ comfy_env/workers/venv.py,sha256=_ekHfZPqBIPY08DjqiXm6cTBQH4DrbxRWR3AAv3mit8,31589
35
+ comfy_env-0.0.8.dist-info/METADATA,sha256=mir9pZymbCPcnI6yc1YrjxyMMnX3qm3pUR7NILB5iCE,5371
36
+ comfy_env-0.0.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
37
+ comfy_env-0.0.8.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
38
+ comfy_env-0.0.8.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
39
+ comfy_env-0.0.8.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ comfy-env = comfy_env.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Andrea Pozzetti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.