Skip to content

Commit

Permalink
Update Pyodide to 0.26.0 (#934)
Browse files Browse the repository at this point in the history
* Update Pyodide to 0.26.0

* Set Python version as 3.12.1

* Set Python version in packages/kernel/py/stlite-server/pyproject.toml

* Update .gitignore

* Specify engines.node in desktop/package.json and remove node-fetch

* Fix the Python version in gh-pages.yml

* Fix worker-runtime to handle LiteralMap, which was introduced in Pyodide 0.26.0
  • Loading branch information
whitphx authored May 29, 2024
1 parent 176a2a4 commit 3dd1209
Show file tree
Hide file tree
Showing 17 changed files with 801 additions and 775 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
target: ["mountable"]

env:
python-version: "3.11.2"
python-version: "3.12.1"
# To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory".
# See https://github.com/actions/virtual-environments/issues/70#issuecomment-653886422
# The Linux VM has 7GB RAM (https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources),
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
python-version: "3.11.2"
python-version: "3.12.1"
# To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory".
# See https://github.com/actions/virtual-environments/issues/70#issuecomment-653886422
# The Linux VM has 7GB RAM (https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources),
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ tags

### Others
.pyodide-xbuildenv/
.pyodide-xbuildenv-*/

# sed backup files on macOS
*.*-e
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ desktop := packages/desktop/build/*
kernel := packages/kernel/dist/*
stlite-server-wheel := packages/kernel/py/stlite-server/dist/stlite_server-0.1.0-py3-none-any.whl
streamlit_proto := streamlit/frontend/lib/src/proto.d.ts
streamlit_wheel := packages/kernel/py/streamlit/lib/dist/streamlit-1.35.0-cp311-none-any.whl
streamlit_wheel := packages/kernel/py/streamlit/lib/dist/streamlit-1.35.0-cp312-none-any.whl
streamlit_frontend_lib_prod := streamlit/frontend/lib/dist/*

.PHONY: all
Expand Down
6 changes: 1 addition & 5 deletions packages/desktop/bin-src/dump_artifacts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { hideBin } from "yargs/helpers";
import path from "node:path";
import fsPromises from "node:fs/promises";
import fsExtra from "fs-extra";
import fetch from "node-fetch";
import { loadPyodide, type PyodideInterface } from "pyodide";
import { makePyodideUrl } from "./url";
import { PrebuiltPackagesData } from "./pyodide_packages";
Expand All @@ -15,9 +14,6 @@ import { validateRequirements, parseRequirementsTxt } from "@stlite/common";
import { glob } from "glob";
import { logger } from "./logger";

// @ts-ignore
global.fetch = fetch; // The global `fetch()` is necessary for micropip.install() to load the remote packages.

const pathFromScriptToBuild =
process.env.PATH_FROM_SCRIPT_TO_BUILD ?? "../../build";
const pathFromScriptToWheels =
Expand Down Expand Up @@ -141,7 +137,7 @@ async function installPackages(
requirements.push(stliteServerWheel);
const streamlitWheel = await prepareLocalWheel(
pyodide,
path.join(wheelsDir, "streamlit-1.35.0-cp311-none-any.whl")
path.join(wheelsDir, "streamlit-1.35.0-cp312-none-any.whl")
);
requirements.push(streamlitWheel);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { makePyodideUrl } from "./url";
import { logger } from "./logger";

Expand Down
9 changes: 5 additions & 4 deletions packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"url": "https://github.com/whitphx/stlite/issues"
},
"homepage": "/",
"engines": {
"node": ">=18"
},
"main": "./build/electron/main.js",
"files": [
"build",
Expand All @@ -28,7 +31,7 @@
"eject": "craco eject",
"start:electron": "tsc -p electron && cross-env NODE_ENV=development concurrently \"./scripts/build_electron.js --watch\" \"electron .\"",
"build:electron": "tsc -p electron && cross-env NODE_ENV=production ./scripts/build_electron.js",
"build:pyodide": "curl -L https://github.com/pyodide/pyodide/releases/download/0.25.1/pyodide-core-0.25.1.tar.bz2 | tar xj -C ./build --files-from=./pyodide-files.txt",
"build:pyodide": "curl -L https://github.com/pyodide/pyodide/releases/download/0.26.0/pyodide-core-0.26.0.tar.bz2 | tar xj -C ./build --files-from=./pyodide-files.txt",
"build:bin": "tsc -p bin-src && ./scripts/build_bin.js",
"build:wheels": "./scripts/copy_wheels.js",
"typecheck": "yarn tsc --noEmit -p electron",
Expand Down Expand Up @@ -62,8 +65,7 @@
"//": "The packages not bundled with bin/dump_artifacts.js must be specified here as the runtime dependencies. See `scripts/build_bin.js` for the details.",
"dependencies": {
"fs-extra": "^11.2.0",
"node-fetch": "2",
"pyodide": "0.25.1",
"pyodide": "0.26.0",
"yargs": "^17.7.2"
},
"devDependencies": {
Expand All @@ -76,7 +78,6 @@
"@testing-library/user-event": "^14.0.0",
"@types/jest": "^27.4.3",
"@types/node": "^16.18.12",
"@types/node-fetch": "^2.6.11",
"@types/react": "^17.0.7",
"@types/react-dom": "^17.0.5",
"@types/yargs": "^17.0.32",
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/scripts/build_bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ require("esbuild")
platform: "node",
external: [
"pyodide", // The `pyodide` package must be installed at runtime for the included Wasm files, so there is no reason to bundle it here.
"node-fetch", // `node-fetch` will be installed at runtime anyway because it is one dependency of the `pyodide` package, so there is no reason to bundle it here.
"fs-extra", // `fs-extra` and `yargs` will be installed at runtime anyway as the dependencies of `electron-builder`, so we don't have to bundle them here.
"yargs", // Same as above, `fs-extra`.
],
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/scripts/copy_wheels.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function main() {
);
const streamlitWheelPath = path.join(
stliteKernelPyDir,
"streamlit/lib/dist/streamlit-1.35.0-cp311-none-any.whl"
"streamlit/lib/dist/streamlit-1.35.0-cp312-none-any.whl"
);

// Create the `wheels` directory
Expand Down
2 changes: 1 addition & 1 deletion packages/kernel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"eslint": "^8.33.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"pyodide": "0.25.1",
"pyodide": "0.26.0",
"typescript": "^4.9.4",
"vitest": "^1.2.2"
},
Expand Down
Loading

0 comments on commit 3dd1209

Please sign in to comment.