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

Function discoverPackage

packages/python/src/install.ts:139–168  ·  view source on GitHub ↗
({
  entrypointDir,
  rootDir,
}: {
  entrypointDir: string;
  rootDir: string;
})

Source from the content-addressed store, hash-verified

137 * into NowBuildError with diagnostic logging.
138 */
139export async function discoverPackage({
140 entrypointDir,
141 rootDir,
142}: {
143 entrypointDir: string;
144 rootDir: string;
145}): Promise<PythonPackage> {
146 try {
147 return await discoverPythonPackage({ entrypointDir, rootDir });
148 } catch (error: unknown) {
149 if (error instanceof PythonAnalysisError) {
150 if (
151 error.fileContent &&
152 (error.code.endsWith('_PARSE_ERROR') ||
153 error.code.endsWith('_VALIDATION_ERROR'))
154 ) {
155 console.log(
156 `Failed to parse "${error.path}". File content:\n${error.fileContent}`
157 );
158 }
159 throw new NowBuildError({
160 code: error.code,
161 message: error.message,
162 link: error.link,
163 action: error.action,
164 });
165 }
166 throw error;
167 }
168}
169
170export type ManifestType = 'uv.lock' | 'pylock.toml' | 'pyproject.toml' | null;
171

Callers 2

buildFunction · 0.90
syncDependenciesFunction · 0.90

Calls 2

discoverPythonPackageFunction · 0.90
logMethod · 0.45

Tested by

no test coverage detected