From 2e8b90f36979769c2a4ccf797929bd79e3a08a4a Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Mon, 10 Jun 2024 12:24:02 +0200 Subject: [PATCH] Updated script --- scripts/test-pyodide.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/test-pyodide.js b/scripts/test-pyodide.js index 8075d9b947..5fa3349008 100644 --- a/scripts/test-pyodide.js +++ b/scripts/test-pyodide.js @@ -1,3 +1,8 @@ +// Description: This script is used to test the Python SDK installation in a Pyodide environment. +// We are using JupyterLite and stlite, both pyodide based Python runtimes. To ensure that the SDK works +// in these runtimes, we need to test the installation of the SDK in a Pyodide environment. +// This script will start an HTTP server to serve the SDK wheel file and then try to install the SDK in Python. +// If the installation is successful, it will run a simple Python script to test the SDK. const { loadPyodide } = require("pyodide"); const http = require('http'); @@ -40,11 +45,11 @@ server.listen(PORT, () => { } await pyodide.runPythonAsync("from cognite.client import CogniteClient"); - return pyodide.runPythonAsync("1+1"); + return pyodide.runPythonAsync("Python SDK successfully installed and imported!"); } test_cognite_sdk().then((result) => { - console.log("Python says that 1+1 =", result); + console.log("Response from Python =", result); server.close(); }); });