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

Function checkUvBinaryVersion

packages/python/src/uv.ts:368–405  ·  view source on GitHub ↗
(uvPath: string)

Source from the content-addressed store, hash-verified

366 * or it's older than the minimum — uv is unusable in all of those cases.
367 */
368export function checkUvBinaryVersion(uvPath: string): string {
369 let output: string;
370 try {
371 output = execFileSync(uvPath, ['--version'], {
372 encoding: 'utf8',
373 stdio: ['pipe', 'pipe', 'pipe'],
374 shell: isWin,
375 }).trim();
376 } catch (err) {
377 throw new NowBuildError({
378 code: 'UV_ERROR',
379 link: 'https://vercel.link/python-version',
380 message: `Found uv at "${uvPath}" but could not run "uv --version": ${
381 err instanceof Error ? err.message : String(err)
382 }`,
383 });
384 }
385
386 // `uv --version` prints e.g. `uv 0.9.25 (<hash> <date>)`.
387 const found = semver.coerce(output);
388 if (!found) {
389 throw new NowBuildError({
390 code: 'UV_ERROR',
391 link: 'https://vercel.link/python-version',
392 message: `Could not determine the uv version from "${output}".`,
393 });
394 }
395
396 if (semver.lt(found, MIN_UV_VERSION)) {
397 throw new NowBuildError({
398 code: 'UV_VERSION_TOO_OLD',
399 link: 'https://vercel.link/python-version',
400 message: `Found uv ${found.version} at "${uvPath}", but Vercel requires uv ${MIN_UV_VERSION} or newer. Please upgrade uv: https://docs.astral.sh/uv/getting-started/installation/`,
401 });
402 }
403
404 return output;
405}
406
407export async function getUvBinaryOrInstall(
408 pythonPath: string

Callers 3

buildFunction · 0.90
startDevServerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected