๐งช AnkaFlow in the Browser (Pyodide)¶
This guide shows how to run AnkaFlow pipelines fully in-browser, using Pyodide (Python in WebAssembly).
No server, no install โ pipelines run client-side using the same YAML-based definitions.
๐ Demo Options¶
Method | Link |
---|---|
๐งช JupyterLite Notebook | Launch Demo Notebook |
๐ HTML SPA Demo | Try YAML Upload Demo |
๐ฆ How It Works¶
- AnkaFlow is compatible with Pyodide (via
micropip
) - Remote files (e.g., S3, GCS) are fetched using
pyodide.http.pyfetch
or custom implementation (e.g.axios
) - The SQL engine is DuckDB (running in WASM)
- Everything is local to your browser
๐งฐ Example (JupyterLite or Pyodide)¶
import micropip
await micropip.install("ankaflow")
from ankaflow import Flow
yaml = '''
- name: Load
kind: source
connection:
kind: Parquet
locator: data.parquet
- name: View
kind: transform
query: select * from Load
'''
Flow().run(yaml)
๐ง Notes¶
- Only packages available in the Pyodide index can be used
- Some connectors (e.g., BigQuery, ClickHouse) are not available in the browser
- All pipelines must avoid server-only dependencies when targeting Pyodide
๐ For Developers¶
If you're embedding AnkaFlow in a browser app:
- Load Pyodide:
<script src="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js"></script>
- Bootstrap and run:
const pyodide = await loadPyodide();
await pyodide.loadPackage(["micropip"]);
await pyodide.runPythonAsync(`
import micropip
await micropip.install("ankaflow")
from ankaflow import Flow
Flow().run(...)
`);
๐ Browser-Specific Modules¶
The following modules help with Pyodide execution:
connections/rest/browser.py
: Fetches data viapyfetch
LocalFileSystem
: Writes to Pyodide's/tmp
ObjectDownloader
: Manages cloud-to-browser downloads
โ Works Great In¶
- [x] Chrome
- [x] Firefox
- [x] JupyterLite
- [x] VS Code WebView
- [x] GitHub Pages