Install Python packages inside the workspace using uv add.
(
packages: Sequence[str],
*,
upgrade: bool = False,
# extra_args: Sequence[str] | None = None,
_context: Dict[str, Any] | None = None,
)
| 198 | |
| 199 | |
| 200 | def install_python_packages( |
| 201 | packages: Sequence[str], |
| 202 | *, |
| 203 | upgrade: bool = False, |
| 204 | # extra_args: Sequence[str] | None = None, |
| 205 | _context: Dict[str, Any] | None = None, |
| 206 | ) -> Dict[str, Any]: |
| 207 | """Install Python packages inside the workspace using uv add.""" |
| 208 | |
| 209 | ctx = WorkspaceCommandContext(_context) |
| 210 | safe_packages = _validate_packages(packages) |
| 211 | cmd: List[str] = ["uv", "add"] |
| 212 | if upgrade: |
| 213 | cmd.append("--upgrade") |
| 214 | |
| 215 | # if extra_args: |
| 216 | # flags = _validate_flag_args(extra_args) |
| 217 | # cmd.extend(flags) |
| 218 | |
| 219 | cmd.extend(safe_packages) |
| 220 | result = _run_uv_command(cmd, ctx.workspace_root, step="uv add") |
| 221 | # result["workspace_root"] = str(ctx.workspace_root) |
| 222 | return result |
| 223 | |
| 224 | |
| 225 | def init_python_env( |
nothing calls this directly
no test coverage detected