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

Function loadPythonManifest

packages/python-analysis/src/manifest/package.ts:422–468  ·  view source on GitHub ↗
(
  root: AbsPath,
  prefix: RelPath
)

Source from the content-addressed store, hash-verified

420}
421
422async function loadPythonManifest(
423 root: AbsPath,
424 prefix: RelPath
425): Promise<PythonManifest | null> {
426 let manifest: PythonManifest | null = null;
427 const pyproject = await maybeLoadPyProjectToml(root, prefix);
428 if (pyproject != null) {
429 manifest = pyproject;
430 manifest.isRoot = pyproject.data.tool?.uv?.workspace !== undefined;
431 } else {
432 // Prefer Pipfile.lock over Pipfile if both exist, because the lockfile
433 // contains exact pinned versions and is more reliable for reproducibility.
434 const pipfileLockPyProject = await maybeLoadPipfileLock(root, prefix);
435 if (pipfileLockPyProject != null) {
436 manifest = pipfileLockPyProject;
437 manifest.isRoot = true;
438 } else {
439 const pipfilePyProject = await maybeLoadPipfile(root, prefix);
440 if (pipfilePyProject != null) {
441 manifest = pipfilePyProject;
442 manifest.isRoot = true;
443 } else {
444 // Try various requirements*.{txt|in}
445 for (const fileName of [
446 'requirements.frozen.txt',
447 'requirements-frozen.txt',
448 'requirements.txt',
449 'requirements.in',
450 path.join('requirements', 'prod.txt'),
451 ]) {
452 const requirementsTxtManifest = await maybeLoadRequirementsTxt(
453 root,
454 prefix,
455 fileName
456 );
457 if (requirementsTxtManifest != null) {
458 manifest = requirementsTxtManifest;
459 manifest.isRoot = true;
460 break;
461 }
462 }
463 }
464 }
465 }
466
467 return manifest;
468}
469
470/**
471 * Check for lock files in the given directory.

Callers 1

discoverPythonPackageFunction · 0.85

Calls 5

maybeLoadPyProjectTomlFunction · 0.85
maybeLoadPipfileLockFunction · 0.85
maybeLoadPipfileFunction · 0.85
maybeLoadRequirementsTxtFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected