()
| 216 | const TypeshedPath = 'http://localhost:3001/static/typeshed/' |
| 217 | |
| 218 | async function main() { |
| 219 | const pyodide = await loadPyodide({ fullStdLib: true, indexURL: 'node_modules/pyodide' }) |
| 220 | await pyodide.loadPackage('micropip') |
| 221 | |
| 222 | const micropip = pyodide.pyimport('micropip') |
| 223 | await micropip.install(RequestsURL) |
| 224 | await micropip.install(StreamlitURL) |
| 225 | |
| 226 | const promises = [ |
| 227 | micropip.install('types-requests==2.28.1'), |
| 228 | micropip.install('numpy==1.23.5'), |
| 229 | micropip.install('pandas==1.5.2'), |
| 230 | micropip.install('pandas-stubs~=1.5.3'), |
| 231 | micropip.install('flask==2.3.3'), |
| 232 | ] |
| 233 | await Promise.all(promises) |
| 234 | |
| 235 | const structuredProgram = createStructuredProgramWorker(new PyodideFakeFileSystem(TypeshedPath, pyodide)) |
| 236 | |
| 237 | const moduleInfoFile: ModuleInfoFile = { |
| 238 | allModules: [], |
| 239 | } |
| 240 | |
| 241 | fs.rmSync('./packages/language-python/tray', { recursive: true }) |
| 242 | fs.mkdirSync('./packages/language-python/tray') |
| 243 | |
| 244 | for (const module of supportedStandardLibModules) { |
| 245 | const moduleInfo = await generateTrayListForModule(structuredProgram, module, true) |
| 246 | moduleInfoFile.allModules.push(moduleInfo) |
| 247 | } |
| 248 | |
| 249 | for (const module of ['requests', 'streamlit', 'pandas', 'numpy', 'flask']) { |
| 250 | const moduleInfo = await generateTrayListForModule(structuredProgram, module, false) |
| 251 | moduleInfoFile.allModules.push(moduleInfo) |
| 252 | } |
| 253 | |
| 254 | fs.writeFileSync('./packages/language-python/src/standard_lib_modules.json', JSON.stringify(moduleInfoFile, null, 2)) |
| 255 | } |
| 256 | |
| 257 | async function generateTrayListForModule( |
| 258 | structuredProgram: StructuredEditorProgram, |
no test coverage detected