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

Function prepareCache

packages/python/src/index.ts:1327–1352  ·  view source on GitHub ↗
({
  repoRootPath,
  workPath,
})

Source from the content-addressed store, hash-verified

1325export { startDevServer };
1326
1327export const prepareCache: PrepareCache = async ({
1328 repoRootPath,
1329 workPath,
1330}) => {
1331 const root = repoRootPath || workPath;
1332 const ignore = ['**/*.pyc', '**/__pycache__/**'];
1333
1334 // Prune pre-built wheels from the uv cache (source-built wheels are retained).
1335 const uvCacheDir = getUvCacheDir(workPath);
1336 try {
1337 const uvPath = findUvInPath();
1338 if (uvPath) {
1339 const uv = new UvRunner(uvPath, uvCacheDir);
1340 await uv.cachePrune();
1341 }
1342 } catch {
1343 // best-effort; don't fail the build
1344 }
1345
1346 // Cache the uv package cache, the default venv, and any service-namespaced
1347 // venvs so that subsequent builds can skip dependency installation.
1348 return glob('**/.vercel/python/{.venv,services/*/.venv,cache/uv}/**', {
1349 cwd: root,
1350 ignore,
1351 });
1352};
1353
1354export const shouldServe: ShouldServe = opts => {
1355 const framework = opts.config.framework;

Callers 1

unit.test.tsFile · 0.90

Calls 4

cachePruneMethod · 0.95
getUvCacheDirFunction · 0.90
findUvInPathFunction · 0.90
globFunction · 0.90

Tested by

no test coverage detected