Run Python in the browser
Your code never leaves the browser. Execution happens
entirely inside a Web Worker in this page. No network request
carries your cell source. The Pyodide runtime itself (about 10 MB
compressed) is fetched once from the jsDelivr CDN, then cached — nothing
else is sent.
Edit any cell below, then press Shift+Enter (or click the ▶ toolbar button) to run:
What’s running
@jupyter-kit/executor-pyodideboots a dedicated Web Worker.- The worker loads Pyodide from
https://cdn.jsdelivr.net/pyodide/v0.26.2/full/. - Cell source is
postMessage’d to the worker, evaluated, and the result / stdout / stderr / MIME bundle stream back. autoloadImports: truescansimportstatements and installs packages vialoadPackagebefore the cell runs (if the package is in Pyodide’s registry).
Setup
pnpm add @jupyter-kit/executor-pyodide @jupyter-kit/editor-codemirrorimport { createPyodideExecutor } from '@jupyter-kit/executor-pyodide';import { createEditorPlugin } from '@jupyter-kit/editor-codemirror';
const executor = createPyodideExecutor({ autoloadImports: true });const plugins = [createEditorPlugin({ extensions: [pythonEditor()] })];
<Notebook executor={executor} plugins={plugins} ... />To pin a specific Pyodide version or host it yourself, pass src and
indexURL:
createPyodideExecutor({ src: '/static/pyodide/pyodide.js', indexURL: '/static/pyodide/',});