MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / install_python_packages

Function install_python_packages

functions/function_calling/uv_related.py:200–222  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

198
199
200def 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
225def init_python_env(

Callers

nothing calls this directly

Calls 3

_validate_packagesFunction · 0.85
_run_uv_commandFunction · 0.85

Tested by

no test coverage detected