Skip to content

Instantly share code, notes, and snippets.

@imfing
Created July 24, 2024 20:22
Show Gist options
  • Save imfing/5108f6ef62f763070e296c5820bf4d43 to your computer and use it in GitHub Desktop.
Save imfing/5108f6ef62f763070e296c5820bf4d43 to your computer and use it in GitHub Desktop.
import pyodideModule from "npm:pyodide/pyodide.js";
let input = "";
for await (
const line of Deno.stdin.readable.pipeThrough(new TextDecoderStream())
) {
input += line;
}
const pyodide = await pyodideModule.loadPyodide();
await pyodide.loadPackage([
"micropip",
"aiohttp",
"cachetools",
"ipython",
"jinja2",
"numpy",
"pydantic",
"pyyaml",
"requests",
"rich",
"ssl",
"urllib3",
]);
const micropip = pyodide.pyimport("micropip");
await micropip.install("httpx")
await pyodide.runPythonAsync(input);
// run with:
// deno run --allow-read --allow-net --allow-write run.js - <<EOF
// print("hello")
// EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment