diff --git a/pyodide-repl.html b/pyodide-repl.html
index cc815dc..1e9d2df 100644
--- a/pyodide-repl.html
+++ b/pyodide-repl.html
@@ -40,11 +40,38 @@
border-bottom: 1px solid var(--border);
background: var(--bg);
}
+ #header-top {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ }
#header h1 {
font-size: 16px;
font-weight: 600;
color: var(--accent);
}
+ #version-picker {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 12px;
+ color: var(--muted);
+ }
+ #version-select {
+ background: var(--surface);
+ color: var(--text);
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ padding: 4px 6px;
+ font-family: var(--mono);
+ font-size: 12px;
+ cursor: pointer;
+ }
+ #version-select:focus {
+ outline: none;
+ border-color: var(--accent);
+ }
#header .subtitle {
font-size: 12px;
color: var(--muted);
@@ -198,7 +225,28 @@
@@ -232,6 +280,22 @@
Pyodide REPL
const promptLabel = document.getElementById('prompt-label');
const loadingOverlay = document.getElementById('loading-overlay');
const loadingText = document.getElementById('loading-text');
+ const versionSelect = document.getElementById('version-select');
+
+ // Version selection from URL parameter
+ const urlParams = new URLSearchParams(window.location.search);
+ const urlVersion = urlParams.get('v');
+ if (urlVersion && versionSelect.querySelector(`option[value="${CSS.escape(urlVersion)}"]`)) {
+ versionSelect.value = urlVersion;
+ }
+ const selectedVersion = versionSelect.value;
+
+ versionSelect.addEventListener('change', () => {
+ const newVersion = versionSelect.value;
+ const url = new URL(window.location);
+ url.searchParams.set('v', newVersion);
+ window.location.href = url.toString();
+ });
let pyodide = null;
let pyconsole = null;
@@ -446,8 +510,8 @@ Pyodide REPL
// Initialize
async function init() {
try {
- loadingText.textContent = 'Loading Pyodide runtime...';
- const indexURL = 'https://cdn.jsdelivr.net/pyodide/v0.25.1/full/';
+ loadingText.textContent = `Loading Pyodide v${selectedVersion}...`;
+ const indexURL = `https://cdn.jsdelivr.net/pyodide/v${selectedVersion}/full/`;
const { loadPyodide } = await import(indexURL + 'pyodide.mjs');
loadingText.textContent = 'Initializing Python...';