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
lint fixes (#7622)
Shahmir Varqhac09d972b154c
diff --git a/frontend/src/components/editor/chrome/panels/packages-utils.ts b/frontend/src/components/editor/chrome/panels/packages-utils.tsindex dd16a3ee15..de3078b01b 100644--- a/frontend/src/components/editor/chrome/panels/packages-utils.ts+++ b/frontend/src/components/editor/chrome/panels/packages-utils.ts@@ -16,9 +16,9 @@ export const focusPackagesInput = () => {});};-type ChromeActions = {+interface ChromeActions {openApplication: (panel: PanelType) => void;-};+}export const openPackageManager = (chromeActions: ChromeActions) => {chromeActions.openApplication("packages");diff --git a/frontend/src/components/ui/reorderable-list.tsx b/frontend/src/components/ui/reorderable-list.tsxindex 428971dba0..8ac303dc13 100644--- a/frontend/src/components/ui/reorderable-list.tsx+++ b/frontend/src/components/ui/reorderable-list.tsx@@ -67,7 +67,7 @@ export interface ReorderableListProps<T extends { id: string | number }> {* />* ```*/-export function ReorderableList<T extends { id: string | number }>({+export const ReorderableList = <T extends { id: string | number }>({value,setValue,renderItem,@@ -76,7 +76,7 @@ export function ReorderableList<T extends { id: string | number }>({minItems = 1,ariaLabel = "Reorderable list",className,-}: ReorderableListProps<T>) {+}: ReorderableListProps<T>) => {const { dragAndDropHooks } = useDragAndDrop<T>({getItems: (keys) => [...keys].map((key) => ({ "text/plain": String(key) })),onReorder(e) {@@ -157,4 +157,4 @@ export function ReorderableList<T extends { id: string | number }>({</ContextMenuContent></ContextMenu>);-}+};diff --git a/frontend/src/core/codemirror/markdown/commands.ts b/frontend/src/core/codemirror/markdown/commands.tsindex 7c96c66529..6c22ba74ed 100644--- a/frontend/src/core/codemirror/markdown/commands.ts+++ b/frontend/src/core/codemirror/markdown/commands.ts@@ -321,7 +321,17 @@ export async function insertImage(view: EditorView, file: File) {const extension = file.type.split("/")[1];// A cancelled prompt returns null- if (inputFilename !== null) {+ if (inputFilename === null) {+ // Large strings do not make sense to write/save to the document+ const base64SizeKB = Math.round(dataUrl.length / 1024);+ if (base64SizeKB > MAX_BASE64_SIZE_KB) {+ toast({+ title: "Content too large",+ description: `The content size is ${base64SizeKB} KB, which is too large to paste directly into the document.`,+ });+ return;+ }+ } else {if (inputFilename.trim() === "") {inputFilename = file.name;} else if (!inputFilename.endsWith(`.${extension}`)) {@@ -362,16 +372,6 @@ export async function insertImage(view: EditorView, file: File) {title: "Failed to upload image. Using raw base64 string.",});}- } else {- // Large strings do not make sense to write/save to the document- const base64SizeKB = Math.round(dataUrl.length / 1024);- if (base64SizeKB > MAX_BASE64_SIZE_KB) {- toast({- title: "Content too large",- description: `The content size is ${base64SizeKB} KB, which is too large to paste directly into the document.`,- });- return;- }}}} catch {diff --git a/frontend/src/core/websocket/transports/__tests__/transport.test.ts b/frontend/src/core/websocket/transports/__tests__/transport.test.tsindex 2624369a45..d8bd8c71f5 100644--- a/frontend/src/core/websocket/transports/__tests__/transport.test.ts+++ b/frontend/src/core/websocket/transports/__tests__/transport.test.ts@@ -12,7 +12,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("open", callback);// Verify by notifying- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(callback).toHaveBeenCalledTimes(1);});@@ -44,7 +44,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("close", closeCallback);subscriptions.addSubscription("message", messageCallback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(openCallback).toHaveBeenCalledTimes(1);expect(closeCallback).not.toHaveBeenCalled();expect(messageCallback).not.toHaveBeenCalled();@@ -58,7 +58,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("close", callback);subscriptions.addSubscription("close", callback);- subscriptions.notify("close", new Event("close") as Event);+ subscriptions.notify("close", new Event("close"));// Set only stores unique callbacks, so should be called onceexpect(callback).toHaveBeenCalledTimes(1);@@ -91,7 +91,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.removeSubscription("close", callback2);- subscriptions.notify("close", new Event("close") as Event);+ subscriptions.notify("close", new Event("close"));expect(callback1).toHaveBeenCalledTimes(1);expect(callback2).not.toHaveBeenCalled();@@ -108,7 +108,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.removeSubscription("close", callback),).not.toThrow();- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(callback).toHaveBeenCalledTimes(1);});});@@ -123,7 +123,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("open", callback2);const openEvent = new Event("open");- subscriptions.notify("open", openEvent as Event);+ subscriptions.notify("open", openEvent);expect(callback1).toHaveBeenCalledWith(openEvent);expect(callback2).toHaveBeenCalledWith(openEvent);@@ -152,7 +152,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("open", openCallback);subscriptions.addSubscription("close", closeCallback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(openCallback).toHaveBeenCalledTimes(1);expect(closeCallback).not.toHaveBeenCalled();@@ -186,12 +186,12 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("open", callback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(callback).toHaveBeenCalledTimes(1);subscriptions.removeSubscription("open", callback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(callback).toHaveBeenCalledTimes(1);});@@ -208,7 +208,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.addSubscription("close", closeCallback1);subscriptions.addSubscription("message", messageCallback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(openCallback1).toHaveBeenCalledTimes(1);expect(openCallback2).toHaveBeenCalledTimes(1);expect(closeCallback1).not.toHaveBeenCalled();@@ -222,7 +222,7 @@ describe("ConnectionSubscriptions", () => {expect(messageCallback).toHaveBeenCalledTimes(1);expect(messageCallback).toHaveBeenCalledWith(messageEvent);- subscriptions.notify("close", new Event("close") as Event);+ subscriptions.notify("close", new Event("close"));expect(openCallback1).toHaveBeenCalledTimes(1);expect(openCallback2).toHaveBeenCalledTimes(1);expect(closeCallback1).toHaveBeenCalledTimes(1);@@ -266,7 +266,7 @@ describe("ConnectionSubscriptions", () => {subscriptions.removeSubscription("close", callback);- subscriptions.notify("open", new Event("open") as Event);+ subscriptions.notify("open", new Event("open"));expect(callback).toHaveBeenCalledTimes(1);subscriptions.notify(@@ -275,7 +275,7 @@ describe("ConnectionSubscriptions", () => {);expect(callback).toHaveBeenCalledTimes(2);- subscriptions.notify("close", new Event("close") as Event);+ subscriptions.notify("close", new Event("close"));expect(callback).toHaveBeenCalledTimes(2);});});diff --git a/frontend/src/core/websocket/transports/transport.ts b/frontend/src/core/websocket/transports/transport.tsindex 908fedeb83..77ce4e699c 100644--- a/frontend/src/core/websocket/transports/transport.ts+++ b/frontend/src/core/websocket/transports/transport.ts@@ -1,3 +1,4 @@+/* Copyright 2026 Marimo. All rights reserved. */export type ConnectionEvent = "open" | "close" | "message" | "error";export interface IConnectionTransportMap {@@ -46,9 +47,7 @@ export class ConnectionSubscriptions {event: ConnectionEvent,callback: ConnectionTransportCallback<ConnectionEvent>,): void {- this.subscriptions- .get(event)- ?.delete(callback as ConnectionTransportCallback<ConnectionEvent>);+ this.subscriptions.get(event)?.delete(callback);}notify(diff --git a/frontend/src/utils/json/json-parser.ts b/frontend/src/utils/json/json-parser.tsindex 5fe34d60a4..20024a1ae0 100644--- a/frontend/src/utils/json/json-parser.ts+++ b/frontend/src/utils/json/json-parser.ts@@ -144,13 +144,13 @@ function formatValueForMarkdown(value: unknown): string {let stringValue = String(value);// Regex to match existing markdown links: [text](url)- const markdownLinkRegex = /\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g;+ const markdownLinkRegex = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g;// Temporarily replace existing markdown links with placeholdersconst placeholders = new Map<string, string>();let placeholderIndex = 0;- stringValue = stringValue.replace(markdownLinkRegex, (match) => {+ stringValue = stringValue.replaceAll(markdownLinkRegex, (match) => {const placeholder = `__MDLINK_${placeholderIndex++}__`;placeholders.set(placeholder, match);return placeholder;@@ -158,7 +158,7 @@ function formatValueForMarkdown(value: unknown): string {// Convert plain URLs to markdown linksconst urlRegex = /(https?:\/\/\S+)/g;- stringValue = stringValue.replace(urlRegex, "[$1]($1)");+ stringValue = stringValue.replaceAll(urlRegex, "[$1]($1)");// Restore markdown links from placeholdersfor (const [placeholder, original] of placeholders) {diff --git a/marimo/_server/consumer.py b/marimo/_server/consumer.pyindex f71ab53717..c3834acde2 100644--- a/marimo/_server/consumer.py+++ b/marimo/_server/consumer.py@@ -1,3 +1,4 @@+# Copyright 2026 Marimo. All rights reserved.from __future__ import annotationsfrom abc import ABC, abstractmethoddiff --git a/marimo/_server/sessions/extensions/types.py b/marimo/_server/sessions/extensions/types.pyindex 9f203b8b82..fc76165c92 100644--- a/marimo/_server/sessions/extensions/types.py+++ b/marimo/_server/sessions/extensions/types.py@@ -1,3 +1,4 @@+# Copyright 2026 Marimo. All rights reserved.from __future__ import annotationsfrom typing import TYPE_CHECKING, Protocol