A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
/* Copyright 2026 Marimo. All rights reserved. */
class URLPyodideRouter {
public getFilename(): string | null {
return this.getSearchParam("filename");
}
public setFilename(filename: string) {
this.setSearchParam("filename", filename);
}
public getCodeFromSearchParam(): string | null {
return this.getSearchParam("code");
}
public getCodeFromHash(): string | null {
const hash = window.location.hash;
const prefix = "#code/";
if (!hash.startsWith(prefix)) {
return null;
}
return hash.slice(prefix.length);
}
public setCodeForHash(code: string) {
window.location.hash = `#code/${code}`;
}
private setSearchParam(key: string, value: string) {
const url = new URL(window.location.href);
url.searchParams.set(key, value);
window.history.replaceState({}, "", url.toString());
}
private getSearchParam(key: string): string | null {
const url = new URL(window.location.href);
return url.searchParams.get(key);
}
}
export const PyodideRouter = new URLPyodideRouter();