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. */
import type { NotebookOutput, ProjectOutput } from "../protocol.ts";
import type { CatalogResource } from "../index.ts";
/** An example application keeps just the records it uses. */
export const notebooks: CatalogResource<readonly NotebookOutput[], "notebook"> =
{
initial: [],
on: {
notebook: (state, { data }) => [
...state.filter((entry) => entry.id !== data.notebook.id),
data.notebook,
],
"notebook.removed": (state, { data }) =>
state.filter((entry) => entry.id !== data.id),
},
};
export const projects: CatalogResource<readonly ProjectOutput[], "project"> = {
initial: [],
on: {
project: (state, { data }) => [
...state.filter((entry) => entry.id !== data.project.id),
data.project,
],
},
};