pyodide 0.26.0-alpha.2 → 0.26.0-alpha.3

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/console.html CHANGED
@@ -253,6 +253,39 @@
253
253
  if (searchParams.has("noblink")) {
254
254
  $(".cmd-cursor").addClass("noblink");
255
255
  }
256
+
257
+ let idbkvPromise;
258
+ async function getIDBKV() {
259
+ if (!idbkvPromise) {
260
+ idbkvPromise = await import(
261
+ "https://unpkg.com/idb-keyval@5.0.2/dist/esm/index.js"
262
+ );
263
+ }
264
+ return idbkvPromise;
265
+ }
266
+
267
+ async function mountDirectory(pyodideDirectory, directoryKey) {
268
+ if (pyodide.FS.analyzePath(pyodideDirectory).exists) {
269
+ return;
270
+ }
271
+ const { get, set } = await getIDBKV();
272
+ const opts = {
273
+ id: "mountdirid",
274
+ mode: "readwrite",
275
+ };
276
+ let directoryHandle = await get(directoryKey);
277
+ if (!directoryHandle) {
278
+ directoryHandle = await showDirectoryPicker(opts);
279
+ await set(directoryKey, directoryHandle);
280
+ }
281
+ const permissionStatus =
282
+ await directoryHandle.requestPermission(opts);
283
+ if (permissionStatus !== "granted") {
284
+ throw new Error("readwrite access to directory not granted");
285
+ }
286
+ await pyodide.mountNativeFS(pyodideDirectory, directoryHandle);
287
+ }
288
+ globalThis.mountDirectory = mountDirectory;
256
289
  }
257
290
  window.console_ready = main();
258
291
  </script>
package/ffi.d.ts CHANGED
@@ -996,7 +996,7 @@ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int
996
996
  * In order to reduce the risk of large memory leaks, the :js:class:`PythonError`
997
997
  * contains no reference to the Python exception that caused it. You can find
998
998
  * the actual Python exception that caused this error as
999
- * :py:data:`sys.last_value`.
999
+ * :py:data:`sys.last_exc`.
1000
1000
  *
1001
1001
  * See :ref:`type translations of errors <type-translations-errors>` for more
1002
1002
  * information.
@@ -1005,7 +1005,7 @@ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int
1005
1005
  * :class: warning
1006
1006
  *
1007
1007
  * If you make a :js:class:`~pyodide.ffi.PyProxy` of
1008
- * :py:data:`sys.last_value`, you should be especially careful to
1008
+ * :py:data:`sys.last_exc`, you should be especially careful to
1009
1009
  * :js:meth:`~pyodide.ffi.PyProxy.destroy` it when you are done. You may leak a large
1010
1010
  * amount of memory including the local variables of all the stack frames in
1011
1011
  * the traceback if you don't. The easiest way is to only handle the
@@ -1016,7 +1016,7 @@ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int
1016
1016
  declare class PythonError extends Error {
1017
1017
  /**
1018
1018
  * The address of the error we are wrapping. We may later compare this
1019
- * against sys.last_value.
1019
+ * against sys.last_exc.
1020
1020
  * WARNING: we don't own a reference to this pointer, dereferencing it
1021
1021
  * may be a use-after-free error!
1022
1022
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyodide",
3
- "version": "0.26.0-alpha.2",
3
+ "version": "0.26.0-alpha.3",
4
4
  "description": "The Pyodide JavaScript package",
5
5
  "keywords": [
6
6
  "python",
@@ -81,7 +81,7 @@
81
81
  "scripts": {
82
82
  "build": "tsc --noEmit && node esbuild.config.mjs",
83
83
  "test": "npm-run-all test:*",
84
- "test:unit": "cross-env TEST_NODE=1 ts-mocha --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*",
84
+ "test:unit": "cross-env TEST_NODE=1 ts-mocha --exit --node-option=experimental-loader=./test/loader.mjs --node-option=experimental-wasm-stack-switching -p tsconfig.test.json test/unit/**/*.test.*",
85
85
  "test:node": "cross-env TEST_NODE=1 mocha test/integration/**/*.test.js",
86
86
  "test:browser": "mocha test/integration/**/*.test.js",
87
87
  "tsc": "tsc --noEmit",