Skip to content

Instantly share code, notes, and snippets.

@IvanIsCoding
Created May 11, 2025 03:18
Show Gist options
  • Save IvanIsCoding/8bb97d428169e073af4afa598e1d2932 to your computer and use it in GitHub Desktop.
Save IvanIsCoding/8bb97d428169e073af4afa598e1d2932 to your computer and use it in GitHub Desktop.
Pyodide + Rustworkx Demo
<!doctype html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/pyodide/v0.27.5/full/pyodide.js"></script>
</head>
<body>
Pyodide test page <br>
Open your browser console to see Pyodide output
<script type="text/javascript">
async function main() {
let pyodide = await loadPyodide();
await pyodide.loadPackage(
"http://localhost:8000/rustworkx-0.17.0-cp39-abi3-pyodide_2025_0_wasm32.whl",
);
const output = document.getElementById("output");
const result = await pyodide.runPythonAsync(`
import rustworkx as rx
graph = rx.generators.cycle_graph(10)
paths = rx.floyd_warshall(graph)
print(paths)
`);
}
main();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment