Team Ai
Apppublic

Nymbo/self-hosted-python

sourceHugging Faceupdated 9d agoView on Hugging Face
1likes
pyodide.d.ts64 linesDownload Raw Back to root
1/**2 * Load the main Pyodide wasm module and initialize it.3 *4 * Only one copy of Pyodide can be loaded in a given JavaScript global scope5 * because Pyodide uses global variables to load packages. If an attempt is made6 * to load a second copy of Pyodide, :any:`loadPyodide` will throw an error.7 * (This can be fixed once `Firefox adopts support for ES6 modules in webworkers8 * <https://bugzilla.mozilla.org/show_bug.cgi?id=1247687>`_.)9 *10 * @param {string} config.indexURL - The URL from which Pyodide will load11 * packages12 * @param {string} config.homedir - The home directory which Pyodide will use inside virtual file system13 * Default: /home/pyodide14 * @param {boolean} config.fullStdLib - Load the full Python standard library.15 * Setting this to false excludes following modules: distutils.16 * Default: true17 * @param {undefined | function(): string} config.stdin - Override the standard input callback. Should ask the user for one line of input.18 * Default: undefined19 * @param {undefined | function(string)} config.stdout - Override the standard output callback.20 * Default: undefined21 * @param {undefined | function(string)} config.stderr - Override the standard error output callback.22 * Default: undefined23 * @returns The :ref:`js-api-pyodide` module.24 * @memberof globalThis25 * @async26 */27export function loadPyodide(config: any): Promise<{28    globals: import("./pyproxy.gen.js").PyProxy;29    FS: any;30    pyodide_py: import("./pyproxy.gen.js").PyProxy;31    version: string;32    loadPackage: typeof loadPackage;33    loadPackagesFromImports: typeof import("./api.js").loadPackagesFromImports;34    loadedPackages: any;35    isPyProxy: typeof import("./pyproxy.gen.js").isPyProxy;36    runPython: typeof import("./api.js").runPython;37    runPythonAsync: typeof import("./api.js").runPythonAsync;38    registerJsModule: typeof registerJsModule;39    unregisterJsModule: typeof import("./api.js").unregisterJsModule;40    setInterruptBuffer: typeof import("./api.js").setInterruptBuffer;41    checkInterrupt: typeof import("./api.js").checkInterrupt;42    toPy: typeof import("./api.js").toPy;43    pyimport: typeof import("./api.js").pyimport;44    unpackArchive: typeof import("./api.js").unpackArchive;45    registerComlink: typeof import("./api.js").registerComlink;46    PythonError: typeof import("./api.js").PythonError;47    PyBuffer: typeof import("./pyproxy.gen.js").PyBuffer;48}>;49export type PyProxy = import('./pyproxy.gen').PyProxy;50export type PyProxyWithLength = import('./pyproxy.gen').PyProxyWithLength;51export type PyProxyWithGet = import('./pyproxy.gen').PyProxyWithGet;52export type PyProxyWithSet = import('./pyproxy.gen').PyProxyWithSet;53export type PyProxyWithHas = import('./pyproxy.gen').PyProxyWithHas;54export type PyProxyIterable = import('./pyproxy.gen').PyProxyIterable;55export type PyProxyIterator = import('./pyproxy.gen').PyProxyIterator;56export type PyProxyAwaitable = import('./pyproxy.gen').PyProxyAwaitable;57export type PyProxyBuffer = import('./pyproxy.gen').PyProxyBuffer;58export type PyProxyCallable = import('./pyproxy.gen').PyProxyCallable;59export type Py2JsResult = import('./pyproxy.gen').Py2JsResult;60export type TypedArray = import('./pyproxy.gen').TypedArray;61export type PyBuffer = import('./pyproxy.gen').PyBuffer;62import { loadPackage } from "./load-pyodide.js";63import { registerJsModule } from "./api.js";64