comfy-env 0.0.72__py3-none-any.whl → 0.0.74__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/install.py +165 -1
- {comfy_env-0.0.72.dist-info → comfy_env-0.0.74.dist-info}/METADATA +1 -1
- {comfy_env-0.0.72.dist-info → comfy_env-0.0.74.dist-info}/RECORD +6 -6
- {comfy_env-0.0.72.dist-info → comfy_env-0.0.74.dist-info}/WHEEL +0 -0
- {comfy_env-0.0.72.dist-info → comfy_env-0.0.74.dist-info}/entry_points.txt +0 -0
- {comfy_env-0.0.72.dist-info → comfy_env-0.0.74.dist-info}/licenses/LICENSE +0 -0
comfy_env/install.py
CHANGED
|
@@ -55,7 +55,15 @@ def install(
|
|
|
55
55
|
"Create comfy-env.toml to define dependencies."
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
# Install
|
|
58
|
+
# Install apt packages first (Linux only)
|
|
59
|
+
if cfg.apt_packages:
|
|
60
|
+
_install_apt_packages(cfg.apt_packages, log, dry_run)
|
|
61
|
+
|
|
62
|
+
# Set persistent env vars (for OpenMP settings, etc.)
|
|
63
|
+
if cfg.env_vars:
|
|
64
|
+
_set_persistent_env_vars(cfg.env_vars, log, dry_run)
|
|
65
|
+
|
|
66
|
+
# Install node dependencies
|
|
59
67
|
if cfg.node_reqs:
|
|
60
68
|
_install_node_dependencies(cfg.node_reqs, node_dir, log, dry_run)
|
|
61
69
|
|
|
@@ -69,6 +77,162 @@ def install(
|
|
|
69
77
|
return True
|
|
70
78
|
|
|
71
79
|
|
|
80
|
+
def _install_apt_packages(
|
|
81
|
+
packages: List[str],
|
|
82
|
+
log: Callable[[str], None],
|
|
83
|
+
dry_run: bool,
|
|
84
|
+
) -> None:
|
|
85
|
+
"""Install apt packages (Linux only)."""
|
|
86
|
+
import os
|
|
87
|
+
import platform
|
|
88
|
+
import shutil
|
|
89
|
+
import subprocess
|
|
90
|
+
|
|
91
|
+
if platform.system() != "Linux":
|
|
92
|
+
log(f"[apt] Skipping apt packages (not Linux)")
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
log(f"\n[apt] Installing {len(packages)} system package(s):")
|
|
96
|
+
for pkg in packages:
|
|
97
|
+
log(f" - {pkg}")
|
|
98
|
+
|
|
99
|
+
if dry_run:
|
|
100
|
+
log(" (dry run - no changes made)")
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
# Determine if we need sudo
|
|
104
|
+
is_root = os.geteuid() == 0
|
|
105
|
+
has_sudo = shutil.which("sudo") is not None
|
|
106
|
+
use_sudo = not is_root and has_sudo
|
|
107
|
+
prefix = ["sudo"] if use_sudo else []
|
|
108
|
+
|
|
109
|
+
if not is_root and not has_sudo:
|
|
110
|
+
log(f"[apt] Warning: No root access. Install manually:")
|
|
111
|
+
log(f" sudo apt-get update && sudo apt-get install -y {' '.join(packages)}")
|
|
112
|
+
return
|
|
113
|
+
|
|
114
|
+
# Run apt-get update (suppress output, just show errors)
|
|
115
|
+
log("[apt] Updating package lists...")
|
|
116
|
+
result = subprocess.run(
|
|
117
|
+
prefix + ["apt-get", "update"],
|
|
118
|
+
capture_output=True,
|
|
119
|
+
text=True,
|
|
120
|
+
)
|
|
121
|
+
if result.returncode != 0:
|
|
122
|
+
log(f"[apt] Warning: apt-get update failed: {result.stderr.strip()}")
|
|
123
|
+
|
|
124
|
+
# Install each package individually (some may not exist on all distros)
|
|
125
|
+
log("[apt] Installing packages...")
|
|
126
|
+
installed = []
|
|
127
|
+
skipped = []
|
|
128
|
+
for pkg in packages:
|
|
129
|
+
result = subprocess.run(
|
|
130
|
+
prefix + ["apt-get", "install", "-y", pkg],
|
|
131
|
+
capture_output=True,
|
|
132
|
+
text=True,
|
|
133
|
+
)
|
|
134
|
+
if result.returncode == 0:
|
|
135
|
+
installed.append(pkg)
|
|
136
|
+
log(f" [apt] Installed {pkg}")
|
|
137
|
+
else:
|
|
138
|
+
skipped.append(pkg)
|
|
139
|
+
log(f" [apt] Skipped {pkg} (not available)")
|
|
140
|
+
|
|
141
|
+
if installed:
|
|
142
|
+
log(f"[apt] Installed {len(installed)} package(s)")
|
|
143
|
+
if skipped:
|
|
144
|
+
log(f"[apt] Skipped {len(skipped)} unavailable package(s)")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _set_persistent_env_vars(
|
|
148
|
+
env_vars: dict,
|
|
149
|
+
log: Callable[[str], None],
|
|
150
|
+
dry_run: bool,
|
|
151
|
+
) -> None:
|
|
152
|
+
"""Set env vars permanently (survives restarts)."""
|
|
153
|
+
import os
|
|
154
|
+
import platform
|
|
155
|
+
import subprocess
|
|
156
|
+
from pathlib import Path
|
|
157
|
+
|
|
158
|
+
if not env_vars:
|
|
159
|
+
return
|
|
160
|
+
|
|
161
|
+
system = platform.system()
|
|
162
|
+
log(f"\n[env] Setting {len(env_vars)} persistent environment variable(s)...")
|
|
163
|
+
|
|
164
|
+
for key, value in env_vars.items():
|
|
165
|
+
log(f" - {key}={value}")
|
|
166
|
+
|
|
167
|
+
if dry_run:
|
|
168
|
+
log(" (dry run - no changes made)")
|
|
169
|
+
return
|
|
170
|
+
|
|
171
|
+
if system == "Windows":
|
|
172
|
+
# Windows: use setx (writes to registry)
|
|
173
|
+
for key, value in env_vars.items():
|
|
174
|
+
result = subprocess.run(
|
|
175
|
+
["setx", key, value],
|
|
176
|
+
capture_output=True, text=True
|
|
177
|
+
)
|
|
178
|
+
if result.returncode == 0:
|
|
179
|
+
log(f" [env] Set {key} (Windows registry)")
|
|
180
|
+
else:
|
|
181
|
+
log(f" [env] Warning: Failed to set {key}: {result.stderr.strip()}")
|
|
182
|
+
log("[env] Restart terminal/ComfyUI for changes to take effect")
|
|
183
|
+
|
|
184
|
+
elif system == "Darwin": # macOS
|
|
185
|
+
# macOS: launchctl for GUI apps + zshrc for terminal
|
|
186
|
+
for key, value in env_vars.items():
|
|
187
|
+
subprocess.run(["launchctl", "setenv", key, value], capture_output=True)
|
|
188
|
+
log(f" [env] Set {key} (launchctl)")
|
|
189
|
+
|
|
190
|
+
# Also add to zshrc for terminal (zsh is default on macOS)
|
|
191
|
+
_add_to_shell_profile(env_vars, log)
|
|
192
|
+
|
|
193
|
+
else: # Linux
|
|
194
|
+
_add_to_shell_profile(env_vars, log)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _add_to_shell_profile(
|
|
198
|
+
env_vars: dict,
|
|
199
|
+
log: Callable[[str], None],
|
|
200
|
+
) -> None:
|
|
201
|
+
"""Add env vars to shell profile (Linux/macOS)."""
|
|
202
|
+
import os
|
|
203
|
+
from pathlib import Path
|
|
204
|
+
|
|
205
|
+
# Determine shell profile
|
|
206
|
+
shell = os.environ.get("SHELL", "/bin/bash")
|
|
207
|
+
if "zsh" in shell:
|
|
208
|
+
rc_file = Path.home() / ".zshrc"
|
|
209
|
+
else:
|
|
210
|
+
rc_file = Path.home() / ".bashrc"
|
|
211
|
+
|
|
212
|
+
profile_file = Path.home() / ".comfy-env-profile"
|
|
213
|
+
|
|
214
|
+
# Write env vars to our dedicated file
|
|
215
|
+
with open(profile_file, "w") as f:
|
|
216
|
+
f.write("# Generated by comfy-env - do not edit manually\n")
|
|
217
|
+
for key, value in env_vars.items():
|
|
218
|
+
f.write(f'export {key}="{value}"\n')
|
|
219
|
+
log(f" [env] Wrote {profile_file}")
|
|
220
|
+
|
|
221
|
+
# Add source line to shell rc (only once)
|
|
222
|
+
source_line = f'source "{profile_file}"'
|
|
223
|
+
existing = rc_file.read_text() if rc_file.exists() else ""
|
|
224
|
+
|
|
225
|
+
if source_line not in existing and str(profile_file) not in existing:
|
|
226
|
+
with open(rc_file, "a") as f:
|
|
227
|
+
f.write(f'\n# comfy-env environment variables\n')
|
|
228
|
+
f.write(f'{source_line}\n')
|
|
229
|
+
log(f" [env] Added source line to {rc_file}")
|
|
230
|
+
else:
|
|
231
|
+
log(f" [env] Already configured in {rc_file}")
|
|
232
|
+
|
|
233
|
+
log("[env] Restart terminal/ComfyUI for changes to take effect")
|
|
234
|
+
|
|
235
|
+
|
|
72
236
|
def _install_node_dependencies(
|
|
73
237
|
node_reqs: List[NodeReq],
|
|
74
238
|
node_dir: Path,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: comfy-env
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.74
|
|
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,7 +1,7 @@
|
|
|
1
1
|
comfy_env/__init__.py,sha256=s0RkyKsBlDiSI4ZSwivtWLvYhc8DS0CUEWgFLVJbtLA,2176
|
|
2
2
|
comfy_env/cli.py,sha256=ty4HYlzollCUCS0o6Sha6eczPAsW_gHRVgvck3IfA2w,12723
|
|
3
3
|
comfy_env/errors.py,sha256=q-C3vyrPa_kk_Ao8l17mIGfJiG2IR0hCFV0GFcNLmcI,9924
|
|
4
|
-
comfy_env/install.py,sha256=
|
|
4
|
+
comfy_env/install.py,sha256=N7eBj8wB2DrGepVYk-Hks2mSf6UuGzj34pfVLNYJgQ4,10357
|
|
5
5
|
comfy_env/nodes.py,sha256=nBkG2pESeOt5kXSgTDIHAHaVdHK8-rEueR3BxXWn6TE,4354
|
|
6
6
|
comfy_env/prestartup.py,sha256=rP0TtT9lxiU7Py27U79Ew7954VpHsYL6lfx4IpQY1Uc,3152
|
|
7
7
|
comfy_env/config/__init__.py,sha256=4Guylkb-FV8QxhFwschzpzbr2eu8y-KNgNT3_JOm9jc,403
|
|
@@ -25,8 +25,8 @@ comfy_env/workers/base.py,sha256=4ZYTaQ4J0kBHCoO_OfZnsowm4rJCoqinZUaOtgkOPbw,230
|
|
|
25
25
|
comfy_env/workers/mp.py,sha256=d6PFVrgqp3MK7Gkt08a8LQD_VSwHtoIcGx2Lovou3vM,25972
|
|
26
26
|
comfy_env/workers/subprocess.py,sha256=UMhKhaJoSjv2-FWnwQq9TeMWtaDLIs3ajAFTq1ngdJw,57844
|
|
27
27
|
comfy_env/workers/tensor_utils.py,sha256=TCuOAjJymrSbkgfyvcKtQ_KbVWTqSwP9VH_bCaFLLq8,6409
|
|
28
|
-
comfy_env-0.0.
|
|
29
|
-
comfy_env-0.0.
|
|
30
|
-
comfy_env-0.0.
|
|
31
|
-
comfy_env-0.0.
|
|
32
|
-
comfy_env-0.0.
|
|
28
|
+
comfy_env-0.0.74.dist-info/METADATA,sha256=rmFALPp_CocGIiAe5vF03FMHrJvFtrSt27UhPGVmmUc,6946
|
|
29
|
+
comfy_env-0.0.74.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
30
|
+
comfy_env-0.0.74.dist-info/entry_points.txt,sha256=J4fXeqgxU_YenuW_Zxn_pEL7J-3R0--b6MS5t0QmAr0,49
|
|
31
|
+
comfy_env-0.0.74.dist-info/licenses/LICENSE,sha256=E68QZMMpW4P2YKstTZ3QU54HRQO8ecew09XZ4_Vn870,1093
|
|
32
|
+
comfy_env-0.0.74.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|