Environment Setup¶
environment
¶
Python environment and configuration provisioning — Steps 3-4.
Creates the Python virtual environment and copies the minimum configuration files needed for the rest of the install:
- venv creation (Step 3): tries
uvfirst (auto-downloads Python 3.11-3.13), falls back to system Python. - Provisioning (Step 4): copies
dependencies.jsonand the model catalog to the install directory.
setup_environment(install_path, install_type, log, *, python_constraint='>=3.11,<3.14')
¶
Create the Python virtual environment.
Strategy (in order):
uv venvwith Python auto-managed.- System conda (Miniconda/Anaconda) with a local prefix.
- System Python (detected via platform abstraction).
- Auto-install Python on Windows (if user agrees).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_path
|
Path
|
Root installation directory. |
required |
install_type
|
InstallType
|
:attr: |
required |
log
|
InstallerLogger
|
Installer logger for user-facing messages. |
required |
python_constraint
|
str
|
Python version constraint
(e.g. |
'>=3.11,<3.14'
|
Returns:
| Type | Description |
|---|---|
Path
|
Absolute path to the Python executable inside the environment. |
Raises:
| Type | Description |
|---|---|
InstallerFatalError
|
If no usable Python can be found or created. |
Source code in src/installer/environment.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
find_source_scripts()
¶
Locate the source scripts/ directory containing config files.
Search order:
- Wheel install: embedded
src.scriptspackage data (via :mod:importlib.resources) — self-contained wheel, no local checkout needed. - Editable install:
../../scripts/relative to this file (i.e. thescripts/directory at the project root). - CI / manual run:
Path.cwd() / "scripts"as a last resort.
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to the scripts directory, or |
Path | None
|
Callers are responsible for handling |
Source code in src/installer/environment.py
provision_scripts(install_path, log)
¶
Copy bootstrap config files to the install directory.
Only copies files listed in BOOTSTRAP_FILES (currently just
dependencies.json). Other configs like custom_nodes.json
are resolved on-demand by later steps from the source directory.
Also copies model_manifest.json to install_path/scripts/
so the model downloader can find it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_path
|
Path
|
Root installation directory. |
required |
log
|
InstallerLogger
|
Installer logger for user-facing messages. |
required |
Source code in src/installer/environment.py
load_tools_manifest(install_path)
¶
Load tools_manifest.json from the install scripts directory.
Returns the parsed JSON as a dict, or an empty dict if the file is not found or unparseable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_path
|
Path
|
Root installation directory. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Parsed manifest dict (or empty dict on failure). |
Source code in src/installer/environment.py
lookup_wheel_checksum(manifest, wheel_url)
¶
Look up the SHA-256 checksum for a wheel from the tools manifest.
Searches through all entries in the whl section for a matching
filename. Compares the path suffix (everything after the last
whl/ segment) to handle per-architecture subdirectories
(e.g. whl/sm89/sageattention-2.2.0-cp313-cp313-linux_x86_64.whl).
Falls back to basename-only comparison for backwards compatibility with manifests that don't use subdirectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
dict
|
Parsed |
required |
wheel_url
|
str
|
Full URL of the wheel to look up. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
SHA-256 hex digest string, or |