* Restore a previously cached uv.lock into the project directory so that * `uv lock` can validate it instead of re-resolving from PyPI. Only * restores when a cached file exists and no lock file is already present.
( cachedLockPath: string | undefined, projectDir: string )
| 26 | * restores when a cached file exists and no lock file is already present. |
| 27 | */ |
| 28 | async function restoreCachedLock( |
| 29 | cachedLockPath: string | undefined, |
| 30 | projectDir: string |
| 31 | ): Promise<void> { |
| 32 | if (!cachedLockPath) return; |
| 33 | const targetLockPath = join(projectDir, 'uv.lock'); |
| 34 | if (fs.existsSync(cachedLockPath) && !fs.existsSync(targetLockPath)) { |
| 35 | debug('Restoring cached uv.lock'); |
| 36 | await fs.promises.copyFile(cachedLockPath, targetLockPath); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | const makeDependencyCheckCode = (dependency: string) => ` |
| 41 | from importlib import util |
no test coverage detected