comfy-env 0.0.41__tar.gz → 0.0.43__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.
- {comfy_env-0.0.41 → comfy_env-0.0.43}/PKG-INFO +118 -46
- comfy_env-0.0.43/README.md +273 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/pyproject.toml +1 -1
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/__init__.py +8 -4
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/cli.py +77 -147
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/config.py +2 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/config_file.py +27 -3
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/manager.py +30 -129
- comfy_env-0.0.43/src/comfy_env/install.py +496 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/registry.py +48 -9
- comfy_env-0.0.43/src/comfy_env/resolver.py +211 -0
- comfy_env-0.0.43/src/comfy_env/wheel_sources.yml +135 -0
- comfy_env-0.0.41/README.md +0 -201
- comfy_env-0.0.41/src/comfy_env/index_resolver.py +0 -132
- comfy_env-0.0.41/src/comfy_env/install.py +0 -870
- comfy_env-0.0.41/src/comfy_env/resolver.py +0 -388
- comfy_env-0.0.41/src/comfy_env/wheel_sources.yml +0 -186
- comfy_env-0.0.41/untitled.txt +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/.github/workflows/publish.yml +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/.gitignore +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/LICENSE +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/decorator.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/cuda_gpu_detection.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/platform/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/platform/base.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/platform/darwin.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/platform/linux.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/platform/windows.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/env/security.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/errors.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/bridge.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/protocol.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/tensor.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/torch_bridge.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/transport.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/ipc/worker.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/nodes.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/pixi.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/stubs/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/stubs/comfy/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/stubs/comfy/model_management.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/stubs/comfy/utils.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/stubs/folder_paths.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/__init__.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/base.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/pool.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/tensor_utils.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/torch_mp.py +0 -0
- {comfy_env-0.0.41 → comfy_env-0.0.43}/src/comfy_env/workers/venv.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: comfy-env
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.43
|
|
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
|
|
@@ -67,17 +67,12 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
|
67
67
|
Create a `comfy-env.toml` in your node directory:
|
|
68
68
|
|
|
69
69
|
```toml
|
|
70
|
-
[
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
cuda = "auto"
|
|
70
|
+
[cuda]
|
|
71
|
+
nvdiffrast = "0.4.0"
|
|
72
|
+
pytorch3d = "0.7.9"
|
|
74
73
|
|
|
75
74
|
[packages]
|
|
76
75
|
requirements = ["transformers>=4.56", "pillow"]
|
|
77
|
-
no_deps = ["nvdiffrast==0.4.0", "pytorch3d>=0.7.8"]
|
|
78
|
-
|
|
79
|
-
[sources]
|
|
80
|
-
wheel_sources = ["https://github.com/PozzettiAndrea/nvdiffrast-full-wheels/releases/download/"]
|
|
81
76
|
```
|
|
82
77
|
|
|
83
78
|
Then in your `__init__.py`:
|
|
@@ -122,56 +117,124 @@ comfy-env install --dry-run
|
|
|
122
117
|
# Resolve wheel URLs without installing
|
|
123
118
|
comfy-env resolve nvdiffrast==0.4.0
|
|
124
119
|
|
|
120
|
+
# List all packages in the built-in registry
|
|
121
|
+
comfy-env list-packages
|
|
122
|
+
|
|
125
123
|
# Verify installation
|
|
126
124
|
comfy-env doctor
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
##
|
|
127
|
+
## Configuration
|
|
130
128
|
|
|
131
|
-
### comfy-env.toml
|
|
129
|
+
### Simple Format (comfy-env.toml)
|
|
132
130
|
|
|
133
131
|
```toml
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
# CUDA packages (uses built-in registry)
|
|
133
|
+
[cuda]
|
|
134
|
+
nvdiffrast = "0.4.0"
|
|
135
|
+
pytorch3d = "0.7.9"
|
|
136
|
+
torch-scatter = "2.1.2"
|
|
138
137
|
|
|
138
|
+
# Regular pip packages
|
|
139
139
|
[packages]
|
|
140
|
-
requirements = [
|
|
141
|
-
"transformers>=4.56",
|
|
142
|
-
"pillow",
|
|
143
|
-
]
|
|
144
|
-
no_deps = [ # CUDA packages (installed with --no-deps)
|
|
145
|
-
"nvdiffrast==0.4.0",
|
|
146
|
-
"pytorch3d>=0.7.8",
|
|
147
|
-
]
|
|
148
|
-
|
|
149
|
-
[sources]
|
|
150
|
-
wheel_sources = [ # GitHub releases with pre-built wheels
|
|
151
|
-
"https://github.com/.../releases/download/",
|
|
152
|
-
]
|
|
153
|
-
index_urls = [ # Extra pip index URLs
|
|
154
|
-
"https://pypi.org/simple/",
|
|
155
|
-
]
|
|
156
|
-
|
|
157
|
-
[worker] # For isolation mode
|
|
158
|
-
package = "worker" # worker/__main__.py
|
|
140
|
+
requirements = ["transformers>=4.56", "pillow"]
|
|
159
141
|
```
|
|
160
142
|
|
|
161
|
-
###
|
|
143
|
+
### Full Format
|
|
144
|
+
|
|
145
|
+
```toml
|
|
146
|
+
[system]
|
|
147
|
+
linux = ["libgl1", "libopengl0"] # apt packages
|
|
148
|
+
|
|
149
|
+
[local.cuda]
|
|
150
|
+
nvdiffrast = "0.4.0"
|
|
151
|
+
|
|
152
|
+
[local.packages]
|
|
153
|
+
requirements = ["pillow", "numpy"]
|
|
154
|
+
|
|
155
|
+
# For isolated environments (creates separate venv)
|
|
156
|
+
[myenv]
|
|
157
|
+
python = "3.10"
|
|
158
|
+
cuda = "12.8"
|
|
159
|
+
|
|
160
|
+
[myenv.cuda]
|
|
161
|
+
torch-scatter = "2.1.2"
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
[myenv.packages]
|
|
164
|
+
requirements = ["transformers>=4.56"]
|
|
165
|
+
|
|
166
|
+
# Custom wheel templates (override built-in registry)
|
|
167
|
+
[wheel_sources]
|
|
168
|
+
my-custom-pkg = "https://my-server.com/my-pkg-{version}+cu{cuda_short}-{py_tag}-{platform}.whl"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Writing Wheel Templates
|
|
172
|
+
|
|
173
|
+
### Template Variables
|
|
164
174
|
|
|
165
175
|
| Variable | Example | Description |
|
|
166
176
|
|----------|---------|-------------|
|
|
177
|
+
| `{version}` | `0.4.0` | Package version |
|
|
167
178
|
| `{cuda_version}` | `12.8` | Full CUDA version |
|
|
168
179
|
| `{cuda_short}` | `128` | CUDA without dot |
|
|
169
|
-
| `{
|
|
170
|
-
| `{
|
|
180
|
+
| `{cuda_major}` | `12` | CUDA major only |
|
|
181
|
+
| `{torch_version}` | `2.8.0` | Full PyTorch version |
|
|
182
|
+
| `{torch_mm}` | `28` | PyTorch major.minor no dot |
|
|
183
|
+
| `{torch_dotted_mm}` | `2.8` | PyTorch major.minor with dot |
|
|
171
184
|
| `{py_version}` | `3.10` | Python version |
|
|
172
185
|
| `{py_short}` | `310` | Python without dot |
|
|
186
|
+
| `{py_tag}` | `cp310` | Python wheel tag |
|
|
173
187
|
| `{platform}` | `linux_x86_64` | Platform tag |
|
|
174
188
|
|
|
189
|
+
### Common Wheel URL Patterns
|
|
190
|
+
|
|
191
|
+
**Pattern 1: Simple CUDA + Python**
|
|
192
|
+
```
|
|
193
|
+
https://example.com/{package}-{version}+cu{cuda_short}-{py_tag}-{py_tag}-{platform}.whl
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Pattern 2: CUDA + PyTorch**
|
|
197
|
+
```
|
|
198
|
+
https://example.com/{package}-{version}+cu{cuda_short}torch{torch_mm}-{py_tag}-{py_tag}-{platform}.whl
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Pattern 3: GitHub Releases**
|
|
202
|
+
```
|
|
203
|
+
https://github.com/org/repo/releases/download/v{version}/{package}-{version}+cu{cuda_short}-{py_tag}-{platform}.whl
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### How to Find the Right Template
|
|
207
|
+
|
|
208
|
+
1. Download a wheel manually from the source
|
|
209
|
+
2. Look at the filename pattern: `nvdiffrast-0.4.0+cu128torch28-cp310-cp310-linux_x86_64.whl`
|
|
210
|
+
3. Replace values with variables: `nvdiffrast-{version}+cu{cuda_short}torch{torch_mm}-{py_tag}-{py_tag}-{platform}.whl`
|
|
211
|
+
4. Prepend the base URL
|
|
212
|
+
|
|
213
|
+
### Testing Your Template
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
comfy-env resolve my-package==1.0.0
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This shows the resolved URL without installing.
|
|
220
|
+
|
|
221
|
+
### Adding Custom Wheel Sources
|
|
222
|
+
|
|
223
|
+
If a package isn't in the built-in registry, add it to your `comfy-env.toml`:
|
|
224
|
+
|
|
225
|
+
```toml
|
|
226
|
+
[cuda]
|
|
227
|
+
my-custom-pkg = "1.0.0"
|
|
228
|
+
|
|
229
|
+
[wheel_sources]
|
|
230
|
+
my-custom-pkg = "https://my-server.com/my-custom-pkg-{version}+cu{cuda_short}-{py_tag}-{platform}.whl"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Resolution order:
|
|
234
|
+
1. User's `[wheel_sources]` in comfy-env.toml (highest priority)
|
|
235
|
+
2. Built-in `wheel_sources.yml` registry
|
|
236
|
+
3. Error if not found
|
|
237
|
+
|
|
175
238
|
## API Reference
|
|
176
239
|
|
|
177
240
|
### install()
|
|
@@ -185,23 +248,22 @@ install()
|
|
|
185
248
|
# Explicit config
|
|
186
249
|
install(config="comfy-env.toml")
|
|
187
250
|
|
|
188
|
-
# Isolated mode (creates separate venv)
|
|
189
|
-
install(mode="isolated")
|
|
190
|
-
|
|
191
251
|
# Dry run
|
|
192
252
|
install(dry_run=True)
|
|
193
253
|
```
|
|
194
254
|
|
|
195
|
-
###
|
|
255
|
+
### RuntimeEnv
|
|
196
256
|
|
|
197
257
|
```python
|
|
198
|
-
from comfy_env import RuntimeEnv
|
|
258
|
+
from comfy_env import RuntimeEnv
|
|
199
259
|
|
|
200
260
|
env = RuntimeEnv.detect()
|
|
201
|
-
|
|
261
|
+
print(env)
|
|
262
|
+
# Python 3.10, CUDA 12.8, PyTorch 2.8.0, GPU: NVIDIA GeForce RTX 4090
|
|
202
263
|
|
|
203
|
-
|
|
204
|
-
|
|
264
|
+
# Get template variables
|
|
265
|
+
vars_dict = env.as_dict()
|
|
266
|
+
# {'cuda_version': '12.8', 'cuda_short': '128', 'torch_mm': '28', ...}
|
|
205
267
|
```
|
|
206
268
|
|
|
207
269
|
### Workers (for isolation)
|
|
@@ -224,6 +286,16 @@ print(get_gpu_summary())
|
|
|
224
286
|
# GPU 0: NVIDIA GeForce RTX 5090 (sm_120) [Blackwell - CUDA 12.8]
|
|
225
287
|
```
|
|
226
288
|
|
|
289
|
+
## Built-in Package Registry
|
|
290
|
+
|
|
291
|
+
Run `comfy-env list-packages` to see all packages in the built-in registry.
|
|
292
|
+
|
|
293
|
+
The registry includes:
|
|
294
|
+
- PyTorch Geometric packages (torch-scatter, torch-cluster, torch-sparse)
|
|
295
|
+
- NVIDIA packages (nvdiffrast, pytorch3d, gsplat)
|
|
296
|
+
- Flash Attention (flash-attn)
|
|
297
|
+
- And more
|
|
298
|
+
|
|
227
299
|
## License
|
|
228
300
|
|
|
229
301
|
MIT - see LICENSE file.
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# comfy-env
|
|
2
|
+
|
|
3
|
+
Environment management for ComfyUI custom nodes. Provides:
|
|
4
|
+
|
|
5
|
+
1. **CUDA Wheel Resolution** - Install pre-built CUDA wheels (nvdiffrast, pytorch3d) without compilation
|
|
6
|
+
2. **Process Isolation** - Run nodes in separate Python environments with their own dependencies
|
|
7
|
+
|
|
8
|
+
## Why?
|
|
9
|
+
|
|
10
|
+
ComfyUI custom nodes face two challenges:
|
|
11
|
+
|
|
12
|
+
**Type 1: Dependency Conflicts**
|
|
13
|
+
- Node A needs `torch==2.1.0` with CUDA 11.8
|
|
14
|
+
- Node B needs `torch==2.8.0` with CUDA 12.8
|
|
15
|
+
|
|
16
|
+
**Type 2: CUDA Package Installation**
|
|
17
|
+
- Users don't have compilers installed
|
|
18
|
+
- Building from source takes forever
|
|
19
|
+
- pip install fails with cryptic errors
|
|
20
|
+
|
|
21
|
+
This package solves both problems.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install comfy-env
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires [uv](https://github.com/astral-sh/uv) for fast environment creation:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### In-Place Installation (Type 2 - CUDA Wheels)
|
|
38
|
+
|
|
39
|
+
Create a `comfy-env.toml` in your node directory:
|
|
40
|
+
|
|
41
|
+
```toml
|
|
42
|
+
[cuda]
|
|
43
|
+
nvdiffrast = "0.4.0"
|
|
44
|
+
pytorch3d = "0.7.9"
|
|
45
|
+
|
|
46
|
+
[packages]
|
|
47
|
+
requirements = ["transformers>=4.56", "pillow"]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then in your `__init__.py`:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from comfy_env import install
|
|
54
|
+
|
|
55
|
+
# Install CUDA wheels into current environment
|
|
56
|
+
install()
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Process Isolation (Type 1 - Separate Venv)
|
|
60
|
+
|
|
61
|
+
For nodes that need completely separate dependencies:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from comfy_env import isolated
|
|
65
|
+
|
|
66
|
+
@isolated(env="my-node")
|
|
67
|
+
class MyNode:
|
|
68
|
+
FUNCTION = "process"
|
|
69
|
+
RETURN_TYPES = ("IMAGE",)
|
|
70
|
+
|
|
71
|
+
def process(self, image):
|
|
72
|
+
# Runs in isolated subprocess with its own venv
|
|
73
|
+
import conflicting_package
|
|
74
|
+
return (result,)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## CLI
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Show detected environment
|
|
81
|
+
comfy-env info
|
|
82
|
+
|
|
83
|
+
# Install from config
|
|
84
|
+
comfy-env install
|
|
85
|
+
|
|
86
|
+
# Dry run (show what would be installed)
|
|
87
|
+
comfy-env install --dry-run
|
|
88
|
+
|
|
89
|
+
# Resolve wheel URLs without installing
|
|
90
|
+
comfy-env resolve nvdiffrast==0.4.0
|
|
91
|
+
|
|
92
|
+
# List all packages in the built-in registry
|
|
93
|
+
comfy-env list-packages
|
|
94
|
+
|
|
95
|
+
# Verify installation
|
|
96
|
+
comfy-env doctor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
### Simple Format (comfy-env.toml)
|
|
102
|
+
|
|
103
|
+
```toml
|
|
104
|
+
# CUDA packages (uses built-in registry)
|
|
105
|
+
[cuda]
|
|
106
|
+
nvdiffrast = "0.4.0"
|
|
107
|
+
pytorch3d = "0.7.9"
|
|
108
|
+
torch-scatter = "2.1.2"
|
|
109
|
+
|
|
110
|
+
# Regular pip packages
|
|
111
|
+
[packages]
|
|
112
|
+
requirements = ["transformers>=4.56", "pillow"]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Full Format
|
|
116
|
+
|
|
117
|
+
```toml
|
|
118
|
+
[system]
|
|
119
|
+
linux = ["libgl1", "libopengl0"] # apt packages
|
|
120
|
+
|
|
121
|
+
[local.cuda]
|
|
122
|
+
nvdiffrast = "0.4.0"
|
|
123
|
+
|
|
124
|
+
[local.packages]
|
|
125
|
+
requirements = ["pillow", "numpy"]
|
|
126
|
+
|
|
127
|
+
# For isolated environments (creates separate venv)
|
|
128
|
+
[myenv]
|
|
129
|
+
python = "3.10"
|
|
130
|
+
cuda = "12.8"
|
|
131
|
+
|
|
132
|
+
[myenv.cuda]
|
|
133
|
+
torch-scatter = "2.1.2"
|
|
134
|
+
|
|
135
|
+
[myenv.packages]
|
|
136
|
+
requirements = ["transformers>=4.56"]
|
|
137
|
+
|
|
138
|
+
# Custom wheel templates (override built-in registry)
|
|
139
|
+
[wheel_sources]
|
|
140
|
+
my-custom-pkg = "https://my-server.com/my-pkg-{version}+cu{cuda_short}-{py_tag}-{platform}.whl"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Writing Wheel Templates
|
|
144
|
+
|
|
145
|
+
### Template Variables
|
|
146
|
+
|
|
147
|
+
| Variable | Example | Description |
|
|
148
|
+
|----------|---------|-------------|
|
|
149
|
+
| `{version}` | `0.4.0` | Package version |
|
|
150
|
+
| `{cuda_version}` | `12.8` | Full CUDA version |
|
|
151
|
+
| `{cuda_short}` | `128` | CUDA without dot |
|
|
152
|
+
| `{cuda_major}` | `12` | CUDA major only |
|
|
153
|
+
| `{torch_version}` | `2.8.0` | Full PyTorch version |
|
|
154
|
+
| `{torch_mm}` | `28` | PyTorch major.minor no dot |
|
|
155
|
+
| `{torch_dotted_mm}` | `2.8` | PyTorch major.minor with dot |
|
|
156
|
+
| `{py_version}` | `3.10` | Python version |
|
|
157
|
+
| `{py_short}` | `310` | Python without dot |
|
|
158
|
+
| `{py_tag}` | `cp310` | Python wheel tag |
|
|
159
|
+
| `{platform}` | `linux_x86_64` | Platform tag |
|
|
160
|
+
|
|
161
|
+
### Common Wheel URL Patterns
|
|
162
|
+
|
|
163
|
+
**Pattern 1: Simple CUDA + Python**
|
|
164
|
+
```
|
|
165
|
+
https://example.com/{package}-{version}+cu{cuda_short}-{py_tag}-{py_tag}-{platform}.whl
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Pattern 2: CUDA + PyTorch**
|
|
169
|
+
```
|
|
170
|
+
https://example.com/{package}-{version}+cu{cuda_short}torch{torch_mm}-{py_tag}-{py_tag}-{platform}.whl
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Pattern 3: GitHub Releases**
|
|
174
|
+
```
|
|
175
|
+
https://github.com/org/repo/releases/download/v{version}/{package}-{version}+cu{cuda_short}-{py_tag}-{platform}.whl
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### How to Find the Right Template
|
|
179
|
+
|
|
180
|
+
1. Download a wheel manually from the source
|
|
181
|
+
2. Look at the filename pattern: `nvdiffrast-0.4.0+cu128torch28-cp310-cp310-linux_x86_64.whl`
|
|
182
|
+
3. Replace values with variables: `nvdiffrast-{version}+cu{cuda_short}torch{torch_mm}-{py_tag}-{py_tag}-{platform}.whl`
|
|
183
|
+
4. Prepend the base URL
|
|
184
|
+
|
|
185
|
+
### Testing Your Template
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
comfy-env resolve my-package==1.0.0
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This shows the resolved URL without installing.
|
|
192
|
+
|
|
193
|
+
### Adding Custom Wheel Sources
|
|
194
|
+
|
|
195
|
+
If a package isn't in the built-in registry, add it to your `comfy-env.toml`:
|
|
196
|
+
|
|
197
|
+
```toml
|
|
198
|
+
[cuda]
|
|
199
|
+
my-custom-pkg = "1.0.0"
|
|
200
|
+
|
|
201
|
+
[wheel_sources]
|
|
202
|
+
my-custom-pkg = "https://my-server.com/my-custom-pkg-{version}+cu{cuda_short}-{py_tag}-{platform}.whl"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Resolution order:
|
|
206
|
+
1. User's `[wheel_sources]` in comfy-env.toml (highest priority)
|
|
207
|
+
2. Built-in `wheel_sources.yml` registry
|
|
208
|
+
3. Error if not found
|
|
209
|
+
|
|
210
|
+
## API Reference
|
|
211
|
+
|
|
212
|
+
### install()
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from comfy_env import install
|
|
216
|
+
|
|
217
|
+
# Auto-discover config
|
|
218
|
+
install()
|
|
219
|
+
|
|
220
|
+
# Explicit config
|
|
221
|
+
install(config="comfy-env.toml")
|
|
222
|
+
|
|
223
|
+
# Dry run
|
|
224
|
+
install(dry_run=True)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### RuntimeEnv
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
from comfy_env import RuntimeEnv
|
|
231
|
+
|
|
232
|
+
env = RuntimeEnv.detect()
|
|
233
|
+
print(env)
|
|
234
|
+
# Python 3.10, CUDA 12.8, PyTorch 2.8.0, GPU: NVIDIA GeForce RTX 4090
|
|
235
|
+
|
|
236
|
+
# Get template variables
|
|
237
|
+
vars_dict = env.as_dict()
|
|
238
|
+
# {'cuda_version': '12.8', 'cuda_short': '128', 'torch_mm': '28', ...}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Workers (for isolation)
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
from comfy_env import TorchMPWorker
|
|
245
|
+
|
|
246
|
+
# Same-venv isolation (zero-copy tensors)
|
|
247
|
+
worker = TorchMPWorker()
|
|
248
|
+
result = worker.call(my_function, image=tensor)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## GPU Detection
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from comfy_env import detect_cuda_version, get_gpu_summary
|
|
255
|
+
|
|
256
|
+
cuda = detect_cuda_version() # "12.8", "12.4", or None
|
|
257
|
+
print(get_gpu_summary())
|
|
258
|
+
# GPU 0: NVIDIA GeForce RTX 5090 (sm_120) [Blackwell - CUDA 12.8]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Built-in Package Registry
|
|
262
|
+
|
|
263
|
+
Run `comfy-env list-packages` to see all packages in the built-in registry.
|
|
264
|
+
|
|
265
|
+
The registry includes:
|
|
266
|
+
- PyTorch Geometric packages (torch-scatter, torch-cluster, torch-sparse)
|
|
267
|
+
- NVIDIA packages (nvdiffrast, pytorch3d, gsplat)
|
|
268
|
+
- Flash Attention (flash-attn)
|
|
269
|
+
- And more
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
MIT - see LICENSE file.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
__version__ = version("comfy-env")
|
|
5
|
+
except PackageNotFoundError:
|
|
6
|
+
__version__ = "0.0.0-dev" # Fallback for editable installs
|
|
2
7
|
|
|
3
8
|
from .env.config import IsolatedEnv, EnvManagerConfig, LocalConfig, NodeReq, CondaConfig
|
|
4
9
|
from .env.config_file import (
|
|
@@ -31,8 +36,8 @@ from .ipc.worker import BaseWorker, register
|
|
|
31
36
|
from .decorator import isolated, shutdown_all_processes
|
|
32
37
|
|
|
33
38
|
# New in-place installation API
|
|
34
|
-
from .install import install, verify_installation
|
|
35
|
-
from .resolver import RuntimeEnv
|
|
39
|
+
from .install import install, verify_installation
|
|
40
|
+
from .resolver import RuntimeEnv
|
|
36
41
|
|
|
37
42
|
# Pixi integration (for conda packages)
|
|
38
43
|
from .pixi import (
|
|
@@ -82,7 +87,6 @@ __all__ = [
|
|
|
82
87
|
"install",
|
|
83
88
|
"verify_installation",
|
|
84
89
|
"RuntimeEnv",
|
|
85
|
-
"WheelResolver",
|
|
86
90
|
# Pixi integration (for conda packages)
|
|
87
91
|
"ensure_pixi",
|
|
88
92
|
"get_pixi_path",
|