MCPcopy Create free account
hub / github.com/vercel/vercel / getMultiServicePythonRunner

Function getMultiServicePythonRunner

packages/python/src/start-dev-server.ts:559–588  ·  view source on GitHub ↗
(
  workPath: string,
  env: NodeJS.ProcessEnv,
  systemPython: string,
  uvPath: string | null
)

Source from the content-addressed store, hash-verified

557}
558
559async function getMultiServicePythonRunner(
560 workPath: string,
561 env: NodeJS.ProcessEnv,
562 systemPython: string,
563 uvPath: string | null
564): Promise<PythonRunner> {
565 // Use an existing .venv/venv if present and allowed (single Python service in a project).
566 const { pythonCmd, venvRoot } = useVirtualEnv(workPath, env, systemPython);
567 if (venvRoot) {
568 debug(`Using existing virtualenv at ${venvRoot} for multi-service dev`);
569 return { command: pythonCmd, args: [] };
570 }
571
572 // Create a per-service .venv, so deps are managed separately.
573 const venvPath = join(workPath, '.venv');
574 await ensureVenv({
575 pythonVersion: { pythonPath: systemPython },
576 venvPath,
577 uvPath,
578 quiet: true,
579 });
580 debug(`Created virtualenv at ${venvPath} for multi-service dev`);
581
582 const pythonBin = getVenvPythonBin(venvPath);
583 const binDir = getVenvBinDir(venvPath);
584 env.VIRTUAL_ENV = venvPath;
585 env.PATH = `${binDir}${delimiter}${env.PATH || ''}`;
586
587 return { command: pythonBin, args: [] };
588}
589
590export const startDevServer: StartDevServer = async opts => {
591 const {

Callers 1

startDevServerFunction · 0.85

Calls 5

useVirtualEnvFunction · 0.90
debugFunction · 0.90
ensureVenvFunction · 0.90
getVenvPythonBinFunction · 0.90
getVenvBinDirFunction · 0.90

Tested by

no test coverage detected