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

Function runCompileAll

packages/python/src/compileall.ts:59–85  ·  view source on GitHub ↗
({
  pythonBin,
  filesOrDirectories,
  env,
  excludeRegex,
}: CompileAllOptions)

Source from the content-addressed store, hash-verified

57 * Failures are logged but not surfaced to the user
58 */
59export async function runCompileAll({
60 pythonBin,
61 filesOrDirectories,
62 env,
63 excludeRegex,
64}: CompileAllOptions): Promise<void> {
65 if (filesOrDirectories.length === 0) return;
66
67 const args = [
68 '-m',
69 'compileall',
70 '-q',
71 '-j',
72 '0',
73 '-f',
74 '--invalidation-mode',
75 'unchecked-hash',
76 ...(excludeRegex ? ['-x', excludeRegex] : []),
77 ...filesOrDirectories,
78 ];
79
80 try {
81 await execa(pythonBin, args, { env: env || process.env });
82 } catch (err) {
83 debug(`compileall error details: ${JSON.stringify(err)}`);
84 }
85}
86
87/**
88 * Derive the expected `__pycache__` `.pyc` path for a given `.py` source

Callers 2

compileall.test.tsFile · 0.90

Calls 2

debugFunction · 0.90
execaFunction · 0.85

Tested by

no test coverage detected