Packaging¶
packaging
¶
Centralized UV package management.
All Python package installations go through :func:uv_install.
No pip fallback — uv is required (the bootstrap downloads it).
Replaces all raw python -m pip install calls across the codebase.
UvNotFoundError
¶
Bases: RuntimeError
Raised when uv is not available on the system.
find_uv(install_path=None, python_exe=None)
¶
Find the uv executable.
Checks the local scripts/uv/ directory first (where the
bootstrap installs it), then falls back to the system PATH.
When install_path is not provided but python_exe is, the install root is derived from the venv Python path::
{install_path}/scripts/venv/Scripts/python.exe (Windows)
{install_path}/scripts/venv/bin/python (Linux)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
install_path
|
Path | None
|
Root install directory (e.g. |
None
|
python_exe
|
Path | None
|
Path to the venv Python executable. Used to auto-detect install_path when not explicitly given. |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
Absolute path to |
Source code in src/utils/packaging.py
uv_install(python_exe, packages=None, *, index_url=None, requirements=None, upgrade=False, no_build_isolation=False, no_deps=False, no_cache=False, editable=None, ignore_errors=False, timeout=600, log=None)
¶
Install Python packages via uv pip install.
Builds the full uv pip install command and delegates to
:func:~src.utils.commands.run_and_log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_exe
|
Path
|
Path to the target venv Python executable.
Passed as |
required |
packages
|
list[str] | None
|
Package specifiers to install (e.g. |
None
|
index_url
|
str | None
|
PyPI index URL override ( |
None
|
requirements
|
Path | None
|
Path to a |
None
|
upgrade
|
bool
|
If |
False
|
no_build_isolation
|
bool
|
If |
False
|
no_deps
|
bool
|
If |
False
|
no_cache
|
bool
|
If |
False
|
editable
|
Path | None
|
Path to install in editable mode ( |
None
|
ignore_errors
|
bool
|
Forwarded to :func: |
False
|
timeout
|
int
|
Command timeout in seconds. |
600
|
Returns:
| Type | Description |
|---|---|
CompletedProcess[str]
|
The completed process result. |
Raises:
| Type | Description |
|---|---|
UvNotFoundError
|
If |
CommandError
|
If the command fails and ignore_errors is False. |
Source code in src/utils/packaging.py
107 108 109 110 111 112 113 114 115 116 117 118 119 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 | |