* Check for lock files in the given directory. * Priority: uv.lock > pylock.toml (uv.lock is more common currently)
( root: AbsPath, subdir: RelPath )
| 472 | * Priority: uv.lock > pylock.toml (uv.lock is more common currently) |
| 473 | */ |
| 474 | async function maybeLoadLockFile( |
| 475 | root: AbsPath, |
| 476 | subdir: RelPath |
| 477 | ): Promise<PythonLockFile | undefined> { |
| 478 | // Check for uv.lock first (higher priority) |
| 479 | const uvLockRelPath = path.join(subdir, 'uv.lock'); |
| 480 | const uvLockPath = path.join(root, uvLockRelPath); |
| 481 | const uvLockContent = await readFileTextIfExists(uvLockPath); |
| 482 | if (uvLockContent != null) { |
| 483 | return { path: uvLockRelPath, kind: PythonLockFileKind.UvLock }; |
| 484 | } |
| 485 | |
| 486 | // Check for pylock.toml (PEP 751 standard lock file) |
| 487 | const pylockRelPath = path.join(subdir, 'pylock.toml'); |
| 488 | const pylockPath = path.join(root, pylockRelPath); |
| 489 | const pylockContent = await readFileTextIfExists(pylockPath); |
| 490 | if (pylockContent != null) { |
| 491 | return { path: pylockRelPath, kind: PythonLockFileKind.PylockToml }; |
| 492 | } |
| 493 | |
| 494 | return undefined; |
| 495 | } |
| 496 | |
| 497 | async function maybeLoadPyProjectToml( |
| 498 | root: AbsPath, |
no test coverage detected