* Install a Vercel-owned Python package into the build venv, resolving the * source in this order: env override → in-repo source (if present) → pinned * PyPI version. The in-repo branch lets monorepo `vercel build` runs (e.g. CI * on a Version Packages PR) avoid PyPI for a version that does not e
({
name,
pinned,
envOverride,
uv,
venvPath,
projectDir,
pipPlatformArgs,
}: {
name: 'vercel-runtime' | 'vercel-workers';
pinned: string;
envOverride: string | undefined;
uv: UvRunner;
venvPath: string;
projectDir: string;
pipPlatformArgs: string[];
})
| 443 | * on a Version Packages PR) avoid PyPI for a version that does not exist yet. |
| 444 | */ |
| 445 | async function installInjectedPackage({ |
| 446 | name, |
| 447 | pinned, |
| 448 | envOverride, |
| 449 | uv, |
| 450 | venvPath, |
| 451 | projectDir, |
| 452 | pipPlatformArgs, |
| 453 | }: { |
| 454 | name: 'vercel-runtime' | 'vercel-workers'; |
| 455 | pinned: string; |
| 456 | envOverride: string | undefined; |
| 457 | uv: UvRunner; |
| 458 | venvPath: string; |
| 459 | projectDir: string; |
| 460 | pipPlatformArgs: string[]; |
| 461 | }): Promise<void> { |
| 462 | const localDir = join(__dirname, '..', '..', '..', 'python', name); |
| 463 | const isLocalDev = fs.existsSync(join(localDir, 'pyproject.toml')); |
| 464 | const dep = envOverride || (isLocalDev ? localDir : pinned); |
| 465 | // override exclude-newer, since we want vercel-runtime updates to |
| 466 | // take effect immediately after release |
| 467 | const noExclude = ['--exclude-newer-package', `${name}=false`]; |
| 468 | debug(`Installing ${dep}`); |
| 469 | await uv.pip({ |
| 470 | venvPath, |
| 471 | projectDir, |
| 472 | args: [ |
| 473 | 'install', |
| 474 | '--link-mode', |
| 475 | 'copy', |
| 476 | ...pipPlatformArgs, |
| 477 | ...noExclude, |
| 478 | dep, |
| 479 | ], |
| 480 | }); |
| 481 | } |
| 482 | |
| 483 | export const build: BuildVX = async ({ |
| 484 | workPath, |
no test coverage detected