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

Function maybeLoadPipfileLock

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

Source from the content-addressed store, hash-verified

597}
598
599async function maybeLoadPipfileLock(
600 root: AbsPath,
601 subdir: RelPath
602): Promise<PythonManifest | null> {
603 const pipfileLockRelPath = path.join(subdir, 'Pipfile.lock');
604 const pipfileLockPath = path.join(root, pipfileLockRelPath);
605 let pipfileLock: PipfileLockLike | null;
606 try {
607 pipfileLock = await readConfigIfExists(
608 pipfileLockPath,
609 PipfileLockLikeSchema,
610 '.json'
611 );
612 } catch (error: unknown) {
613 if (error instanceof PythonAnalysisError) {
614 error.path = pipfileLockRelPath;
615 throw error;
616 }
617 throw new PythonAnalysisError({
618 message: `could not parse Pipfile.lock: ${error instanceof Error ? error.message : String(error)}`,
619 code: 'PYTHON_PIPFILE_LOCK_PARSE_ERROR',
620 path: pipfileLockRelPath,
621 });
622 }
623
624 if (pipfileLock == null) {
625 return null;
626 }
627
628 const pyproject = convertPipfileLockToPyprojectToml(pipfileLock);
629
630 return {
631 path: pipfileLockRelPath,
632 data: pyproject,
633 origin: {
634 kind: PythonManifestConvertedKind.PipfileLock,
635 path: pipfileLockRelPath,
636 },
637 };
638}
639
640async function maybeLoadRequirementsTxt(
641 root: AbsPath,

Callers 1

loadPythonManifestFunction · 0.85

Calls 3

readConfigIfExistsFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected