({
entrypointDir,
rootDir,
}: {
entrypointDir: string;
rootDir: string;
})
| 137 | * into NowBuildError with diagnostic logging. |
| 138 | */ |
| 139 | export 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 | |
| 170 | export type ManifestType = 'uv.lock' | 'pylock.toml' | 'pyproject.toml' | null; |
| 171 |
no test coverage detected