( root: AbsPath, prefix: RelPath )
| 420 | } |
| 421 | |
| 422 | async 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. |
no test coverage detected