pyodide 0.19.0-alpha.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.js +13 -13
- package/package.json +1 -1
- package/pyodide.js +3 -3
package/api.js
CHANGED
|
@@ -285,26 +285,26 @@ export function toPy(obj, { depth = -1 } = {}) {
|
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
287
|
* Imports a module and returns it.
|
|
288
|
-
* Warning: this function has a completely different behavior than the old removed pyimport function!
|
|
289
|
-
* ``pyimport`` is roughly equivalent to:
|
|
290
288
|
*
|
|
291
|
-
* ..
|
|
289
|
+
* .. admonition:: Warning
|
|
290
|
+
* :class: warning
|
|
291
|
+
*
|
|
292
|
+
* This function has a completely different behavior than the old removed pyimport function!
|
|
293
|
+
*
|
|
294
|
+
* ``pyimport`` is roughly equivalent to:
|
|
295
|
+
*
|
|
296
|
+
* .. code-block:: js
|
|
292
297
|
*
|
|
293
298
|
* pyodide.runPython(`import ${pkgname}; ${pkgname}`);
|
|
294
299
|
*
|
|
295
|
-
*
|
|
296
|
-
* Example:
|
|
300
|
+
* except that the global namespace will not change.
|
|
297
301
|
*
|
|
298
|
-
*
|
|
302
|
+
* Example:
|
|
299
303
|
*
|
|
300
|
-
*
|
|
301
|
-
* let recursionLimit = sys.getrecursionlimit();
|
|
304
|
+
* .. code-block:: js
|
|
302
305
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* 2. load your Python package into the Pyodide (Emscripten) file system,
|
|
306
|
-
* 3. import the package with `let mypkg = pyodide.pyimport("mypkgname")`,
|
|
307
|
-
* 4. call into your package with `mypkg.some_api(some_args)`.
|
|
306
|
+
* let sysmodule = pyodide.pyimport("sys");
|
|
307
|
+
* let recursionLimit = sys.getrecursionlimit();
|
|
308
308
|
*
|
|
309
309
|
* @param {string} mod_name The name of the module to import
|
|
310
310
|
* @returns A PyProxy for the imported module
|
package/package.json
CHANGED
package/pyodide.js
CHANGED
|
@@ -104,20 +104,20 @@ Module.fatal_error = function (e) {
|
|
|
104
104
|
|
|
105
105
|
let runPythonInternal_dict; // Initialized in finalizeBootstrap
|
|
106
106
|
/**
|
|
107
|
-
* @private
|
|
108
107
|
* Just like `runPython` except uses a different globals dict and gets
|
|
109
108
|
* `eval_code` from `_pyodide` so that it can work before `pyodide` is imported.
|
|
109
|
+
* @private
|
|
110
110
|
*/
|
|
111
111
|
Module.runPythonInternal = function (code) {
|
|
112
112
|
return Module._pyodide._base.eval_code(code, runPythonInternal_dict);
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
|
-
* @private
|
|
117
116
|
* A proxy around globals that falls back to checking for a builtin if has or
|
|
118
117
|
* get fails to find a global with the given key. Note that this proxy is
|
|
119
118
|
* transparent to js2python: it won't notice that this wrapper exists at all and
|
|
120
119
|
* will translate this proxy to the globals dictionary.
|
|
120
|
+
* @private
|
|
121
121
|
*/
|
|
122
122
|
function wrapPythonGlobals(globals_dict, builtins_dict) {
|
|
123
123
|
return new Proxy(globals_dict, {
|
|
@@ -168,11 +168,11 @@ del importlib
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
|
-
* @private
|
|
172
171
|
* This function is called after the emscripten module is finished initializing,
|
|
173
172
|
* so eval_code is newly available.
|
|
174
173
|
* It finishes the bootstrap so that once it is complete, it is possible to use
|
|
175
174
|
* the core `pyodide` apis. (But package loading is not ready quite yet.)
|
|
175
|
+
* @private
|
|
176
176
|
*/
|
|
177
177
|
function finalizeBootstrap(config) {
|
|
178
178
|
// First make internal dict so that we can use runPythonInternal.
|