Skip to content

Commit cf8789c

Browse files
committed
Update to pyodide 0.27.7
1 parent 6faecf2 commit cf8789c

File tree

4 files changed

+47
-18
lines changed

4 files changed

+47
-18
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
SHINYLIVE_VERSION = $(shell node -p "require('./package.json').version")
1919

20-
PYODIDE_VERSION = 0.27.3
20+
PYODIDE_VERSION = 0.27.7
2121
PYODIDE_DIST_FILENAME = pyodide-$(PYODIDE_VERSION).tar.bz2
2222
DOWNLOAD_DIR = ./downloads
2323
R_SHINY_VERSION = 1.9.1.8002

src/pyodide/ffi.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ declare class PyProxy {
7171
* @param options
7272
* @return The JavaScript object resulting from the conversion.
7373
*/
74-
toJs({ depth, pyproxies, create_pyproxies, dict_converter, default_converter, }?: {
74+
toJs({ depth, pyproxies, create_pyproxies, dict_converter, default_converter, eager_converter, }?: {
7575
/** How many layers deep to perform the conversion. Defaults to infinite */
7676
depth?: number;
7777
/**
@@ -106,6 +106,15 @@ declare class PyProxy {
106106
* documentation of :meth:`~pyodide.ffi.to_js`.
107107
*/
108108
default_converter?: (obj: PyProxy, convert: (obj: PyProxy) => any, cacheConversion: (obj: PyProxy, result: any) => void) => any;
109+
/**
110+
* Optional callback to convert objects which gets called after ``str``,
111+
* ``int``, ``float``, ``bool``, ``None``, and ``JsProxy`` are converted but
112+
* *before* any default conversions are applied to standard data structures.
113+
*
114+
* Its arguments are the same as `dict_converter`.
115+
* See the documentation of :meth:`~pyodide.ffi.to_js`.
116+
*/
117+
eager_converter?: (obj: PyProxy, convert: (obj: PyProxy) => any, cacheConversion: (obj: PyProxy, result: any) => void) => any;
109118
}): any;
110119
}
111120
/**

src/pyodide/pyodide.d.ts

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ type FSNode = {
4444
mode: number;
4545
};
4646
type FSStream = {
47-
tty?: boolean;
47+
tty?: {
48+
ops: object;
49+
};
4850
seekable?: boolean;
4951
stream_ops: FSStreamOps;
5052
node: FSNode;
@@ -57,7 +59,7 @@ type FSStreamOpsGen<T> = {
5759
read: (a: T, b: Uint8Array, offset: number, length: number, pos: number) => number;
5860
write: (a: T, b: Uint8Array, offset: number, length: number, pos: number) => number;
5961
};
60-
interface FS {
62+
interface FSType {
6163
unlink: (path: string) => void;
6264
mkdirTree: (path: string, mode?: number) => void;
6365
chdir: (path: string) => void;
@@ -173,7 +175,7 @@ declare class PyProxy {
173175
* @param options
174176
* @return The JavaScript object resulting from the conversion.
175177
*/
176-
toJs({ depth, pyproxies, create_pyproxies, dict_converter, default_converter, }?: {
178+
toJs({ depth, pyproxies, create_pyproxies, dict_converter, default_converter, eager_converter, }?: {
177179
/** How many layers deep to perform the conversion. Defaults to infinite */
178180
depth?: number;
179181
/**
@@ -208,6 +210,15 @@ declare class PyProxy {
208210
* documentation of :meth:`~pyodide.ffi.to_js`.
209211
*/
210212
default_converter?: (obj: PyProxy, convert: (obj: PyProxy) => any, cacheConversion: (obj: PyProxy, result: any) => void) => any;
213+
/**
214+
* Optional callback to convert objects which gets called after ``str``,
215+
* ``int``, ``float``, ``bool``, ``None``, and ``JsProxy`` are converted but
216+
* *before* any default conversions are applied to standard data structures.
217+
*
218+
* Its arguments are the same as `dict_converter`.
219+
* See the documentation of :meth:`~pyodide.ffi.to_js`.
220+
*/
221+
eager_converter?: (obj: PyProxy, convert: (obj: PyProxy) => any, cacheConversion: (obj: PyProxy, result: any) => void) => any;
211222
}): any;
212223
}
213224
declare class PyProxyWithLength extends PyProxy {
@@ -1127,7 +1138,7 @@ declare class PyodideAPI {
11271138
* are available as members of ``FS.filesystems``:
11281139
* ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.
11291140
*/
1130-
static FS: FS;
1141+
static FS: FSType;
11311142
/**
11321143
* An alias to the `Emscripten Path API
11331144
* <https://github.com/emscripten-core/emscripten/blob/main/src/library_path.js>`_.
@@ -1467,8 +1478,11 @@ type ConfigType = {
14671478
stdout?: (msg: string) => void;
14681479
stderr?: (msg: string) => void;
14691480
jsglobals?: object;
1481+
_sysExecutable?: string;
14701482
args: string[];
1471-
_node_mounts: string[];
1483+
fsInit?: (FS: FSType, info: {
1484+
sitePackages: string;
1485+
}) => Promise<void>;
14721486
env: {
14731487
[key: string]: string;
14741488
};
@@ -1558,6 +1572,11 @@ export declare function loadPyodide(options?: {
15581572
* Default: ``globalThis``
15591573
*/
15601574
jsglobals?: object;
1575+
/**
1576+
* Determine the value of ``sys.executable``.
1577+
* @ignore
1578+
*/
1579+
_sysExecutable?: string;
15611580
/**
15621581
* Command line arguments to pass to Python on startup. See `Python command
15631582
* line interface options
@@ -1593,7 +1612,8 @@ export declare function loadPyodide(options?: {
15931612
*/
15941613
pyproxyToStringRepr?: boolean;
15951614
/**
1596-
* Make loop.run_until_complete() function correctly using stack switching
1615+
* Make loop.run_until_complete() function correctly using stack switching.
1616+
* Default: ``true``.
15971617
*/
15981618
enableRunUntilComplete?: boolean;
15991619
/**
@@ -1602,14 +1622,14 @@ export declare function loadPyodide(options?: {
16021622
*/
16031623
checkAPIVersion?: boolean;
16041624
/**
1605-
* Used by the cli runner. If we want to detect a virtual environment from
1606-
* the host file system, it needs to be visible from when `main()` is
1607-
* called. The directories in this list will be mounted at the same address
1608-
* into the Emscripten file system so that virtual environments work in the
1609-
* cli runner.
1610-
* @ignore
1625+
* This is a hook that allows modification of the file system before the
1626+
* main() function is called and the intereter is started. When this is
1627+
* called, it is guaranteed that there is an empty site-packages directory.
1628+
* @experimental
16111629
*/
1612-
_node_mounts?: string[];
1630+
fsInit?: (FS: FSType, info: {
1631+
sitePackages: string;
1632+
}) => Promise<void>;
16131633
/** @ignore */
16141634
_makeSnapshot?: boolean;
16151635
/** @ignore */

0 commit comments

Comments
 (0)