From 085073e86ebcd007bb36efb4b6f93607150684c1 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 22 Apr 2026 12:40:25 -0700 Subject: [PATCH] open-webui: fix pyodide update, update pyodide to 0.29.3 The update script read the pyodide version from package.json, but the actual version locked in package-lock.json can be different. This is currently the case, since the derivation used an older version (0.28.2) than the locked one (0.28.3), breaking in-browser python evaluation. Instead, extract the pyodide version from package-lock.json, using the jq command previously suggested in the TODO comment. Also remove the version comparison against the existing value: - bash string comparison is lexographic, which is incorrect for semver - update-sourcce-version is already idempotent - we want to always match the locked pyodide version, even if it gets downgraded Run the update script twice, to update pyodide to the correct version and to verify idempotency. --- pkgs/by-name/op/open-webui/package.nix | 6 ++---- pkgs/by-name/op/open-webui/update.sh | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/op/open-webui/package.nix b/pkgs/by-name/op/open-webui/package.nix index f1e6bf46a83d..8a7d0cb36e52 100644 --- a/pkgs/by-name/op/open-webui/package.nix +++ b/pkgs/by-name/op/open-webui/package.nix @@ -24,11 +24,9 @@ let # the backend for run-on-client-browser python execution # must match lock file in open-webui - # TODO: should we automate this? - # TODO: with JQ? "jq -r '.packages["node_modules/pyodide"].version' package-lock.json" - pyodideVersion = "0.28.2"; + pyodideVersion = "0.28.3"; pyodide = fetchurl { - hash = "sha256-MQIRdOj9yVVsF+nUNeINnAfyA6xULZFhyjuNnV0E5+c="; + hash = "sha256-fcqubT8VmGoJ8PnmxHE6DA8kv/DJDHToWoFyPxvGCUA="; url = "https://github.com/pyodide/pyodide/releases/download/${pyodideVersion}/pyodide-${pyodideVersion}.tar.bz2"; }; diff --git a/pkgs/by-name/op/open-webui/update.sh b/pkgs/by-name/op/open-webui/update.sh index 0665c85fc8f4..47ea2fb8c6f8 100755 --- a/pkgs/by-name/op/open-webui/update.sh +++ b/pkgs/by-name/op/open-webui/update.sh @@ -22,11 +22,8 @@ npm_hash=$(prefetch-npm-deps package-lock.json) sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' "$path" # Extract pyodide version -pyodide_version=$(sed -rn 's/^.*pyodide.*\^([0-9.]*)\".*$/\1/p' package.json) +pyodide_version=$(jq -r '.packages["node_modules/pyodide"].version' package-lock.json) popd -# Update the pyodide version if necessary -current_pyodide_version=$(nix eval --raw -f . open-webui.frontend.pyodideVersion) -if [ "$current_pyodide_version" < "$pyodide_version" ]; then - update-source-version open-webui.frontend "${pyodide_version}" --file="$path" --version-key=pyodideVersion --source-key=pyodide -fi +# Update the pyodide version +update-source-version open-webui.frontend "${pyodide_version}" --file="$path" --version-key=pyodideVersion --source-key=pyodide