Created
July 24, 2024 20:22
-
-
Save imfing/5108f6ef62f763070e296c5820bf4d43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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