Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Pyodide to 0.27.2 #199

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
[submodule "packages/py-faicons"]
path = packages/py-faicons
url = https://github.com/posit-dev/py-faicons.git
[submodule "packages/plotnine"]
path = packages/plotnine
url = https://github.com/wch/plotnine.git
24 changes: 2 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

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

PYODIDE_VERSION = 0.26.3
PYODIDE_VERSION = 0.27.2
PYODIDE_DIST_FILENAME = pyodide-$(PYODIDE_VERSION).tar.bz2
DOWNLOAD_DIR = ./downloads
R_SHINY_VERSION = 1.9.1.8002
Expand All @@ -41,10 +41,6 @@ SHINY_WHEEL = shiny-$(SHINY_VERSION)-py3-none-any.whl
SHINYWIDGETS_WHEEL = shinywidgets-$(SHINYWIDGETS_VERSION)-py3-none-any.whl
FAICONS_WHEEL = faicons-$(FAICONS_VERSION)-py3-none-any.whl

# Hard code these versions for now
PLOTNINE_VERSION=0.0.0
PLOTNINE_WHEEL=plotnine-$(PLOTNINE_VERSION)-py3-none-any.whl

# libsass is built in gadenbuie/libsass-python
# NOTE: Update https://github.com/gadenbuie/libsass-python/blob/dev/.github/workflows/pyodide.yml
# Pyodide, Emscripten, or Python versions change here.
Expand Down Expand Up @@ -97,13 +93,11 @@ submodules:
git submodule init
git submodule update --depth=20
cd packages/py-shiny && git fetch --tags --unshallow
cd packages/plotnine && git fetch --tags --unshallow

## Pull latest changes in git submodules
submodules-pull:
git submodule update --recursive --remote
cd packages/py-shiny && git fetch --tags
cd packages/plotnine && git fetch --tags
submodules-pull-shiny:
git submodule update --remote packages/py-shiny
cd packages/py-shiny && git fetch --tags
Expand Down Expand Up @@ -178,7 +172,6 @@ pyodide_packages_local: $(BUILD_DIR)/shinylive/pyodide/$(HTMLTOOLS_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(SHINY_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(SHINYWIDGETS_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(FAICONS_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(PLOTNINE_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(LIBSASS_WHEEL) \
$(BUILD_DIR)/shinylive/pyodide/$(POLARS_WHEEL)

Expand Down Expand Up @@ -206,11 +199,6 @@ $(BUILD_DIR)/shinylive/pyodide/$(FAICONS_WHEEL): $(PACKAGE_DIR)/$(FAICONS_WHEEL)
rm -f $(BUILD_DIR)/shinylive/pyodide/faicons*.whl
cp $(PACKAGE_DIR)/$(FAICONS_WHEEL) $(BUILD_DIR)/shinylive/pyodide/$(FAICONS_WHEEL)

$(BUILD_DIR)/shinylive/pyodide/$(PLOTNINE_WHEEL): $(PACKAGE_DIR)/$(PLOTNINE_WHEEL)
mkdir -p $(BUILD_DIR)/shinylive/pyodide
rm -f $(BUILD_DIR)/shinylive/pyodide/plotnine*.whl
cp $(PACKAGE_DIR)/$(PLOTNINE_WHEEL) $(BUILD_DIR)/shinylive/pyodide/$(PLOTNINE_WHEEL)

$(BUILD_DIR)/shinylive/pyodide/$(LIBSASS_WHEEL): $(PACKAGE_DIR)/$(LIBSASS_WHEEL)
mkdir -p $(BUILD_DIR)/shinylive/pyodide
rm -f $(BUILD_DIR)/shinylive/pyodide/libsass*.whl
Expand Down Expand Up @@ -281,8 +269,7 @@ packages: clean-packages \
package-htmltools \
package-shiny \
package-shinywidgets \
package-faicons \
package-plotnine
package-faicons


package-htmltools: $(PACKAGE_DIR)/$(HTMLTOOLS_WHEEL)
Expand All @@ -293,8 +280,6 @@ package-shinywidgets: $(PACKAGE_DIR)/$(SHINYWIDGETS_WHEEL)

package-faicons: $(PACKAGE_DIR)/$(FAICONS_WHEEL)

package-plotnine: $(PACKAGE_DIR)/$(PLOTNINE_WHEEL)


$(PACKAGE_DIR)/$(HTMLTOOLS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-htmltools
# Remove any old copies of the package
Expand All @@ -317,11 +302,6 @@ $(PACKAGE_DIR)/$(FAICONS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/py-faicons
rm -f $(PACKAGE_DIR)/faicons*.whl
. $(PYBIN)/activate && cd $(PACKAGE_DIR)/py-faicons && make install && mv dist/*.whl ../

$(PACKAGE_DIR)/$(PLOTNINE_WHEEL): $(PYBIN) $(PACKAGE_DIR)/plotnine
rm -f $(PACKAGE_DIR)/plotnine*.whl
$(PYBIN)/pip install -e $(PACKAGE_DIR)/plotnine[build]
. $(PYBIN)/activate && cd $(PACKAGE_DIR)/plotnine && make dist && mv dist/*.whl ../$(PLOTNINE_WHEEL)

$(PACKAGE_DIR)/$(LIBSASS_WHEEL): $(PYBIN) $(PACKAGE_DIR)/$(LIBSASS_WHEEL)
rm -f $(PACKAGE_DIR)/libsass*.whl
curl --fail -L https://pkg.garrickadenbuie.com/libsass-python/$(LIBSASS_WHEEL) -o $(PACKAGE_DIR)/$(LIBSASS_WHEEL)
Expand Down
1 change: 0 additions & 1 deletion packages/plotnine
Submodule plotnine deleted from 64295e
35 changes: 17 additions & 18 deletions shinylive_lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,17 @@
},
"plotnine": {
"name": "plotnine",
"version": "0.10.1.post98+g64295e1a",
"filename": "plotnine-0.0.0-py3-none-any.whl",
"sha256": null,
"url": null,
"version": "0.14.5",
"filename": "plotnine-0.14.5-py3-none-any.whl",
"sha256": "4a8bc4360732dd69a0263def4abab285ed8f0f4386186f1e44c642f2cea79b88",
"url": "https://files.pythonhosted.org/packages/4d/c5/7cfda7ba9fa02243367fbfb4880b6de8039266f22c47c2dbbd39b6adc46f/plotnine-0.14.5-py3-none-any.whl",
"depends": [
{"name": "matplotlib", "specs": [[">=", "3.5.0"]]},
{"name": "mizani", "specs": [[">=", "0.8.1"]]},
{"name": "numpy", "specs": [[">=", "1.23.0"]]},
{"name": "pandas", "specs": [[">=", "1.3.5"]]},
{"name": "patsy", "specs": [[">=", "0.5.1"]]},
{"name": "scipy", "specs": [[">=", "1.5.0"]]},
{"name": "statsmodels", "specs": [[">=", "0.13.2"]]}
{"name": "matplotlib", "specs": [[">=", "3.8.0"]]},
{"name": "pandas", "specs": [[">=", "2.2.0"]]},
{"name": "mizani", "specs": [["~=", "0.13.0"]]},
{"name": "numpy", "specs": [[">=", "1.23.5"]]},
{"name": "scipy", "specs": [[">=", "1.8.0"]]},
{"name": "statsmodels", "specs": [[">=", "0.14.0"]]}
],
"imports": [
"plotnine"
Expand Down Expand Up @@ -325,14 +324,14 @@
},
"mizani": {
"name": "mizani",
"version": "0.11.4",
"filename": "mizani-0.11.4-py3-none-any.whl",
"sha256": "5b6271dc3da2c88694dca2e0e0a7e1879f0e2fb046c789776f54d090a5243735",
"url": "https://files.pythonhosted.org/packages/2a/11/f3777ad46c5d92e3ead121c22ea45fafb6c3b2c1edca0c0c6494969c125c/mizani-0.11.4-py3-none-any.whl",
"version": "0.13.1",
"filename": "mizani-0.13.1-py3-none-any.whl",
"sha256": "7da0dcacd43fbcc01c279ea06a76f1f064ae90dbb387c4a985ba24a92d3c7d7a",
"url": "https://files.pythonhosted.org/packages/29/85/16e17e75831ec01808c5f07e578f1552df87a4f5c827caa8be28f97b4c19/mizani-0.13.1-py3-none-any.whl",
"depends": [
{"name": "numpy", "specs": [[">=", "1.23.0"]]},
{"name": "scipy", "specs": [[">=", "1.7.0"]]},
{"name": "pandas", "specs": [[">=", "2.1.0"]]},
{"name": "numpy", "specs": [[">=", "1.23.5"]]},
{"name": "scipy", "specs": [[">=", "1.8.0"]]},
{"name": "pandas", "specs": [[">=", "2.2.0"]]},
{"name": "tzdata", "specs": []}
],
"imports": [
Expand Down
7 changes: 1 addition & 6 deletions shinylive_requirements.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
"version": "latest",
"comment": "Needed to suppress warning from shiny/ui/_markdown.py."
},
{
"name": "plotnine",
"source": "local",
"version": "latest",
"comment": "Fixed version needed to avoid problem with mizani calling zoneinfo.ZoneInfo('UTC')."
},
{ "name": "plotnine", "source": "pypi", "version": "latest" },
{ "name": "plotly", "source": "pypi", "version": "latest" },
{ "name": "seaborn", "source": "pypi", "version": "latest" },
{ "name": "ipywidgets", "source": "pypi", "version": "latest" },
Expand Down
5 changes: 4 additions & 1 deletion src/pyodide/ffi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,11 @@ declare class PythonError extends Error {
constructor(type: string, message: string, error_address: number);
}
/**
* See :ref:`js-api-pyodide-ffi`
* Foreign function interface classes. Can be used for typescript type
* annotations or at runtime for `instanceof` checks.
* @summaryLink :ref:`ffi <js-api-pyodide-ffi>`
* @hidetype
* @omitFromAutoModule
*/
declare const ffi: {
PyProxy: typeof PyProxy;
Expand Down
123 changes: 92 additions & 31 deletions src/pyodide/pyodide.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,75 @@ declare function setStderr(options?: {
}): void;
/** @deprecated Use `import type { TypedArray } from "pyodide/ffi"` instead */
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
type FSNode = {
timestamp: number;
rdev: number;
contents: Uint8Array;
mode: number;
};
type FSStream = {
tty?: boolean;
seekable?: boolean;
stream_ops: FSStreamOps;
node: FSNode;
};
type FSStreamOps = FSStreamOpsGen<FSStream>;
type FSStreamOpsGen<T> = {
open: (a: T) => void;
close: (a: T) => void;
fsync: (a: T) => void;
read: (a: T, b: Uint8Array, offset: number, length: number, pos: number) => number;
write: (a: T, b: Uint8Array, offset: number, length: number, pos: number) => number;
};
interface FS {
unlink: (path: string) => void;
mkdirTree: (path: string, mode?: number) => void;
chdir: (path: string) => void;
symlink: (target: string, src: string) => FSNode;
createDevice: ((parent: string, name: string, input?: (() => number | null) | null, output?: ((code: number) => void) | null) => FSNode) & {
major: number;
};
closeStream: (fd: number) => void;
open: (path: string, flags: string | number, mode?: number) => FSStream;
makedev: (major: number, minor: number) => number;
mkdev: (path: string, dev: number) => FSNode;
filesystems: any;
stat: (path: string, dontFollow?: boolean) => any;
readdir: (path: string) => string[];
isDir: (mode: number) => boolean;
isMountpoint: (mode: FSNode) => boolean;
lookupPath: (path: string, options?: {
follow_mount?: boolean;
}) => {
node: FSNode;
};
isFile: (mode: number) => boolean;
writeFile: (path: string, contents: any, o?: {
canOwn?: boolean;
}) => void;
chmod: (path: string, mode: number) => void;
utime: (path: string, atime: number, mtime: number) => void;
rmdir: (path: string) => void;
mount: (type: any, opts: any, mountpoint: string) => any;
write: (stream: FSStream, buffer: any, offset: number, length: number, position?: number) => number;
close: (stream: FSStream) => void;
ErrnoError: {
new (errno: number): Error;
};
registerDevice<T>(dev: number, ops: FSStreamOpsGen<T>): void;
syncfs(dir: boolean, oncomplete: (val: void) => void): void;
findObject(a: string, dontResolveLastLink?: boolean): any;
readFile(a: string): Uint8Array;
}
type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
interface PackageData {
name: string;
version: string;
fileName: string;
/** @experimental */
packageType: PackageType;
}
type LoadedPackages = Record<string, string>;
/** @deprecated Use `import type { PyProxy } from "pyodide/ffi"` instead */
interface PyProxy {
[x: string]: any;
Expand Down Expand Up @@ -977,19 +1046,6 @@ declare class PyBufferView {
*/
release(): void;
}
type PackageType = "package" | "cpython_module" | "shared_library" | "static_library";
interface PackageData {
name: string;
version: string;
fileName: string;
/** @experimental */
packageType: PackageType;
}
declare function loadPackage(names: string | PyProxy | Array<string>, options?: {
messageCallback?: (message: string) => void;
errorCallback?: (message: string) => void;
checkIntegrity?: boolean;
}): Promise<Array<PackageData>>;
declare class PythonError extends Error {
/**
* The address of the error we are wrapping. We may later compare this
Expand All @@ -1013,11 +1069,13 @@ declare class PyodideAPI {
/** @hidden */
static version: string;
/** @hidden */
static loadPackage: typeof loadPackage;
static loadPackage: (names: string | PyProxy | Array<string>, options?: {
messageCallback?: (message: string) => void;
errorCallback?: (message: string) => void;
checkIntegrity?: boolean;
}) => Promise<Array<PackageData>>;
/** @hidden */
static loadedPackages: {
[key: string]: string;
};
static loadedPackages: LoadedPackages;
/** @hidden */
static ffi: {
PyProxy: typeof PyProxy;
Expand Down Expand Up @@ -1069,7 +1127,7 @@ declare class PyodideAPI {
* are available as members of ``FS.filesystems``:
* ``IDBFS``, ``NODEFS``, ``PROXYFS``, ``WORKERFS``.
*/
static FS: any;
static FS: FS;
/**
* An alias to the `Emscripten Path API
* <https://github.com/emscripten-core/emscripten/blob/main/src/library_path.js>`_.
Expand All @@ -1079,8 +1137,9 @@ declare class PyodideAPI {
*/
static PATH: any;
/**
* See :ref:`js-api-pyodide-canvas`.
* @hidetype
* APIs to set a canvas for rendering graphics.
* @summaryLink :ref:`canvas <js-api-pyodide-canvas>`
* @omitFromAutoModule
*/
static canvas: CanvasInterface;
/**
Expand Down Expand Up @@ -1119,7 +1178,6 @@ declare class PyodideAPI {
* (optional)
* @param options.checkIntegrity If true, check the integrity of the downloaded
* packages (default: true)
* @async
*/
static loadPackagesFromImports(code: string, options?: {
messageCallback?: (message: string) => void;
Expand Down Expand Up @@ -1203,7 +1261,6 @@ declare class PyodideAPI {
* traceback for any exception that is thrown will show source lines
* (unless the given file name starts with ``<`` and ends with ``>``).
* @returns The result of the Python code translated to JavaScript.
* @async
*/
static runPythonAsync(code: string, options?: {
globals?: PyProxy;
Expand Down Expand Up @@ -1385,7 +1442,14 @@ declare class PyodideAPI {
* @returns The old value of the debug flag.
*/
static setDebug(debug: boolean): boolean;
static makeMemorySnapshot(): Uint8Array;
/**
*
* @param param0
* @returns
*/
static makeMemorySnapshot({ serializer, }?: {
serializer?: (obj: any) => any;
}): Uint8Array;
}
/** @hidden */
export type PyodideInterface = typeof PyodideAPI;
Expand All @@ -1412,13 +1476,12 @@ type ConfigType = {
_makeSnapshot: boolean;
enableRunUntilComplete: boolean;
checkAPIVersion: boolean;
BUILD_ID: string;
};
/**
* Load the main Pyodide wasm module and initialize it.
*
* @returns The :ref:`js-api-pyodide` module.
* @memberof globalThis
* @async
* @example
* async function main() {
* const pyodide = await loadPyodide({
Expand Down Expand Up @@ -1547,14 +1610,12 @@ export declare function loadPyodide(options?: {
* @ignore
*/
_node_mounts?: string[];
/**
* @ignore
*/
/** @ignore */
_makeSnapshot?: boolean;
/**
* @ignore
*/
/** @ignore */
_loadSnapshot?: Uint8Array | ArrayBuffer | PromiseLike<Uint8Array | ArrayBuffer>;
/** @ignore */
_snapshotDeserializer?: (obj: any) => any;
}): Promise<PyodideInterface>;

export type {};
Expand Down
Loading