MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / get_env

Function get_env

ui/easydiffusion/backends/webui.py:218–319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

216
217
218def get_env():
219 dir = os.path.abspath(SYSTEM_DIR)
220
221 if not os.path.exists(dir):
222 raise RuntimeError("The system folder is missing!")
223
224 config = getConfig()
225 backend_config = config.get("backend_config") or {}
226 models_dir = config.get("models_dir", os.path.join(ROOT_DIR, "models"))
227 models_dir = models_dir.rstrip("/\\")
228
229 common_cli_args = get_common_cli_args()
230
231 env_entries = {
232 "PATH": [
233 f"{dir}",
234 f"{dir}/bin",
235 f"{dir}/Library/bin",
236 f"{dir}/Scripts",
237 f"{dir}/usr/bin",
238 ],
239 "PYTHONPATH": [
240 f"{dir}",
241 f"{dir}/lib/site-packages",
242 f"{dir}/lib/python3.10/site-packages",
243 ],
244 "PYTHONHOME": [],
245 "PY_LIBS": [
246 f"{dir}/Scripts/Lib",
247 f"{dir}/Scripts/Lib/site-packages",
248 f"{dir}/lib",
249 f"{dir}/lib/python3.10/site-packages",
250 ],
251 "PY_PIP": [f"{dir}/Scripts", f"{dir}/bin"],
252 "PIP_INSTALLER_LOCATION": [], # [f"{dir}/python/get-pip.py"],
253 "TRANSFORMERS_CACHE": [f"{dir}/transformers-cache"],
254 "HF_HUB_DISABLE_SYMLINKS_WARNING": ["true"],
255 "COMMANDLINE_ARGS": [
256 f'--api --models-dir "{models_dir}" --skip-torch-cuda-test --disable-gpu-warning {common_cli_args}'
257 ],
258 "SKIP_VENV": ["1"],
259 "SD_WEBUI_RESTARTING": ["1"],
260 }
261
262 if OS_NAME == "Windows":
263 env_entries["PATH"].append("C:/Windows/System32")
264 env_entries["PATH"].append("C:/Windows/System32/wbem")
265 env_entries["PYTHONNOUSERSITE"] = ["1"]
266 env_entries["PYTHON"] = [f"{dir}/python"]
267 env_entries["GIT"] = [f"{dir}/Library/bin/git"]
268 else:
269 env_entries["PATH"].append("/bin")
270 env_entries["PATH"].append("/usr/bin")
271 env_entries["PATH"].append("/usr/sbin")
272 env_entries["PYTHONNOUSERSITE"] = ["y"]
273 env_entries["PYTHON"] = [f"{dir}/bin/python"]
274 env_entries["GIT"] = [f"{dir}/bin/git"]
275 env_entries["venv_dir"] = ["-"]

Callers 3

install_backendFunction · 0.85
start_backendFunction · 0.85
is_installedFunction · 0.85

Calls 5

getConfigFunction · 0.90
get_common_cli_argsFunction · 0.90
getMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected