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
chore: bump ruff target-version to py310 (#9118)
Kiran Gadhave2da597f96dc6
diff --git a/marimo/_ai/_pydantic_ai_utils.py b/marimo/_ai/_pydantic_ai_utils.pyindex d38a9ba6ca..795eb89ec3 100644--- a/marimo/_ai/_pydantic_ai_utils.py+++ b/marimo/_ai/_pydantic_ai_utils.py@@ -2,7 +2,7 @@from __future__ import annotationsimport uuid-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo import _loggersfrom marimo._messaging.msgspec_encoder import asdict@@ -12,6 +12,8 @@ from marimo._server.models.completion import UIMessage as ServerUIMessageLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:+ from collections.abc import Callable+from pydantic_ai import FunctionToolsetfrom pydantic_ai.ui.vercel_ai.request_types import UIMessage, UIMessagePartdiff --git a/marimo/_ai/_tools/base.py b/marimo/_ai/_tools/base.pyindex 7462d66484..2d9ccebefb 100644--- a/marimo/_ai/_tools/base.py+++ b/marimo/_ai/_tools/base.py@@ -7,7 +7,6 @@ from dataclasses import asdict, dataclass, is_dataclassfrom typing import (TYPE_CHECKING,Any,- Callable,Generic,Optional,TypeVar,@@ -50,7 +49,7 @@ ArgsP = TypeVar("ArgsP", contravariant=True)OutC = TypeVar("OutC", covariant=True)if TYPE_CHECKING:- from collections.abc import Awaitable+ from collections.abc import Awaitable, Callablefrom starlette.applications import Starlettediff --git a/marimo/_ai/llm/_impl.py b/marimo/_ai/llm/_impl.pyindex f036716304..a243db5c32 100644--- a/marimo/_ai/llm/_impl.py+++ b/marimo/_ai/llm/_impl.py@@ -5,7 +5,7 @@ import dataclassesimport jsonimport osimport re-from typing import TYPE_CHECKING, Any, Callable, Optional, cast+from typing import TYPE_CHECKING, Any, Optional, castfrom marimo import _loggersfrom marimo._ai._pydantic_ai_utils import generate_id@@ -13,7 +13,7 @@ from marimo._plugins.ui._impl.chat.chat import AI_SDK_VERSION, DONE_CHUNKfrom marimo._utils.dicts import remove_none_valuesif TYPE_CHECKING:- from collections.abc import AsyncGenerator, Generator+ from collections.abc import AsyncGenerator, Callable, Generatorfrom pydantic_ai import Agentfrom pydantic_ai.settings import ModelSettingsdiff --git a/marimo/_ast/app.py b/marimo/_ast/app.pyindex 68d631be6a..0748df6243 100644--- a/marimo/_ast/app.py+++ b/marimo/_ast/app.py@@ -7,6 +7,7 @@ import osimport sysimport threadingfrom collections.abc import (+ Callable,Iterable,Iterator,Mapping,@@ -18,7 +19,6 @@ from textwrap import dedentfrom typing import (TYPE_CHECKING,Any,- Callable,Literal,Optional,ParamSpec,@@ -69,8 +69,9 @@ from marimo._types.ids import CellId_tif TYPE_CHECKING:from collections.abc import Sequencefrom types import FrameType, TracebackType+ from typing import TypeGuard- from typing_extensions import TypeGuard, TypeIs+ from typing_extensions import TypeIsfrom marimo._messaging.notification import HumanReadableStatusfrom marimo._plugins.core.web_component import JSONType@@ -292,6 +293,7 @@ class App:self._cell_manager.codes(),self._cell_manager.names(),self._cell_manager.configs(),+ strict=False,):cell = Nonecell_data = self._cell_manager._cell_data.get(cell_id)@@ -1011,7 +1013,7 @@ class InternalApp:) -> InternalApp:new_cell_manager = CellManager()for cell_id, code, name, config in zip(- cell_ids, codes, names, configs+ cell_ids, codes, names, configs, strict=False):cell = None# If the cell exists, the cell data should be set.diff --git a/marimo/_ast/cell.py b/marimo/_ast/cell.pyindex 08c3e95fcf..d172d7af7e 100644--- a/marimo/_ast/cell.py+++ b/marimo/_ast/cell.py@@ -678,7 +678,9 @@ class Cell:arg_names = sorted((self._cell.refs - allowed_refs) - self._cell.defs)argc = len(arg_names)- call_args = {name: arg for name, arg in zip(arg_names, args)}+ call_args = {+ name: arg for name, arg in zip(arg_names, args, strict=False)+ }call_args.update(kwargs)call_argc = len(call_args.keys()) + len(self._pytest_reserved)diff --git a/marimo/_ast/cell_manager.py b/marimo/_ast/cell_manager.pyindex 1712b46ca5..0da223529f 100644--- a/marimo/_ast/cell_manager.py+++ b/marimo/_ast/cell_manager.py@@ -2,9 +2,9 @@from __future__ import annotationsimport os+from collections.abc import Callablefrom typing import (TYPE_CHECKING,- Callable,Optional,ParamSpec,TypeAlias,diff --git a/marimo/_ast/compiler.py b/marimo/_ast/compiler.pyindex f2779f25ca..77975c8221 100644--- a/marimo/_ast/compiler.py+++ b/marimo/_ast/compiler.py@@ -14,7 +14,7 @@ import token as token_typesimport warningsfrom tokenize import TokenError, tokenizefrom types import CodeType, FrameType-from typing import Any, Callable, Optional, TypeAlias, cast+from typing import TYPE_CHECKING, Any, Optional, TypeAlias, castfrom marimo import _loggersfrom marimo._ast import parse@@ -33,6 +33,9 @@ from marimo._schemas.serialization import CellDef, ClassCell, FunctionCellfrom marimo._types.ids import CellId_tfrom marimo._utils.tmpdir import get_tmpdir+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()Cls: TypeAlias = typediff --git a/marimo/_ast/parse.py b/marimo/_ast/parse.pyindex 044f402349..68a76f05ff 100644--- a/marimo/_ast/parse.py+++ b/marimo/_ast/parse.py@@ -33,8 +33,7 @@ from marimo._schemas.serialization import (if TYPE_CHECKING:from collections.abc import Iterator-- from typing_extensions import TypeAlias+ from typing import TypeAliasFnNode: TypeAlias = Union[ast.FunctionDef, ast.AsyncFunctionDef]@@ -898,7 +897,9 @@ def is_equal_ast(assert isinstance(other, list)if len(basis) != len(other):return False- return all(is_equal_ast(a, b) for a, b in zip(basis, other))+ return all(+ is_equal_ast(a, b) for a, b in zip(basis, other, strict=False)+ )for key, value in vars(basis).items():# Scrub positional data not relevant for comparison.diff --git a/marimo/_ast/pytest.py b/marimo/_ast/pytest.pyindex 78a1d8fbb9..d644212523 100644--- a/marimo/_ast/pytest.py+++ b/marimo/_ast/pytest.py@@ -6,9 +6,9 @@ import copyimport functoolsimport inspectimport itertools-from collections.abc import Awaitable+from collections.abc import Awaitable, Callablefrom pathlib import Path-from typing import TYPE_CHECKING, Any, Callable, NoReturn, TypeVar, cast+from typing import TYPE_CHECKING, Any, NoReturn, TypeVar, castfrom marimo._ast.cell import Cellfrom marimo._ast.fast_stack import fast_stackdiff --git a/marimo/_ast/toplevel.py b/marimo/_ast/toplevel.pyindex c6c8801d98..55c3e46d59 100644--- a/marimo/_ast/toplevel.py+++ b/marimo/_ast/toplevel.py@@ -261,7 +261,7 @@ class TopLevelExtraction:# Run through and get defs + refs, and a naive attempt at resolving cell# status.for idx, (code, name, config) in enumerate(- zip(codes, names, cell_configs)+ zip(codes, names, cell_configs, strict=False)):status = TopLevelStatus(CellId_t(str(idx)), code, name, config, self.allowed_refsdiff --git a/marimo/_ast/transformers.py b/marimo/_ast/transformers.pyindex a2dbbbb070..5f879bb9ec 100644--- a/marimo/_ast/transformers.py+++ b/marimo/_ast/transformers.py@@ -4,13 +4,13 @@ from __future__ import annotationsimport astimport inspectimport textwrap-from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, cast+from typing import TYPE_CHECKING, Any, Optional, TypeVar, castfrom marimo._ast.parse import ast_parsefrom marimo._ast.variables import unmangle_localif TYPE_CHECKING:- from collections.abc import Sequence+ from collections.abc import Callable, SequenceARG_PREFIX: str = "*"diff --git a/marimo/_ast/visitor.py b/marimo/_ast/visitor.pyindex 8423b2ab87..d35c2f25ca 100644--- a/marimo/_ast/visitor.py+++ b/marimo/_ast/visitor.py@@ -7,7 +7,7 @@ from collections import defaultdictfrom copy import deepcopyfrom dataclasses import dataclass, fieldfrom functools import lru_cache-from typing import Callable, Literal, Optional, Union+from typing import TYPE_CHECKING, Literal, Optional, Unionfrom uuid import uuid4from marimo import _loggers@@ -25,6 +25,9 @@ from marimo._dependencies.dependencies import DependencyManagerfrom marimo._sql.error_utils import log_sql_errorfrom marimo._utils.strings import standardize_annotation_quotes+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()diff --git a/marimo/_cli/export/commands.py b/marimo/_cli/export/commands.pyindex 8e904ef2c4..871948f743 100644--- a/marimo/_cli/export/commands.py+++ b/marimo/_cli/export/commands.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport asynciofrom pathlib import Path-from typing import Callable, Literal, Optional+from typing import TYPE_CHECKING, Literal, Optionalimport click@@ -39,6 +39,9 @@ from marimo._utils.file_watcher import FileWatcherfrom marimo._utils.marimo_path import MarimoPathfrom marimo._utils.paths import maybe_make_dirs+if TYPE_CHECKING:+ from collections.abc import Callable+_watch_message = ("Watch notebook for changes and regenerate the output on modification. ""If watchdog is installed, it will be used to watch the file. "diff --git a/marimo/_cli/upgrade.py b/marimo/_cli/upgrade.pyindex 0098e7a5e5..4e445e278e 100644--- a/marimo/_cli/upgrade.py+++ b/marimo/_cli/upgrade.py@@ -5,7 +5,7 @@ import jsonimport osimport urllib.errorfrom datetime import datetime-from typing import Any, Callable, cast+from typing import TYPE_CHECKING, Any, castimport marimo._utils.requests as requestsfrom marimo import _loggers@@ -19,6 +19,9 @@ from marimo._config.cli_state import (from marimo._tracer import server_tracerfrom marimo._version import __version__ as current_version+if TYPE_CHECKING:+ from collections.abc import Callable+FETCH_TIMEOUT = 3LOGGER = _loggers.marimo_logger()diff --git a/marimo/_code_mode/_context.py b/marimo/_code_mode/_context.pyindex 9a342e0b32..f8c8e4869a 100644--- a/marimo/_code_mode/_context.py+++ b/marimo/_code_mode/_context.py@@ -647,7 +647,7 @@ class AsyncCodeModeContext:# Flush queued UI updates as a single batch.if ui_updates:- object_ids, values = zip(*ui_updates)+ object_ids, values = zip(*ui_updates, strict=False)await self._kernel.set_ui_element_value(UpdateUIElementCommand(object_ids=list(object_ids),diff --git a/marimo/_convert/common/comment_preserver.py b/marimo/_convert/common/comment_preserver.pyindex c95e4867a4..8f26891c0e 100644--- a/marimo/_convert/common/comment_preserver.py+++ b/marimo/_convert/common/comment_preserver.py@@ -5,7 +5,10 @@ import ioimport token as token_typesfrom dataclasses import dataclassfrom tokenize import TokenError, tokenize-from typing import Callable+from typing import TYPE_CHECKING++if TYPE_CHECKING:+ from collections.abc import Callable@dataclass@@ -97,7 +100,7 @@ class CommentPreserver:result = []for i, (original, transformed) in enumerate(- zip(original_sources, transformed_sources)+ zip(original_sources, transformed_sources, strict=False)):comments = self.comments_by_source.get(i, [])if not comments:diff --git a/marimo/_convert/common/dom_traversal.py b/marimo/_convert/common/dom_traversal.pyindex 62656bc57b..ed24b27c68 100644--- a/marimo/_convert/common/dom_traversal.py+++ b/marimo/_convert/common/dom_traversal.py@@ -5,13 +5,16 @@ import base64import mimetypesimport refrom html.parser import HTMLParser-from typing import Callable, Optional, cast+from typing import TYPE_CHECKING, Optional, castfrom marimo import _loggersfrom marimo._messaging.mimetypes import KnownMimeTypefrom marimo._runtime.virtual_file import read_virtual_filefrom marimo._utils.data_uri import build_data_url+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()diff --git a/marimo/_convert/ipynb/to_ir.py b/marimo/_convert/ipynb/to_ir.pyindex a75f0336e2..66bbbca47a 100644--- a/marimo/_convert/ipynb/to_ir.py+++ b/marimo/_convert/ipynb/to_ir.py@@ -7,8 +7,9 @@ import loggingimport reimport sysfrom collections import defaultdict+from collections.abc import Callablefrom dataclasses import dataclass, field-from typing import Any, Callable, Union+from typing import Any, Unionfrom pymdownx.superfences import RE_NESTED_FENCE_START # type: ignore@@ -1274,7 +1275,9 @@ def bind_cell_metadata(- If marimo-specific metadata is present, it is used to restore cell config."""cells: list[CodeCell] = []- for source, meta, hide_code in zip(sources, metadata, hide_flags):+ for source, meta, hide_code in zip(+ sources, metadata, hide_flags, strict=False+ ):tags: set[str] = set(meta.get("tags", []))# Extract marimo-specific cell config if presentdiff --git a/marimo/_convert/markdown/to_ir.py b/marimo/_convert/markdown/to_ir.pyindex 0cf787c09e..36e4586ac3 100644--- a/marimo/_convert/markdown/to_ir.py+++ b/marimo/_convert/markdown/to_ir.py@@ -4,8 +4,8 @@ from __future__ import annotationsimport refrom dataclasses import dataclassfrom typing import (+ TYPE_CHECKING,Any,- Callable,Generic,Literal,Optional,@@ -42,6 +42,9 @@ from marimo._schemas.serialization import (NotebookSerializationV1,)+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()MARIMO_MD = "marimo-md"@@ -241,7 +244,9 @@ def _tree_to_ir(root: Element) -> SafeWrap[NotebookSerializationV1]:code=source,options=config.asdict(),)- for name, source, config in zip(names, sources, cell_config)+ for name, source, config in zip(+ names, sources, cell_config, strict=False+ )],header=Header(value=header_value) if header_value else None,)diff --git a/marimo/_data/get_datasets.py b/marimo/_data/get_datasets.pyindex 0c8cb4cd66..a7d54907cb 100644--- a/marimo/_data/get_datasets.py+++ b/marimo/_data/get_datasets.py@@ -239,6 +239,7 @@ def _get_databases_from_duckdb_internal(for column_name, column_type in zip(cast(list[str], column_names),cast(list[str], column_types),+ strict=False,)]diff --git a/marimo/_lint/diagnostic.py b/marimo/_lint/diagnostic.pyindex f73a464516..3b988c7456 100644--- a/marimo/_lint/diagnostic.py+++ b/marimo/_lint/diagnostic.py@@ -79,5 +79,7 @@ class Diagnostic:# mypy seems unable to infer the typereturn cast(tuple[tuple[int], tuple[int]],- tuple(zip(*sorted(zip(lines, columns)))),+ tuple(+ zip(*sorted(zip(lines, columns, strict=False)), strict=False)+ ),)diff --git a/marimo/_lint/formatters/full.py b/marimo/_lint/formatters/full.pyindex 054649283f..085adb6a13 100644--- a/marimo/_lint/formatters/full.py+++ b/marimo/_lint/formatters/full.py@@ -63,7 +63,7 @@ class FullFormatter(DiagnosticFormatter):context_lines = []previous_line = -1- for line, column in zip(lines, columns):+ for line, column in zip(lines, columns, strict=False):line += 1 # Convert to 1-based index# Show context: 1 line above, current line, 1 line belowstart_line = max(1, line - 1)diff --git a/marimo/_lint/rules/runtime/reusable_definition_order.py b/marimo/_lint/rules/runtime/reusable_definition_order.pyindex 7d2accd2fe..86a7285e8b 100644--- a/marimo/_lint/rules/runtime/reusable_definition_order.py+++ b/marimo/_lint/rules/runtime/reusable_definition_order.py@@ -132,7 +132,7 @@ class ReusableDefinitionOrderRule(UnsafeFixRule):extraction, notebook_indices = self._extract_notebook(ctx.notebook)for status, notebook_index in zip(- extraction.statuses, notebook_indices+ extraction.statuses, notebook_indices, strict=False):if not (status.hint@@ -180,7 +180,7 @@ class ReusableDefinitionOrderRule(UnsafeFixRule):sorted_provider_positions = sorted(provider_order)reordered_provider_cells = [cells[index] for index in provider_order]for provider_position, cell in zip(- sorted_provider_positions, reordered_provider_cells+ sorted_provider_positions, reordered_provider_cells, strict=False):cells[provider_position] = cell@@ -192,7 +192,7 @@ class ReusableDefinitionOrderRule(UnsafeFixRule):provider_indices = {self._get_definition_name(status): notebook_indexfor status, notebook_index in zip(- extraction.statuses, notebook_indices+ extraction.statuses, notebook_indices, strict=False)if status.is_toplevelor (@@ -210,7 +210,7 @@ class ReusableDefinitionOrderRule(UnsafeFixRule):indegree = {notebook_index: 0 for notebook_index in graph}for status, notebook_index in zip(- extraction.statuses, notebook_indices+ extraction.statuses, notebook_indices, strict=False):if not (status.is_topleveldiff --git a/marimo/_mcp/server/_prompts/base.py b/marimo/_mcp/server/_prompts/base.pyindex 7be49b5838..76f834a5c2 100644--- a/marimo/_mcp/server/_prompts/base.py+++ b/marimo/_mcp/server/_prompts/base.py@@ -4,11 +4,13 @@from __future__ import annotationsfrom abc import ABC, abstractmethod-from typing import TYPE_CHECKING, Callable+from typing import TYPE_CHECKINGfrom marimo._utils.case import to_snake_caseif TYPE_CHECKING:+ from collections.abc import Callable+from mcp.types import PromptMessagefrom marimo._ai._tools.base import ToolContextdiff --git a/marimo/_metadata/opengraph.py b/marimo/_metadata/opengraph.pyindex f6b4d2cfa1..2746a32799 100644--- a/marimo/_metadata/opengraph.py+++ b/marimo/_metadata/opengraph.py@@ -6,9 +6,10 @@ import asyncioimport importlibimport inspectimport re+from collections.abc import Callablefrom dataclasses import dataclassfrom pathlib import Path-from typing import Any, Callable, Literal, cast+from typing import Any, Literal, castfrom urllib.parse import urlparseimport msgspecdiff --git a/marimo/_output/formatters/bokeh_formatters.py b/marimo/_output/formatters/bokeh_formatters.pyindex e545c973ad..0da5c79cd5 100644--- a/marimo/_output/formatters/bokeh_formatters.py+++ b/marimo/_output/formatters/bokeh_formatters.py@@ -2,7 +2,7 @@from __future__ import annotationsimport functools-from typing import Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom marimo._config.config import Themefrom marimo._messaging.mimetypes import KnownMimeType@@ -11,6 +11,9 @@ from marimo._output.formatters.formatter_factory import FormatterFactoryfrom marimo._output.formatters.utils import src_or_src_docfrom marimo._output.utils import flatten_string+if TYPE_CHECKING:+ from collections.abc import Callable+class BokehFormatter(FormatterFactory):@staticmethoddiff --git a/marimo/_output/formatters/formatter_factory.py b/marimo/_output/formatters/formatter_factory.pyindex 17fbc9edf1..1fdce82d05 100644--- a/marimo/_output/formatters/formatter_factory.py+++ b/marimo/_output/formatters/formatter_factory.py@@ -2,7 +2,8 @@from __future__ import annotationsimport abc-from typing import Callable, Optional+from collections.abc import Callable+from typing import Optionalfrom marimo import _loggersfrom marimo._config.config import Themediff --git a/marimo/_output/formatters/formatters.py b/marimo/_output/formatters/formatters.pyindex dda041280b..e22a753ce4 100644--- a/marimo/_output/formatters/formatters.py+++ b/marimo/_output/formatters/formatters.py@@ -2,7 +2,7 @@from __future__ import annotationsimport sys-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo import _loggersfrom marimo._config.config import Theme@@ -44,7 +44,7 @@ from marimo._utils.site_packages import is_local_moduleLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:- from collections.abc import Sequence+ from collections.abc import Callable, Sequence# Map from formatter factory's package name to formatter, for third-party# modules. These formatters will be registered if and when their associateddiff --git a/marimo/_output/formatters/ipython_formatters.py b/marimo/_output/formatters/ipython_formatters.pyindex 8e98884d27..4f87cb40dd 100644--- a/marimo/_output/formatters/ipython_formatters.py+++ b/marimo/_output/formatters/ipython_formatters.py@@ -3,13 +3,16 @@ from __future__ import annotationsimport functoolsfrom dataclasses import dataclass-from typing import Any, Callable, Optional, cast+from typing import TYPE_CHECKING, Any, Optional, castfrom marimo._messaging.mimetypes import KnownMimeTypefrom marimo._output.builder import hfrom marimo._output.formatters.formatter_factory import FormatterFactoryfrom marimo._plugins.core.media import io_to_data_url+if TYPE_CHECKING:+ from collections.abc import Callable+class IPythonFormatter(FormatterFactory):@staticmethoddiff --git a/marimo/_output/formatters/repr_formatters.py b/marimo/_output/formatters/repr_formatters.pyindex 4cc359de65..207f809fbb 100644--- a/marimo/_output/formatters/repr_formatters.py+++ b/marimo/_output/formatters/repr_formatters.py@@ -1,13 +1,16 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable, Optional, cast+from typing import TYPE_CHECKING, Any, Optional, castfrom marimo._messaging.mimetypes import KnownMimeTypefrom marimo._output.formatters.iframe import maybe_wrap_in_iframefrom marimo._plugins.core.media import io_to_data_urlfrom marimo._utils.methods import is_callable_method+if TYPE_CHECKING:+ from collections.abc import Callable+_WIDGET_VIEW_KEY = "application/vnd.jupyter.widget-view+json"MEDIA_MIME_PREFIXES = (diff --git a/marimo/_output/formatting.py b/marimo/_output/formatting.pyindex cac161002a..ffbc543d07 100644--- a/marimo/_output/formatting.py+++ b/marimo/_output/formatting.py@@ -19,9 +19,10 @@ from __future__ import annotationsimport jsonimport traceback+from collections.abc import Callablefrom dataclasses import dataclassfrom html import escape-from typing import Any, Callable, Optional, TypeVar, cast+from typing import Any, Optional, TypeVar, castfrom marimo import _loggers as loggersfrom marimo._messaging.mimetypes import KnownMimeTypediff --git a/marimo/_output/rich_help.py b/marimo/_output/rich_help.pyindex 35301014c4..4f87e20331 100644--- a/marimo/_output/rich_help.py+++ b/marimo/_output/rich_help.py@@ -2,9 +2,9 @@from __future__ import annotationsimport inspect+from collections.abc import Callablefrom typing import (Any,- Callable,Generic,Optional,Protocol,diff --git a/marimo/_plugins/stateless/download.py b/marimo/_plugins/stateless/download.pyindex fdc0b39af9..80af49438c 100644--- a/marimo/_plugins/stateless/download.py+++ b/marimo/_plugins/stateless/download.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport asyncioimport iofrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable, Final, Optional, Union, cast+from typing import TYPE_CHECKING, Any, Final, Optional, Union, castimport marimo._output.data.data as mo_datafrom marimo._output.rich_help import mddoc@@ -18,7 +18,7 @@ from marimo._plugins.ui._core.ui_element import UIElementfrom marimo._runtime.functions import EmptyArgs, Functionif TYPE_CHECKING:- from collections.abc import Coroutine+ from collections.abc import Callable, CoroutineDataType = Union[str, bytes, io.BytesIO, io.BufferedReader]diff --git a/marimo/_plugins/stateless/lazy.py b/marimo/_plugins/stateless/lazy.pyindex dc4e0242b2..be4051bdf0 100644--- a/marimo/_plugins/stateless/lazy.py+++ b/marimo/_plugins/stateless/lazy.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport asynciofrom dataclasses import dataclass-from typing import TYPE_CHECKING, Callable, Final, Union+from typing import TYPE_CHECKING, Final, Unionfrom marimo._output.formatting import as_htmlfrom marimo._output.rich_help import mddoc@@ -11,7 +11,7 @@ from marimo._plugins.ui._core.ui_element import UIElementfrom marimo._runtime.functions import EmptyArgs, Functionif TYPE_CHECKING:- from collections.abc import Coroutine+ from collections.abc import Callable, Coroutine@dataclassdiff --git a/marimo/_plugins/stateless/routes.py b/marimo/_plugins/stateless/routes.pyindex 2ef0aa51ba..d7146bda1a 100644--- a/marimo/_plugins/stateless/routes.py+++ b/marimo/_plugins/stateless/routes.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import TYPE_CHECKING, Any, Callable, Final, Union+from typing import TYPE_CHECKING, Any, Final, Unionfrom marimo._output.formatting import as_htmlfrom marimo._output.hypertext import Html@@ -10,7 +10,7 @@ from marimo._plugins.stateless import lazyfrom marimo._plugins.ui._core.ui_element import UIElementif TYPE_CHECKING:- from collections.abc import Coroutine+ from collections.abc import Callable, Coroutine@mddocdiff --git a/marimo/_plugins/ui/_core/ui_element.py b/marimo/_plugins/ui/_core/ui_element.pyindex 9113804bea..e1f1d48aad 100644--- a/marimo/_plugins/ui/_core/ui_element.py+++ b/marimo/_plugins/ui/_core/ui_element.py@@ -13,7 +13,6 @@ from html import escapefrom typing import (TYPE_CHECKING,Any,- Callable,Generic,Optional,TypeVar,@@ -34,7 +33,7 @@ from marimo._runtime.functions import Functionfrom marimo._types.ids import UIElementIdif TYPE_CHECKING:- from collections.abc import Sequence+ from collections.abc import Callable, Sequencefrom marimo._plugins.ui._impl.input import form as form_plugindiff --git a/marimo/_plugins/ui/_impl/altair_chart.py b/marimo/_plugins/ui/_impl/altair_chart.pyindex cb18c2627e..1a24481bcd 100644--- a/marimo/_plugins/ui/_impl/altair_chart.py+++ b/marimo/_plugins/ui/_impl/altair_chart.py@@ -7,7 +7,6 @@ import sysfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Literal,Optional,@@ -41,6 +40,8 @@ from marimo._utils.narwhals_utils import (LOGGER = _loggers.marimo_logger()if TYPE_CHECKING:+ from collections.abc import Callable+import altairimport altair.vegalitefrom narwhals import Schemadiff --git a/marimo/_plugins/ui/_impl/array.py b/marimo/_plugins/ui/_impl/array.pyindex 9b7fe5eb68..fd692562ba 100644--- a/marimo/_plugins/ui/_impl/array.py+++ b/marimo/_plugins/ui/_impl/array.py@@ -1,8 +1,8 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from collections.abc import Iterator, Sequence-from typing import Any, Callable, Final, Optional+from collections.abc import Callable, Iterator, Sequence+from typing import Any, Final, Optionalfrom marimo._output.formatters.structures import format_structurefrom marimo._output.hypertext import Htmldiff --git a/marimo/_plugins/ui/_impl/batch.py b/marimo/_plugins/ui/_impl/batch.pyindex c785a26d31..97da4adc51 100644--- a/marimo/_plugins/ui/_impl/batch.py+++ b/marimo/_plugins/ui/_impl/batch.py@@ -4,7 +4,6 @@ from __future__ import annotationsfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Optional,TypeVar,@@ -16,7 +15,7 @@ from marimo._plugins.core.web_component import JSONTypefrom marimo._plugins.ui._core.ui_element import UIElementif TYPE_CHECKING:- from collections.abc import ItemsView, Iterator, ValuesView+ from collections.abc import Callable, ItemsView, Iterator, ValuesViewU = TypeVar("U")V = TypeVar("V")diff --git a/marimo/_plugins/ui/_impl/chat/chat.py b/marimo/_plugins/ui/_impl/chat/chat.pyindex c07c5dc13f..006e1465ed 100644--- a/marimo/_plugins/ui/_impl/chat/chat.py+++ b/marimo/_plugins/ui/_impl/chat/chat.py@@ -5,7 +5,7 @@ import inspectimport jsonimport uuidfrom dataclasses import dataclass-from typing import Any, Callable, Final, Literal, Optional, Union, cast+from typing import TYPE_CHECKING, Any, Final, Literal, Optional, Union, castfrom marimo import _loggersfrom marimo._ai._types import (@@ -24,6 +24,9 @@ from marimo._runtime.context import get_contextfrom marimo._runtime.context.types import ContextNotInitializedErrorfrom marimo._runtime.functions import EmptyArgs, Function+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()DEFAULT_CONFIG = ChatModelConfigDict(diff --git a/marimo/_plugins/ui/_impl/comm.py b/marimo/_plugins/ui/_impl/comm.pyindex d52b2b6708..5d2908673d 100644--- a/marimo/_plugins/ui/_impl/comm.py+++ b/marimo/_plugins/ui/_impl/comm.py@@ -1,8 +1,9 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations+from collections.abc import Callablefrom dataclasses import dataclass, field-from typing import Any, Callable, Optional+from typing import Any, Optionalfrom marimo._loggers import marimo_loggerfrom marimo._messaging.notification import (diff --git a/marimo/_plugins/ui/_impl/data_editor.py b/marimo/_plugins/ui/_impl/data_editor.pyindex 15ce9b8933..c5ca3fc72d 100644--- a/marimo/_plugins/ui/_impl/data_editor.py+++ b/marimo/_plugins/ui/_impl/data_editor.py@@ -8,7 +8,6 @@ from dataclasses import dataclassfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Literal,Optional,@@ -30,6 +29,8 @@ from marimo._utils.deprecated import deprecatedLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:+ from collections.abc import Callable+from narwhals.dtypes import DTypefrom typing_extensions import TypeIsdiff --git a/marimo/_plugins/ui/_impl/data_explorer.py b/marimo/_plugins/ui/_impl/data_explorer.pyindex c654b3cb1a..4bb60096ba 100644--- a/marimo/_plugins/ui/_impl/data_explorer.py+++ b/marimo/_plugins/ui/_impl/data_explorer.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import TYPE_CHECKING, Any, Callable, Final, Optional+from typing import TYPE_CHECKING, Any, Final, Optionalimport marimo._output.data.data as mo_datafrom marimo._dependencies.dependencies import DependencyManager@@ -10,6 +10,8 @@ from marimo._plugins.ui._core.ui_element import UIElementfrom marimo._plugins.ui._impl.tables.utils import get_table_managerif TYPE_CHECKING:+ from collections.abc import Callable+from narwhals.typing import IntoDataFramediff --git a/marimo/_plugins/ui/_impl/dataframes/dataframe.py b/marimo/_plugins/ui/_impl/dataframes/dataframe.pyindex 64da6fc72e..c7a1aefd6f 100644--- a/marimo/_plugins/ui/_impl/dataframes/dataframe.py+++ b/marimo/_plugins/ui/_impl/dataframes/dataframe.py@@ -4,8 +4,8 @@ from __future__ import annotationsimport sysfrom dataclasses import dataclassfrom typing import (+ TYPE_CHECKING,Any,- Callable,Final,Literal,Optional,@@ -56,6 +56,9 @@ from marimo._utils.narwhals_utils import is_narwhals_lazyframe, make_lazyfrom marimo._utils.parse_dataclass import parse_rawfrom marimo._utils.variable_name import infer_variable_name+if TYPE_CHECKING:+ from collections.abc import Callable+TOO_MANY_ROWS = 100_000diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py b/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.pyindex 24feceb012..0c22fc227b 100644--- a/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport datetimeimport decimalfrom functools import reduce-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyimport narwhals.stable.v2 as nwfrom narwhals.stable.v2 import col@@ -42,6 +42,8 @@ from marimo._utils.assert_never import assert_neverfrom marimo._utils.narwhals_utils import collect_and_preserve_typeif TYPE_CHECKING:+ from collections.abc import Callable+import polars as plfrom narwhals.expr import Exprfrom typing_extensions import TypeIs@@ -457,7 +459,7 @@ class NarwhalsTransformHandler(TransformHandler[DataFrame]):[nw.col(on_col) == on_valfor on_col, on_val in zip(- transform.column_ids, raw_pivot_column+ transform.column_ids, raw_pivot_column, strict=False)],)diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.pyindex a63fd2b738..648f4dc1c4 100644--- a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable, Union+from typing import TYPE_CHECKING, Any, Unionfrom marimo._plugins.ui._impl.dataframes.transforms.types import (Condition,@@ -10,6 +10,9 @@ from marimo._plugins.ui._impl.dataframes.transforms.types import ()from marimo._utils.assert_never import assert_never+if TYPE_CHECKING:+ from collections.abc import Callable+def python_print_transforms(df_name: str,diff --git a/marimo/_plugins/ui/_impl/dates.py b/marimo/_plugins/ui/_impl/dates.pyindex f89ce13370..6eff750bf7 100644--- a/marimo/_plugins/ui/_impl/dates.py+++ b/marimo/_plugins/ui/_impl/dates.py@@ -3,8 +3,8 @@ from __future__ import annotationsimport datetime as dtfrom typing import (+ TYPE_CHECKING,Any,- Callable,Final,Literal,Optional,@@ -21,6 +21,9 @@ from marimo._data.series import (from marimo._output.rich_help import mddocfrom marimo._plugins.ui._core.ui_element import UIElement+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()Numeric = Union[int, float]diff --git a/marimo/_plugins/ui/_impl/dictionary.py b/marimo/_plugins/ui/_impl/dictionary.pyindex b88954442b..92cfb641fb 100644--- a/marimo/_plugins/ui/_impl/dictionary.py+++ b/marimo/_plugins/ui/_impl/dictionary.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom marimo._output.formatters.structures import format_structurefrom marimo._output.hypertext import Html@@ -11,6 +11,9 @@ from marimo._plugins.stateless.json_output import json_outputfrom marimo._plugins.ui._core.ui_element import UIElementfrom marimo._plugins.ui._impl.batch import _batch_base, validate_and_clone+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass dictionary(_batch_base):diff --git a/marimo/_plugins/ui/_impl/file_browser.py b/marimo/_plugins/ui/_impl/file_browser.pyindex b7ff780a63..ddc110b62a 100644--- a/marimo/_plugins/ui/_impl/file_browser.py+++ b/marimo/_plugins/ui/_impl/file_browser.py@@ -1,12 +1,11 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from collections.abc import Sequence+from collections.abc import Callable, Sequencefrom dataclasses import dataclassfrom pathlib import Pathfrom typing import (Any,- Callable,Final,Literal,Optional,diff --git a/marimo/_plugins/ui/_impl/input.py b/marimo/_plugins/ui/_impl/input.pyindex 6009e8ad09..8b3f68fcbf 100644--- a/marimo/_plugins/ui/_impl/input.py+++ b/marimo/_plugins/ui/_impl/input.py@@ -5,11 +5,10 @@ import base64import dataclassesimport sysimport traceback-from collections.abc import Sequence+from collections.abc import Callable, Sequencefrom dataclasses import dataclassfrom typing import (Any,- Callable,Final,Literal,Optional,diff --git a/marimo/_plugins/ui/_impl/microphone.py b/marimo/_plugins/ui/_impl/microphone.pyindex a050a285e6..a7b89fb497 100644--- a/marimo/_plugins/ui/_impl/microphone.py+++ b/marimo/_plugins/ui/_impl/microphone.py@@ -3,11 +3,14 @@ from __future__ import annotationsimport base64import io-from typing import Callable, Final, Optional+from typing import TYPE_CHECKING, Final, Optionalfrom marimo._output.rich_help import mddocfrom marimo._plugins.ui._core.ui_element import UIElement+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass microphone(UIElement[str, io.BytesIO]):diff --git a/marimo/_plugins/ui/_impl/plotly.py b/marimo/_plugins/ui/_impl/plotly.pyindex f3d3e0b052..dae337084a 100644--- a/marimo/_plugins/ui/_impl/plotly.py+++ b/marimo/_plugins/ui/_impl/plotly.py@@ -6,7 +6,6 @@ import numbersfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Optional,cast,@@ -23,6 +22,8 @@ from marimo._plugins.ui._core.ui_element import UIElementLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:+ from collections.abc import Callable+import plotly.graph_objects as go # type:ignore# Selection is a dictionary of the form:@@ -339,7 +340,9 @@ class plotly(UIElement[PlotlySelection, list[dict[str, Any]]]):y_data = getattr(trace, "y", None)if x_data is None or y_data is None:continue- for point_idx, (x, y) in enumerate(zip(x_data, y_data)):+ for point_idx, (x, y) in enumerate(+ zip(x_data, y_data, strict=False)+ ):# Early exit if x is not in rangeif not (selection.x0 <= x <= selection.x1):continue@@ -1035,7 +1038,9 @@ def _extract_scatter_points_fallback(y_category_positions = _category_position_map(y_data)# First pass: include points directly inside current selection bounds.- for point_idx, (x_val, y_val) in enumerate(zip(x_data, y_data)):+ for point_idx, (x_val, y_val) in enumerate(+ zip(x_data, y_data, strict=False)+ ):x_in_range = Falseif _is_orderable_value(x_val) and _is_orderable_value(x_min):@@ -1195,7 +1200,7 @@ def _extract_scatter_points_from_lasso(polygon_x: list[float] = []polygon_y: list[float] = []- for raw_x, raw_y in zip(lasso_x, lasso_y):+ for raw_x, raw_y in zip(lasso_x, lasso_y, strict=False):x_coord = _to_numeric_coord(raw_x)if x_coord is None:x_coord = _safe_category_get(x_category_to_index, raw_x, -1)@@ -1219,7 +1224,9 @@ def _extract_scatter_points_from_lasso(if not polygon_x:continue- for point_idx, (x_val, y_val) in enumerate(zip(x_data, y_data)):+ for point_idx, (x_val, y_val) in enumerate(+ zip(x_data, y_data, strict=False)+ ):x_coord = _to_numeric_coord(x_val)if x_coord is None:try:@@ -2097,7 +2104,7 @@ def _append_waterfall_bars_to_selection(returnincoming_index_map = {id(p): idx- for idx, p in zip(all_indices, all_points)+ for idx, p in zip(all_indices, all_points, strict=False)if p and isinstance(idx, int)}clean_indices: list[int] = []@@ -2316,7 +2323,7 @@ def _append_violin_points_to_selection(]existing_non_violin_indices = [idx- for idx, p in zip(all_indices, all_points)+ for idx, p in zip(all_indices, all_points, strict=False)if p and p.get("curveNumber") not in violin_curve_numbers]@@ -2330,7 +2337,9 @@ def _append_violin_points_to_selection(# recomputing from pointIndex only — Plotly may send pointNumber# instead. Map each point object to its original index by identity.incoming_index_map = {- id(p): idx for idx, p in zip(all_indices, all_points) if p+ id(p): idx+ for idx, p in zip(all_indices, all_points, strict=False)+ if p}clean_indices: list[int] = []for p in clean_points:@@ -2360,7 +2369,7 @@ def _append_violin_points_to_selection(merged_indices: list[int] = []for idx, point in zip(- existing_non_violin_indices, existing_non_violin+ existing_non_violin_indices, existing_non_violin, strict=False):point_id = _get_selection_point_id(point)if point_id is not None:diff --git a/marimo/_plugins/ui/_impl/refresh.py b/marimo/_plugins/ui/_impl/refresh.pyindex 25858b5aa0..bd1b90ae8d 100644--- a/marimo/_plugins/ui/_impl/refresh.py+++ b/marimo/_plugins/ui/_impl/refresh.py@@ -1,11 +1,14 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Callable, Final, Optional, Union+from typing import TYPE_CHECKING, Final, Optional, Unionfrom marimo._output.rich_help import mddocfrom marimo._plugins.ui._core.ui_element import UIElement+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass refresh(UIElement[int, int]):diff --git a/marimo/_plugins/ui/_impl/run_button.py b/marimo/_plugins/ui/_impl/run_button.pyindex 811984c981..b697e7d142 100644--- a/marimo/_plugins/ui/_impl/run_button.py+++ b/marimo/_plugins/ui/_impl/run_button.py@@ -1,13 +1,16 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable, Final, Literal, Optional+from typing import TYPE_CHECKING, Any, Final, Literal, Optionalfrom marimo._output.rich_help import mddocfrom marimo._plugins.ui._core.ui_element import UIElementfrom marimo._plugins.ui._impl.input import buttonfrom marimo._runtime.context.types import ContextNotInitializedError+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass run_button(UIElement[Any, Any]):diff --git a/marimo/_plugins/ui/_impl/switch.py b/marimo/_plugins/ui/_impl/switch.pyindex 6012067f6d..439ca9b3fe 100644--- a/marimo/_plugins/ui/_impl/switch.py+++ b/marimo/_plugins/ui/_impl/switch.py@@ -1,11 +1,14 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Callable, Final, Optional+from typing import TYPE_CHECKING, Final, Optionalfrom marimo._output.rich_help import mddocfrom marimo._plugins.ui._core.ui_element import UIElement+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass switch(UIElement[bool, bool]):diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.pyindex 7cd780750d..9bb20088fb 100644--- a/marimo/_plugins/ui/_impl/table.py+++ b/marimo/_plugins/ui/_impl/table.py@@ -6,7 +6,6 @@ from dataclasses import dataclassfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Literal,Optional,@@ -74,7 +73,7 @@ from marimo._utils.narwhals_utils import ()if TYPE_CHECKING:- from collections.abc import Sequence+ from collections.abc import Callable, Sequencefrom narwhals.typing import IntoLazyFrame@@ -1329,7 +1328,8 @@ class table(selected = page_manager.select_cells(all_cells)cell_to_orig: dict[str, str] = {- cid: str(rid) for cid, rid in zip(cell_row_ids, row_ids)+ cid: str(rid)+ for cid, rid in zip(cell_row_ids, row_ids, strict=False)}lookup: dict[str, dict[str, Any]] = {}for cell in selected:diff --git a/marimo/_plugins/ui/_impl/tables/default_table.py b/marimo/_plugins/ui/_impl/tables/default_table.pyindex 4035e6b52f..cce818ac5d 100644--- a/marimo/_plugins/ui/_impl/tables/default_table.py+++ b/marimo/_plugins/ui/_impl/tables/default_table.py@@ -467,8 +467,8 @@ class DefaultTableManager(TableManager[JsonTableData]):column_values = data.values()column_names = list(data.keys())return [- dict(zip(column_names, row_values))- for row_values in zip(*column_values)+ dict(zip(column_names, row_values, strict=False))+ for row_values in zip(*column_values, strict=False)]# If its a dictionary, convert to key-value pairsdiff --git a/marimo/_plugins/ui/_impl/tables/format.py b/marimo/_plugins/ui/_impl/tables/format.pyindex 27f9568a12..98c1927150 100644--- a/marimo/_plugins/ui/_impl/tables/format.py+++ b/marimo/_plugins/ui/_impl/tables/format.py@@ -1,7 +1,8 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Callable, Union+from collections.abc import Callable+from typing import Unionfrom marimo import _loggersfrom marimo._plugins.core.web_component import JSONTypediff --git a/marimo/_plugins/ui/_impl/tabs.py b/marimo/_plugins/ui/_impl/tabs.pyindex 6a437a4423..d38450b1ba 100644--- a/marimo/_plugins/ui/_impl/tabs.py+++ b/marimo/_plugins/ui/_impl/tabs.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Callable, Final, Optional+from typing import TYPE_CHECKING, Final, Optionalfrom marimo._output.formatting import as_htmlfrom marimo._output.md import md@@ -9,6 +9,9 @@ from marimo._output.rich_help import mddocfrom marimo._plugins.stateless.lazy import lazy as lazy_uifrom marimo._plugins.ui._core.ui_element import UIElement+if TYPE_CHECKING:+ from collections.abc import Callable+@mddocclass tabs(UIElement[str, str]):diff --git a/marimo/_pyodide/bootstrap.py b/marimo/_pyodide/bootstrap.pyindex 7251960322..ae86a68b2c 100644--- a/marimo/_pyodide/bootstrap.py+++ b/marimo/_pyodide/bootstrap.py@@ -2,7 +2,7 @@from __future__ import annotationsimport json-from typing import TYPE_CHECKING, Callable+from typing import TYPE_CHECKINGfrom marimo._config.config import merge_configfrom marimo._messaging.notification import (@@ -28,6 +28,8 @@ from marimo._session.notebook import AppFileManagerfrom marimo._utils.parse_dataclass import parse_rawif TYPE_CHECKING:+ from collections.abc import Callable+from marimo._config.config import MarimoConfigfrom marimo._messaging.types import KernelMessagefrom marimo._pyodide.pyodide_session import PyodideBridge, PyodideSessiondiff --git a/marimo/_pyodide/pyodide_session.py b/marimo/_pyodide/pyodide_session.pyindex d646fbc60f..732fe9a401 100644--- a/marimo/_pyodide/pyodide_session.py+++ b/marimo/_pyodide/pyodide_session.py@@ -7,7 +7,7 @@ import jsonimport reimport signalfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast+from typing import TYPE_CHECKING, Any, TypeVar, castfrom marimo import _loggersfrom marimo._config.config import (@@ -76,6 +76,8 @@ from marimo._utils.inline_script_metadata import PyProjectReaderfrom marimo._utils.parse_dataclass import parse_rawif TYPE_CHECKING:+ from collections.abc import Callable+from marimo._ast.cell import CellConfigfrom marimo._messaging.types import KernelMessagefrom marimo._session.notebook.file_manager import AppFileManagerdiff --git a/marimo/_pyodide/restartable_task.py b/marimo/_pyodide/restartable_task.pyindex 3e23f6ff1c..d2571253d8 100644--- a/marimo/_pyodide/restartable_task.py+++ b/marimo/_pyodide/restartable_task.py@@ -2,7 +2,10 @@from __future__ import annotationsimport asyncio-from typing import Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optional++if TYPE_CHECKING:+ from collections.abc import Callableclass RestartableTask:diff --git a/marimo/_pyodide/streams.py b/marimo/_pyodide/streams.pyindex 7a53b11f76..80fbc357cf 100644--- a/marimo/_pyodide/streams.py+++ b/marimo/_pyodide/streams.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport asyncioimport sys-from typing import TYPE_CHECKING, Callable, Optional+from typing import TYPE_CHECKING, Optionalfrom marimo import _loggersfrom marimo._messaging.cell_output import CellOutput@@ -21,7 +21,7 @@ from marimo._messaging.types import (from marimo._types.ids import CellId_tif TYPE_CHECKING:- from collections.abc import Iterable+ from collections.abc import Callable, IterableLOGGER = _loggers.marimo_logger()diff --git a/marimo/_runtime/app/script_runner.py b/marimo/_runtime/app/script_runner.pyindex 0b14d944b9..cf1296d3e3 100644--- a/marimo/_runtime/app/script_runner.py+++ b/marimo/_runtime/app/script_runner.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport asynciofrom collections import deque-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom marimo._ast.names import SETUP_CELL_NAMEfrom marimo._dependencies.dependencies import DependencyManager@@ -32,6 +32,8 @@ from marimo._runtime.patches import (from marimo._types.ids import CellId_tif TYPE_CHECKING:+ from collections.abc import Callable+from marimo._ast.app import InternalAppdiff --git a/marimo/_runtime/commands.py b/marimo/_runtime/commands.pyindex e2c9efdcf5..3b8222c065 100644--- a/marimo/_runtime/commands.py+++ b/marimo/_runtime/commands.py@@ -267,7 +267,7 @@ class ExecuteCellsCommand(Command):request=self.request,timestamp=self.timestamp,)- for cell_id, code in zip(self.cell_ids, self.codes)+ for cell_id, code in zip(self.cell_ids, self.codes, strict=False)]def __post_init__(self) -> None:@@ -401,7 +401,7 @@ class UpdateUIElementCommand(Command):return UpdateUIElementCommand(object_ids=[], values=[], request=request)- object_ids, values = zip(*ids_and_values)+ object_ids, values = zip(*ids_and_values, strict=False)return UpdateUIElementCommand(object_ids=list(object_ids),values=list(values),@@ -415,7 +415,7 @@ class UpdateUIElementCommand(Command):Returns:List of (id, value) tuples."""- return list(zip(self.object_ids, self.values))+ return list(zip(self.object_ids, self.values, strict=False))class InvokeFunctionCommand(Command):diff --git a/marimo/_runtime/copy.py b/marimo/_runtime/copy.pyindex 3c15a669e8..1504fdf166 100644--- a/marimo/_runtime/copy.py+++ b/marimo/_runtime/copy.py@@ -3,10 +3,10 @@ from __future__ import annotationsimport inspectimport weakref+from collections.abc import Callablefrom copy import copyfrom typing import (Any,- Callable,Generic,TypeVar,Union,diff --git a/marimo/_runtime/dataflow/__init__.py b/marimo/_runtime/dataflow/__init__.pyindex 0897cd4048..bfb378803c 100644--- a/marimo/_runtime/dataflow/__init__.py+++ b/marimo/_runtime/dataflow/__init__.py@@ -2,7 +2,7 @@from __future__ import annotationsfrom collections import deque-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom marimo import _loggersfrom marimo._ast.cell import CellImpl@@ -13,7 +13,7 @@ from marimo._runtime.dataflow.types import Edge, EdgeWithVarfrom marimo._types.ids import CellId_tif TYPE_CHECKING:- from collections.abc import Collection+ from collections.abc import Callable, CollectionLOGGER = _loggers.marimo_logger()diff --git a/marimo/_runtime/dataflow/graph.py b/marimo/_runtime/dataflow/graph.pyindex 71c14e6274..25d6e92449 100644--- a/marimo/_runtime/dataflow/graph.py+++ b/marimo/_runtime/dataflow/graph.py@@ -5,7 +5,7 @@ from __future__ import annotationsimport threadingfrom dataclasses import dataclass, field-from typing import TYPE_CHECKING, Callable, Literal, Optional+from typing import TYPE_CHECKING, Literal, Optionalfrom marimo import _loggersfrom marimo._ast.compiler import code_key@@ -19,7 +19,7 @@ from marimo._runtime.dataflow.topology import ()if TYPE_CHECKING:- from collections.abc import Mapping+ from collections.abc import Callable, Mappingfrom marimo._ast.cell import CellImplfrom marimo._ast.visitor import ImportData, Name, VariableDatadiff --git a/marimo/_runtime/functions.py b/marimo/_runtime/functions.pyindex 14615fd320..a7b4150900 100644--- a/marimo/_runtime/functions.py+++ b/marimo/_runtime/functions.py@@ -4,14 +4,14 @@from __future__ import annotationsimport dataclasses-from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar+from typing import TYPE_CHECKING, Any, Generic, TypeVarfrom marimo._loggers import marimo_loggerfrom marimo._types.ids import CellId_tfrom marimo._utils.parse_dataclass import parse_rawif TYPE_CHECKING:- from collections.abc import Coroutine+ from collections.abc import Callable, CoroutineLOGGER = marimo_logger()diff --git a/marimo/_runtime/handlers.py b/marimo/_runtime/handlers.pyindex b024e5a9cd..5ccd2bc7a5 100644--- a/marimo/_runtime/handlers.py+++ b/marimo/_runtime/handlers.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport osfrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo import _loggersfrom marimo._messaging.notification import InterruptedNotification@@ -15,6 +15,8 @@ from marimo._runtime.control_flow import MarimoInterruptLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:+ from collections.abc import Callable+from marimo._runtime.runtime import Kerneldiff --git a/marimo/_runtime/packages/package_manager.py b/marimo/_runtime/packages/package_manager.pyindex e267b170cf..8836e3efc8 100644--- a/marimo/_runtime/packages/package_manager.py+++ b/marimo/_runtime/packages/package_manager.py@@ -4,7 +4,8 @@ from __future__ import annotationsimport abcimport subprocessimport sys-from typing import TYPE_CHECKING, Callable, Optional+from collections.abc import Callable+from typing import TYPE_CHECKING, Optionalimport msgspecdiff --git a/marimo/_runtime/patches.py b/marimo/_runtime/patches.pyindex 6bbafd030a..7d9084ba7c 100644--- a/marimo/_runtime/patches.py+++ b/marimo/_runtime/patches.py@@ -7,7 +7,8 @@ import functoolsimport sysimport textwrapimport types-from typing import TYPE_CHECKING, Any, Callable+from collections.abc import Callable+from typing import TYPE_CHECKING, Anyfrom marimo._ast.parse import ast_parsefrom marimo._dependencies.dependencies import DependencyManager@@ -507,7 +508,7 @@ def patch_polars_write_json() -> Unpatch:headers: list[str] = lines[0].split(",")for line in lines[1:]:values: list[str] = line.split(",")- json_data.append(dict(zip(headers, values)))+ json_data.append(dict(zip(headers, values, strict=False)))if file is None:return json.dumps(json_data)diff --git a/marimo/_runtime/primitives.py b/marimo/_runtime/primitives.pyindex 4dffec90bd..18f030ccc5 100644--- a/marimo/_runtime/primitives.py+++ b/marimo/_runtime/primitives.py@@ -4,7 +4,8 @@ from __future__ import annotationsimport inspectimport numbersimport weakref-from typing import TYPE_CHECKING, Any, Callable, Optional, Union+from collections.abc import Callable+from typing import TYPE_CHECKING, Any, Optional, Unionfrom marimo._ast.cell import Cellfrom marimo._ast.visitor import Name, VariableDatadiff --git a/marimo/_runtime/pytest.py b/marimo/_runtime/pytest.pyindex 7e449f33d1..70688dea41 100644--- a/marimo/_runtime/pytest.py+++ b/marimo/_runtime/pytest.py@@ -5,7 +5,7 @@ import osimport reimport sysfrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom marimo._ast.cell import Cellfrom marimo._ast.pytest import MARIMO_TEST_STUB_NAME@@ -19,6 +19,7 @@ MARIMO_TEST_BLOCK_REGEX = re.compile(rf"{MARIMO_TEST_STUB_NAME}_\d+[(?::)\.]+")if TYPE_CHECKING:+ from collections.abc import Callablefrom pathlib import Pathimport _pytest.Item # type: ignorediff --git a/marimo/_runtime/reload/autoreload.py b/marimo/_runtime/reload/autoreload.pyindex 61df8f26a9..20a961faef 100644--- a/marimo/_runtime/reload/autoreload.py+++ b/marimo/_runtime/reload/autoreload.py@@ -22,12 +22,15 @@ import weakreffrom dataclasses import dataclassfrom importlib import reloadfrom importlib.util import source_from_cache-from typing import Any, Callable, Generic, TypeVar+from typing import TYPE_CHECKING, Any, Generic, TypeVarfrom marimo import _loggersfrom marimo._ast.cell import CellImplfrom marimo._messaging.tracebacks import write_traceback+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()func_attrs = [diff --git a/marimo/_runtime/reload/module_watcher.py b/marimo/_runtime/reload/module_watcher.pyindex b684542a62..5c848f87a2 100644--- a/marimo/_runtime/reload/module_watcher.py+++ b/marimo/_runtime/reload/module_watcher.py@@ -6,7 +6,7 @@ import pathlibimport sysimport threadingimport time-from typing import TYPE_CHECKING, Callable, Literal+from typing import TYPE_CHECKING, Literalfrom marimo import _loggersfrom marimo._messaging.types import Stream@@ -19,6 +19,7 @@ from marimo._runtime.reload.autoreload import (if TYPE_CHECKING:import types+ from collections.abc import Callablefrom marimo._types.ids import CellId_tdiff --git a/marimo/_runtime/runner/hook_context.py b/marimo/_runtime/runner/hook_context.pyindex 1e07f03d85..9d51c5da88 100644--- a/marimo/_runtime/runner/hook_context.py+++ b/marimo/_runtime/runner/hook_context.py@@ -1,8 +1,9 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations+from collections.abc import Callablefrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable, TypeAlias, Union+from typing import TYPE_CHECKING, Any, TypeAlias, Unionfrom marimo._config.config import MarimoConfig, OnCellChangeTypefrom marimo._messaging.errors import Errordiff --git a/marimo/_runtime/runner/hooks.py b/marimo/_runtime/runner/hooks.pyindex 5ac4e9abef..ff95b52708 100644--- a/marimo/_runtime/runner/hooks.py+++ b/marimo/_runtime/runner/hooks.py@@ -1,9 +1,10 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations+from collections.abc import Callablefrom dataclasses import dataclass, fieldfrom enum import IntEnum-from typing import TYPE_CHECKING, Callable+from typing import TYPE_CHECKINGif TYPE_CHECKING:from collections.abc import Sequencediff --git a/marimo/_runtime/runtime.py b/marimo/_runtime/runtime.pyindex 158b56018b..8ad5bee9be 100644--- a/marimo/_runtime/runtime.py+++ b/marimo/_runtime/runtime.py@@ -20,7 +20,6 @@ from pathlib import Pathfrom typing import (TYPE_CHECKING,Any,- Callable,Optional,cast,)@@ -228,7 +227,7 @@ from marimo._utils.signals import restore_signalsfrom marimo._utils.typed_connection import TypedConnectionif TYPE_CHECKING:- from collections.abc import Awaitable, Iterator, Sequence+ from collections.abc import Awaitable, Callable, Iterator, Sequencefrom types import ModuleTypefrom marimo._plugins.ui._core.ui_element import UIElementdiff --git a/marimo/_runtime/state.py b/marimo/_runtime/state.pyindex 861afd68db..1d03e43953 100644--- a/marimo/_runtime/state.py+++ b/marimo/_runtime/state.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport typesimport weakreffrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable, Generic, Optional, TypeVar+from typing import TYPE_CHECKING, Any, Generic, Optional, TypeVarfrom uuid import uuid4from marimo._output.rich_help import mddoc@@ -14,7 +14,7 @@ T = TypeVar("T")Id = intif TYPE_CHECKING:- from collections.abc import Mapping+ from collections.abc import Callable, Mapping@dataclassdiff --git a/marimo/_runtime/utils/set_ui_element_request_manager.py b/marimo/_runtime/utils/set_ui_element_request_manager.pyindex 0cc334a0df..86251b092a 100644--- a/marimo/_runtime/utils/set_ui_element_request_manager.py+++ b/marimo/_runtime/utils/set_ui_element_request_manager.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar, Union+from typing import TYPE_CHECKING, Any, Generic, TypeVar, Unionfrom marimo._runtime.commands import (BatchableCommand,@@ -15,6 +15,7 @@ from marimo._types.ids import UIElementId, WidgetModelIdif TYPE_CHECKING:import asyncio+ from collections.abc import CallableA = TypeVar("A")B = TypeVar("B")@@ -130,7 +131,9 @@ def _merge_model_commands(}# Merge state and buffersmodel_state[mid].update(cmd.message.state)- for path, buf in zip(cmd.message.buffer_paths, cmd.buffers):+ for path, buf in zip(+ cmd.message.buffer_paths, cmd.buffers, strict=False+ ):model_buffers[mid][tuple(path)] = buffor mid in model_state:diff --git a/marimo/_runtime/watch/_directory.py b/marimo/_runtime/watch/_directory.pyindex da64e069c4..788be76ecb 100644--- a/marimo/_runtime/watch/_directory.py+++ b/marimo/_runtime/watch/_directory.py@@ -6,7 +6,7 @@ import osimport sysimport timefrom pathlib import Path-from typing import TYPE_CHECKING, Callable, cast+from typing import TYPE_CHECKING, castfrom marimo._output.rich_help import mddocfrom marimo._runtime.watch._path import (@@ -17,7 +17,7 @@ from marimo._runtime.watch._path import (if TYPE_CHECKING:import threading- from collections.abc import Iterable+ from collections.abc import Callable, Iterable# For testing only - do not use in productiondiff --git a/marimo/_runtime/watch/_file.py b/marimo/_runtime/watch/_file.pyindex 3bccbac7d9..30beaaef59 100644--- a/marimo/_runtime/watch/_file.py+++ b/marimo/_runtime/watch/_file.py@@ -6,7 +6,7 @@ import sysimport threadingimport timefrom pathlib import Path-from typing import Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo._output.rich_help import mddocfrom marimo._runtime.watch._path import (@@ -15,6 +15,9 @@ from marimo._runtime.watch._path import (write_side_effect,)+if TYPE_CHECKING:+ from collections.abc import Callable+# For testing only - do not use in production_TEST_SLEEP_INTERVAL: float | None = Nonediff --git a/marimo/_runtime/watch/_path.py b/marimo/_runtime/watch/_path.pyindex 24f66b543f..128307cce4 100644--- a/marimo/_runtime/watch/_path.py+++ b/marimo/_runtime/watch/_path.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport sysimport threadingfrom pathlib import Path-from typing import Any, Callable, TypeVar+from typing import TYPE_CHECKING, Any, TypeVarfrom marimo import _loggersfrom marimo._runtime.context import (@@ -17,6 +17,9 @@ from marimo._runtime.state import Statefrom marimo._runtime.threads import Threadfrom marimo._utils.platform import is_pyodide+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()if sys.version_info >= (3, 11):diff --git a/marimo/_save/hash.py b/marimo/_save/hash.pyindex ca87b47906..b1f7df7e96 100644--- a/marimo/_save/hash.py+++ b/marimo/_save/hash.py@@ -8,7 +8,7 @@ import hashlibimport inspectimport sysimport types-from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional+from typing import TYPE_CHECKING, Any, NamedTuple, Optionalfrom marimo._ast.transformers import DeprivateVisitor, get_hashable_astfrom marimo._ast.variables import (@@ -46,6 +46,7 @@ from marimo._save.stubs import maybe_get_custom_stubfrom marimo._types.ids import CellId_tif TYPE_CHECKING:+ from collections.abc import Callablefrom types import CodeTypefrom marimo._ast.cell import CellImpl@@ -518,7 +519,7 @@ class BlockHasher:ref_list = ", ".join([f"{ref}: {get_type(ref)} ({str(e)})"- for ref, e in zip(failed, exceptions)+ for ref, e in zip(failed, exceptions, strict=False)])# Note ExceptionGroup nicest here, but only available in 3.11diff --git a/marimo/_save/loaders/memory.py b/marimo/_save/loaders/memory.pyindex d774c9cf79..bd41e4f296 100644--- a/marimo/_save/loaders/memory.py+++ b/marimo/_save/loaders/memory.py@@ -3,12 +3,13 @@ from __future__ import annotationsimport threadingfrom collections import OrderedDict-from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, Union+from typing import TYPE_CHECKING, Any, Optional, TypeVar, Unionfrom marimo._save.cache import Cachefrom marimo._save.loaders.loader import Loaderif TYPE_CHECKING:+ from collections.abc import Callablefrom pathlib import Pathfrom marimo._save.hash import HashKeydiff --git a/marimo/_save/save.py b/marimo/_save/save.pyindex feee77f5c4..0b390be1e0 100644--- a/marimo/_save/save.py+++ b/marimo/_save/save.py@@ -12,6 +12,7 @@ import timeimport tracebackimport weakreffrom collections import abc+from collections.abc import Callable# NB: maxsize follows functools.cache, but renamed max_size outside of drop-in# api.@@ -19,7 +20,6 @@ from sys import maxsize as MAXINTfrom typing import (TYPE_CHECKING,Any,- Callable,Concatenate,Generic,Optional,@@ -291,7 +291,10 @@ class _cache_call(CacheContext, Generic[P, R]):)# Rewrite scoped args to prevent shadowed variables- arg_dict = {f"{ARG_PREFIX}{k}": v for (k, v) in zip(self._args, args)}+ arg_dict = {+ f"{ARG_PREFIX}{k}": v+ for (k, v) in zip(self._args, args, strict=False)+ }kwargs_copy = {f"{ARG_PREFIX}{k}": v for (k, v) in kwargs.items()}# Fill in default values for arguments not explicitly provided# This ensures cache hashes are based on resolved argument valuesdiff --git a/marimo/_save/stubs/__init__.py b/marimo/_save/stubs/__init__.pyindex 7ad242c467..5384173cc5 100644--- a/marimo/_save/stubs/__init__.py+++ b/marimo/_save/stubs/__init__.py@@ -3,7 +3,7 @@from __future__ import annotations-from typing import Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo._save.stubs.function_stub import FunctionStubfrom marimo._save.stubs.lazy_stub import ReferenceStub@@ -16,6 +16,9 @@ from marimo._save.stubs.stubs import ()from marimo._save.stubs.ui_element_stub import UIElementStub+if TYPE_CHECKING:+ from collections.abc import Callable+# Track which class names we've already attempted to register_REGISTERED_NAMES: set[str] = set()diff --git a/marimo/_save/toplevel.py b/marimo/_save/toplevel.pyindex 9be98d1731..3d223b9907 100644--- a/marimo/_save/toplevel.py+++ b/marimo/_save/toplevel.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable+from typing import TYPE_CHECKING, Anyfrom marimo import _loggersfrom marimo._ast.app import App, InternalApp@@ -13,6 +13,9 @@ from marimo._ast.toplevel import TopLevelExtractionfrom marimo._runtime.dataflow import DirectedGraphfrom marimo._types.ids import CellId_t+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()diff --git a/marimo/_schemas/serialization.py b/marimo/_schemas/serialization.pyindex ea0b726073..27f43c1e98 100644--- a/marimo/_schemas/serialization.py+++ b/marimo/_schemas/serialization.py@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Optional, Unionfrom marimo._ast.names import DEFAULT_CELL_NAMEif TYPE_CHECKING:- from typing_extensions import TypeAlias+ from typing import TypeAliasNodeRef: TypeAlias = Union[ast.stmt, ast.expr]diff --git a/marimo/_server/ai/mcp/client.py b/marimo/_server/ai/mcp/client.pyindex cea26cb9e9..1b0830ab8b 100644--- a/marimo/_server/ai/mcp/client.py+++ b/marimo/_server/ai/mcp/client.py@@ -164,7 +164,7 @@ class MCPClient:)for server_name, result in zip(- servers_to_connect.keys(), connection_results+ servers_to_connect.keys(), connection_results, strict=False):if isinstance(result, Exception):LOGGER.error(@@ -428,7 +428,7 @@ class MCPClient:)for server_name, result in zip(- self.servers.keys(), connection_results+ self.servers.keys(), connection_results, strict=False):if isinstance(result, Exception):LOGGER.error(f"Failed to connect to {server_name}: {result}")diff --git a/marimo/_server/ai/tools/tool_manager.py b/marimo/_server/ai/tools/tool_manager.pyindex 3b7073931c..f5911c2d25 100644--- a/marimo/_server/ai/tools/tool_manager.py+++ b/marimo/_server/ai/tools/tool_manager.py@@ -1,7 +1,7 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom starlette.applications import (Starlette, # noqa: TCH002 - required at runtime@@ -22,6 +22,8 @@ from marimo._server.ai.tools.types import (from marimo._utils.once import onceif TYPE_CHECKING:+ from collections.abc import Callable+from mcp.types import ( # type: ignore[import-not-found]CallToolResult,Tool as MCPRawTool,diff --git a/marimo/_server/ai/tools/types.py b/marimo/_server/ai/tools/types.pyindex 3b2ef1ad5d..44b45438df 100644--- a/marimo/_server/ai/tools/types.py+++ b/marimo/_server/ai/tools/types.py@@ -1,8 +1,9 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations+from collections.abc import Callablefrom dataclasses import dataclass-from typing import Any, Callable, Literal, Optional, TypeVar+from typing import Any, Literal, Optional, TypeVarfrom marimo._config.config import CopilotModediff --git a/marimo/_server/api/endpoints/terminal.py b/marimo/_server/api/endpoints/terminal.pyindex 538ae991de..b0580b3400 100644--- a/marimo/_server/api/endpoints/terminal.py+++ b/marimo/_server/api/endpoints/terminal.py@@ -9,7 +9,7 @@ import signalimport structimport sysfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Callable, Literal, TypedDict+from typing import TYPE_CHECKING, Any, Literal, TypedDictfrom starlette.websockets import WebSocket, WebSocketDisconnect, WebSocketState@@ -22,7 +22,7 @@ from marimo._session.model import SessionModefrom marimo._utils.platform import is_pyodide, is_windowsif TYPE_CHECKING:- from collections.abc import Iterable+ from collections.abc import Callable, IterableLOGGER = _loggers.marimo_logger()diff --git a/marimo/_server/api/endpoints/ws/ws_kernel_ready.py b/marimo/_server/api/endpoints/ws/ws_kernel_ready.pyindex 7cda4f9bf0..c5a3ebe30c 100644--- a/marimo/_server/api/endpoints/ws/ws_kernel_ready.py+++ b/marimo/_server/api/endpoints/ws/ws_kernel_ready.py@@ -120,7 +120,8 @@ def _extract_cell_data(cell.id,)for cell in document.cells- )+ ),+ strict=False,))return codes, names, configs, cell_ids@@ -131,7 +132,8 @@ def _extract_cell_data(*tuple(("", cell.name, cell.config, cell.id)for cell in document.cells- )+ ),+ strict=False,))return codes, names, configs, cell_idsdiff --git a/marimo/_server/api/endpoints/ws/ws_message_loop.py b/marimo/_server/api/endpoints/ws/ws_message_loop.pyindex b5d228e90b..bc7e9c294b 100644--- a/marimo/_server/api/endpoints/ws/ws_message_loop.py+++ b/marimo/_server/api/endpoints/ws/ws_message_loop.py@@ -2,7 +2,7 @@from __future__ import annotationsimport asyncio-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyfrom starlette.websockets import WebSocketDisconnect, WebSocketState@@ -16,6 +16,8 @@ from marimo._messaging.types import KernelMessagefrom marimo._server.api.endpoints.ws.ws_formatter import format_wire_messageif TYPE_CHECKING:+ from collections.abc import Callable+from starlette.websockets import WebSocketLOGGER = _loggers.marimo_logger()diff --git a/marimo/_server/api/endpoints/ws_endpoint.py b/marimo/_server/api/endpoints/ws_endpoint.pyindex bf7a71b555..31b8b36577 100644--- a/marimo/_server/api/endpoints/ws_endpoint.py+++ b/marimo/_server/api/endpoints/ws_endpoint.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport asyncioimport sys-from typing import Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom starlette.websockets import WebSocket, WebSocketState@@ -55,6 +55,9 @@ from marimo._session.model import ()from marimo._types.ids import CellId_t, ConsumerId+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()LORO_ALLOWED = sys.version_info >= (3, 11)diff --git a/marimo/_server/api/interrupt.py b/marimo/_server/api/interrupt.pyindex 3e7070d1df..b32cabd890 100644--- a/marimo/_server/api/interrupt.py+++ b/marimo/_server/api/interrupt.py@@ -5,7 +5,7 @@ import asyncioimport signalimport sysimport time-from typing import Callable+from typing import TYPE_CHECKINGfrom marimo._config.settings import GLOBAL_SETTINGSfrom marimo._utils.print import (@@ -13,6 +13,9 @@ from marimo._utils.print import (print_,)+if TYPE_CHECKING:+ from collections.abc import Callable+class InterruptHandler:def __init__(self, quiet: bool, shutdown: Callable[[], None]) -> None:diff --git a/marimo/_server/api/middleware.py b/marimo/_server/api/middleware.pyindex e9d10f8a85..786d00f88d 100644--- a/marimo/_server/api/middleware.py+++ b/marimo/_server/api/middleware.py@@ -3,13 +3,12 @@ from __future__ import annotationsimport asyncioimport time-from collections.abc import AsyncIterable+from collections.abc import AsyncIterable, Callablefrom dataclasses import dataclassfrom http.client import HTTPResponse, HTTPSConnectionfrom typing import (TYPE_CHECKING,Any,- Callable,Final,Optional,Union,diff --git a/marimo/_server/asgi.py b/marimo/_server/asgi.pyindex 6b945a7b6b..a8a34ae78e 100644--- a/marimo/_server/asgi.py+++ b/marimo/_server/asgi.py@@ -4,12 +4,11 @@ from __future__ import annotationsimport abcimport loggingfrom asyncio import iscoroutine-from collections.abc import Awaitable+from collections.abc import Awaitable, Callablefrom functools import partialfrom pathlib import Pathfrom typing import (TYPE_CHECKING,- Callable,Optional,Protocol,Union,diff --git a/marimo/_server/router.py b/marimo/_server/router.pyindex 60599ee67e..c58dffc8b7 100644--- a/marimo/_server/router.py+++ b/marimo/_server/router.py@@ -2,8 +2,9 @@from __future__ import annotationsfrom asyncio import iscoroutine+from collections.abc import Callablefrom dataclasses import dataclass-from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar+from typing import TYPE_CHECKING, Any, Optional, TypeVarfrom starlette.responses import (FileResponse,diff --git a/marimo/_server/rtc/doc.py b/marimo/_server/rtc/doc.pyindex 7b42ba2933..fb6711fde5 100644--- a/marimo/_server/rtc/doc.py+++ b/marimo/_server/rtc/doc.py@@ -72,7 +72,7 @@ class LoroDocManager:# Add all cell code to the docdoc_codes = doc.get_map("codes")doc.get_map("languages")- for cell_id, code in zip(cell_ids, codes):+ for cell_id, code in zip(cell_ids, codes, strict=False):cell_text = LoroText() # type: ignore[no-untyped-call]cell_text.insert(0, code)doc_codes.insert_container(cell_id, cell_text)diff --git a/marimo/_session/file_change_handler.py b/marimo/_session/file_change_handler.pyindex 6de2ba2f53..7b9819efdc 100644--- a/marimo/_session/file_change_handler.py+++ b/marimo/_session/file_change_handler.py@@ -150,7 +150,7 @@ class EditModeReloadStrategy(ReloadStrategy):changed_not_deleted = list(changed_cell_ids - deleted)session.put_control_request(SyncGraphCommand(- cells=dict(zip(cell_ids, codes)),+ cells=dict(zip(cell_ids, codes, strict=False)),run_ids=changed_not_deleted,delete_ids=sorted(deleted),),@@ -161,7 +161,7 @@ class EditModeReloadStrategy(ReloadStrategy):# cells are cleaned up from the dependency graph.session.put_control_request(SyncGraphCommand(- cells=dict(zip(cell_ids, codes)),+ cells=dict(zip(cell_ids, codes, strict=False)),run_ids=[],delete_ids=sorted(deleted),),diff --git a/marimo/_session/file_watcher_integration.py b/marimo/_session/file_watcher_integration.pyindex 6e075eec5e..4f19933ff7 100644--- a/marimo/_session/file_watcher_integration.py+++ b/marimo/_session/file_watcher_integration.py@@ -8,7 +8,7 @@ without leaking implementation details or monkey-patching.from __future__ import annotationsfrom pathlib import Path-from typing import TYPE_CHECKING, Callable+from typing import TYPE_CHECKINGfrom marimo import _loggersfrom marimo._session.extensions.types import EventAwareExtension@@ -19,7 +19,7 @@ from marimo._utils.paths import normalize_pathLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:- from collections.abc import Awaitable+ from collections.abc import Awaitable, Callablefrom marimo._session.events import SessionEventBusdiff --git a/marimo/_session/state/serialize.py b/marimo/_session/state/serialize.pyindex 9f664df45f..777f73d509 100644--- a/marimo/_session/state/serialize.py+++ b/marimo/_session/state/serialize.py@@ -493,7 +493,9 @@ class SessionCacheManager:return Falseif (len(key.codes) != len(notebook_session["cells"])) or any(_hash_code(code) != cell["code_hash"]- for code, cell in zip(key.codes, notebook_session["cells"])+ for code, cell in zip(+ key.codes, notebook_session["cells"], strict=False+ )):return Falseif key.marimo_version != metadata.get("marimo_version"):@@ -529,7 +531,7 @@ class SessionCacheManager:# Build mapping from code_hash to cell_id based on current cell IDs# This handles cases where cell_ids have changed even though code matchescode_hash_to_cell_id: dict[str, CellId_t] = {}- for code, cell_id in zip(key.codes, key.cell_ids):+ for code, cell_id in zip(key.codes, key.cell_ids, strict=False):code_hash = _hash_code(code)if code_hash is not None:# Map the code_hash to the current cell_id from the keydiff --git a/marimo/_session/state/session_view.py b/marimo/_session/state/session_view.pyindex fe06b40f29..d907ce9da9 100644--- a/marimo/_session/state/session_view.py+++ b/marimo/_session/state/session_view.py@@ -73,7 +73,10 @@ class ModelReplayState:@staticmethoddef from_open(model_id: WidgetModelId, msg: ModelOpen) -> ModelReplayState:- buffers = {tuple(p): b for p, b in zip(msg.buffer_paths, msg.buffers)}+ buffers = {+ tuple(p): b+ for p, b in zip(msg.buffer_paths, msg.buffers, strict=False)+ }return ModelReplayState(model_id=model_id,state=dict(msg.state),@@ -91,7 +94,7 @@ class ModelReplayState:}# Merge new state and buffersself.state.update(msg.state)- for path, buf in zip(msg.buffer_paths, msg.buffers):+ for path, buf in zip(msg.buffer_paths, msg.buffers, strict=False):self.buffers[tuple(path)] = bufdef to_notification(self) -> ModelLifecycleNotification:diff --git a/marimo/_sql/engines/sqlalchemy.py b/marimo/_sql/engines/sqlalchemy.pyindex ac2b6c9e1c..4819d1d3f0 100644--- a/marimo/_sql/engines/sqlalchemy.py+++ b/marimo/_sql/engines/sqlalchemy.py@@ -7,7 +7,6 @@ from contextlib import contextmanagerfrom typing import (TYPE_CHECKING,Any,- Callable,Literal,Optional,ParamSpec,@@ -36,7 +35,7 @@ from marimo._types.ids import VariableNameLOGGER = _loggers.marimo_logger()if TYPE_CHECKING:- from collections.abc import Iterator+ from collections.abc import Callable, Iteratorimport pandas as pdimport polars as pldiff --git a/marimo/_sql/error_utils.py b/marimo/_sql/error_utils.pyindex c6ba9bbe51..a95882230e 100644--- a/marimo/_sql/error_utils.py+++ b/marimo/_sql/error_utils.py@@ -2,12 +2,13 @@from __future__ import annotationsimport re-from typing import TYPE_CHECKING, Callable, Optional, TypedDict+from typing import TYPE_CHECKING, Optional, TypedDictfrom marimo._dependencies.dependencies import DependencyManagerif TYPE_CHECKING:import ast+ from collections.abc import Callablefrom marimo._messaging.errors import MarimoSQLErrordiff --git a/marimo/_sql/parse.py b/marimo/_sql/parse.pyindex 87c1ea218f..1ca577b926 100644--- a/marimo/_sql/parse.py+++ b/marimo/_sql/parse.py@@ -2,13 +2,16 @@from __future__ import annotationsimport re-from typing import Any, Callable, Literal, Optional, Union+from typing import TYPE_CHECKING, Any, Literal, Optional, Unionimport msgspecfrom marimo import _loggersfrom marimo._dependencies.dependencies import DependencyManager+if TYPE_CHECKING:+ from collections.abc import Callable+LOGGER = _loggers.marimo_logger()diff --git a/marimo/_sql/utils.py b/marimo/_sql/utils.pyindex 8860d9a261..4105fb505e 100644--- a/marimo/_sql/utils.py+++ b/marimo/_sql/utils.py@@ -2,7 +2,7 @@from __future__ import annotationsfrom contextlib import nullcontext-from typing import TYPE_CHECKING, Any, Callable, Optional, Union, cast+from typing import TYPE_CHECKING, Any, Optional, Union, castfrom marimo import _loggersfrom marimo._config.config import SqlOutputType@@ -14,6 +14,8 @@ from marimo._runtime.context.types import ()if TYPE_CHECKING:+ from collections.abc import Callable+import duckdbimport pandas as pdimport polars as pldiff --git a/marimo/_utils/cell_matching.py b/marimo/_utils/cell_matching.pyindex 8487618848..e3d00e034b 100644--- a/marimo/_utils/cell_matching.py+++ b/marimo/_utils/cell_matching.py@@ -14,7 +14,7 @@ def similarity_score(s1: str, s2: str) -> float:Returns lower score for more similar strings."""# Find common prefix lengthprefix_len = 0- for c1, c2 in zip(s1, s2):+ for c1, c2 in zip(s1, s2, strict=False):if c1 != c2:breakprefix_len += 1@@ -24,7 +24,7 @@ def similarity_score(s1: str, s2: str) -> float:s1_rev = s1[::-1]s2_rev = s2[::-1]suffix_len = 0- for c1, c2 in zip(s1_rev, s2_rev):+ for c1, c2 in zip(s1_rev, s2_rev, strict=False):if c1 != c2:breaksuffix_len += 1@@ -39,7 +39,7 @@ def group_lookup(ids: Sequence[CellId_t], codes: Sequence[str]) -> dict[str, list[tuple[int, CellId_t]]]:lookup: dict[str, list[tuple[int, CellId_t]]] = {}- for idx, (cell_id, code) in enumerate(zip(ids, codes)):+ for idx, (cell_id, code) in enumerate(zip(ids, codes, strict=False)):lookup.setdefault(code, []).append((idx, cell_id))return lookup@@ -289,8 +289,8 @@ def match_cell_ids_by_similarity(A map of old ids to new ids, using prev_ids where possible"""- prev_ids, prev_codes = zip(*prev_data.items())- next_ids, next_codes = zip(*next_data.items())+ prev_ids, prev_codes = zip(*prev_data.items(), strict=False)+ next_ids, next_codes = zip(*next_data.items(), strict=False)sorted_ids = _match_cell_ids_by_similarity(prev_ids,@@ -299,4 +299,4 @@ def match_cell_ids_by_similarity(next_codes,)- return dict(zip(sorted_ids, next_ids))+ return dict(zip(sorted_ids, next_ids, strict=False))diff --git a/marimo/_utils/debounce.py b/marimo/_utils/debounce.pyindex 9dda051881..7c9fb33ecb 100644--- a/marimo/_utils/debounce.py+++ b/marimo/_utils/debounce.py@@ -2,8 +2,9 @@from __future__ import annotationsimport time+from collections.abc import Callablefrom functools import wraps-from typing import Any, Callable, TypeVar, cast+from typing import Any, TypeVar, castF = TypeVar("F", bound=Callable[..., None])diff --git a/marimo/_utils/deprecated.py b/marimo/_utils/deprecated.pyindex 0e7aa037a2..f9c9157048 100644--- a/marimo/_utils/deprecated.py+++ b/marimo/_utils/deprecated.py@@ -3,7 +3,10 @@ from __future__ import annotationsimport functoolsimport warnings-from typing import Any, Callable+from typing import TYPE_CHECKING, Any++if TYPE_CHECKING:+ from collections.abc import Callabledef deprecated(reason: str) -> Callable[[Any], Any]:diff --git a/marimo/_utils/disposable.py b/marimo/_utils/disposable.pyindex 35ab5d37d9..1bcd1e0a05 100644--- a/marimo/_utils/disposable.py+++ b/marimo/_utils/disposable.py@@ -1,7 +1,10 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Callable+from typing import TYPE_CHECKING++if TYPE_CHECKING:+ from collections.abc import Callableclass Disposable:diff --git a/marimo/_utils/distributor.py b/marimo/_utils/distributor.pyindex dd8a745fd5..c790f2bce2 100644--- a/marimo/_utils/distributor.py+++ b/marimo/_utils/distributor.py@@ -4,7 +4,8 @@ from __future__ import annotationsimport asyncioimport threadingimport time-from typing import Any, Callable, Generic, Protocol, TypeVar, Union+from collections.abc import Callable+from typing import Any, Generic, Protocol, TypeVar, Unionfrom marimo import _loggersfrom marimo._session.queue import QueueTypediff --git a/marimo/_utils/file_watcher.py b/marimo/_utils/file_watcher.pyindex 4354acdc05..72dda3eb6b 100644--- a/marimo/_utils/file_watcher.py+++ b/marimo/_utils/file_watcher.py@@ -5,9 +5,9 @@ import asyncioimport osfrom abc import ABC, abstractmethodfrom collections import defaultdict-from collections.abc import Awaitable, Coroutine+from collections.abc import Awaitable, Callable, Coroutinefrom pathlib import Path-from typing import Callable, Optional+from typing import Optionalfrom marimo import _loggersfrom marimo._dependencies.dependencies import DependencyManagerdiff --git a/marimo/_utils/flatten.py b/marimo/_utils/flatten.pyindex 3d0bedb035..ff69a8bbbb 100644--- a/marimo/_utils/flatten.py+++ b/marimo/_utils/flatten.py@@ -12,7 +12,8 @@ installation of dm-tree on macOS is buggyfrom __future__ import annotationsimport itertools-from typing import Any, Callable, Union+from collections.abc import Callable+from typing import Any, UnionSTRUCT_TYPE = Union[tuple[Any, ...], list[Any], dict[Any, Any]]UNFLATTEN_TYPE = Callable[[list[Any]], Union[STRUCT_TYPE, Any]]@@ -110,7 +111,7 @@ def _flatten_sequence(## we chain the unflattened pieces together to pack them according to# the structure of value- for unflattener, length in zip(unflatteners, lengths):+ for unflattener, length in zip(unflatteners, lengths, strict=False):unflattened_pieces.append(unflattener(vector[pointer : pointer + length]))@@ -189,7 +190,9 @@ def _flatten(def unflatten(vector: list[Any]) -> STRUCT_TYPE:pointer = 0d = {}- for key, unflattener, length in zip(keys, unflatteners, lengths):+ for key, unflattener, length in zip(+ keys, unflatteners, lengths, strict=False+ ):piece = vector[pointer : pointer + length]d[key] = unflattener(piece)pointer += lengthdiff --git a/marimo/_utils/memoize.py b/marimo/_utils/memoize.pyindex 812374eb85..8291a2908b 100644--- a/marimo/_utils/memoize.py+++ b/marimo/_utils/memoize.py@@ -1,7 +1,10 @@# Copyright 2026 Marimo. All rights reserved.from __future__ import annotations-from typing import Any, Callable, TypeVar, cast+from typing import TYPE_CHECKING, Any, TypeVar, cast++if TYPE_CHECKING:+ from collections.abc import CallableT = TypeVar("T")diff --git a/marimo/_utils/methods.py b/marimo/_utils/methods.pyindex 2614cd86bf..f3c570fc66 100644--- a/marimo/_utils/methods.py+++ b/marimo/_utils/methods.py@@ -3,7 +3,8 @@ from __future__ import annotationsimport inspectimport types-from typing import Any, Callable, cast+from collections.abc import Callable+from typing import Any, castdef is_callable_method(obj: Any, attr: str) -> bool:diff --git a/marimo/_utils/narwhals_utils.py b/marimo/_utils/narwhals_utils.pyindex 1085b8f7d2..ebb19864f7 100644--- a/marimo/_utils/narwhals_utils.py+++ b/marimo/_utils/narwhals_utils.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport csvimport ioimport sys-from typing import TYPE_CHECKING, Any, Callable, Union, overload+from typing import TYPE_CHECKING, Any, Union, overloadimport narwhals as nw_mainimport narwhals.dtypes as nw_dtypes@@ -17,12 +17,14 @@ from marimo import _loggersLOGGER = _loggers.marimo_logger()if sys.version_info < (3, 11):- from typing_extensions import TypeGuard+ from typing import TypeGuardelse:from typing import TypeGuardif TYPE_CHECKING:+ from collections.abc import Callable+from narwhals.typing import (IntoBackend,IntoDataFrame,diff --git a/marimo/_utils/once.py b/marimo/_utils/once.pyindex e51d62a9a1..d2e9029df5 100644--- a/marimo/_utils/once.py+++ b/marimo/_utils/once.py@@ -2,8 +2,9 @@from __future__ import annotationsimport weakref+from collections.abc import Callablefrom functools import wraps-from typing import Any, Callable, TypeVar, cast+from typing import Any, TypeVar, castF = TypeVar("F", bound=Callable[..., Any])diff --git a/marimo/_utils/parse_dataclass.py b/marimo/_utils/parse_dataclass.pyindex 3cbc64788c..309308cccc 100644--- a/marimo/_utils/parse_dataclass.py+++ b/marimo/_utils/parse_dataclass.py@@ -111,7 +111,8 @@ class _DataclassParser:)else:return origin_cls( # type: ignore # noqa: E501- self._build_value(v, t) for v, t in zip(value, arg_types)+ self._build_value(v, t)+ for v, t in zip(value, arg_types, strict=False))elif origin_cls is dict and isinstance(value, dict):key_type, value_type = get_args(cls)diff --git a/marimo/_utils/timer.py b/marimo/_utils/timer.pyindex c8d6fe25ff..380b99747d 100644--- a/marimo/_utils/timer.py+++ b/marimo/_utils/timer.py@@ -3,7 +3,10 @@ from __future__ import annotationsimport functoolsimport time-from typing import Any, Callable+from typing import TYPE_CHECKING, Any++if TYPE_CHECKING:+ from collections.abc import Callabledef timer(func: Callable[..., Any]) -> Callable[..., Any]:diff --git a/marimo/_utils/toml.py b/marimo/_utils/toml.pyindex e4124069df..bdc931d59b 100644--- a/marimo/_utils/toml.py+++ b/marimo/_utils/toml.py@@ -2,9 +2,10 @@from __future__ import annotationsimport sys-from typing import IO, TYPE_CHECKING, Any, Callable, Union+from typing import IO, TYPE_CHECKING, Any, Unionif TYPE_CHECKING:+ from collections.abc import Callablefrom pathlib import Path# tomllib is available in python 3.11+ and is much faster than tomlkitdiff --git a/marimo/_utils/yaml.py b/marimo/_utils/yaml.pyindex 62e4aaa04f..3e074c31be 100644--- a/marimo/_utils/yaml.py+++ b/marimo/_utils/yaml.py@@ -2,7 +2,8 @@from __future__ import annotationsimport re-from typing import Any, Callable, TypeAlias+from collections.abc import Callable+from typing import Any, TypeAliasimport yamlfrom yaml.representer import SafeRepresenter, ScalarNodediff --git a/pyproject.toml b/pyproject.tomlindex 7ca8b33947..0c1e34278f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -287,7 +287,7 @@ wheel-exclude = ["marimo/_smoke_tests/**"][tool.ruff]line-length = 79-target-version = "py39"+target-version = "py310"include = ["marimo/**/*.py", "tests/**/*.py", "dagger/**/*.py"]exclude = ["build",diff --git a/tests/_ast/test_toplevel.py b/tests/_ast/test_toplevel.pyindex 2544e0d85f..25aaf1cac1 100644--- a/tests/_ast/test_toplevel.py+++ b/tests/_ast/test_toplevel.py@@ -149,7 +149,7 @@ class TestTopLevelExtraction:@staticmethoddef test_decorator_reversed(app) -> None:with app.setup:- from typing import Callable+ from collections.abc import Callable # noqa: TC003@app.celldef second(wrap):@@ -170,7 +170,7 @@ class TestTopLevelExtraction:@staticmethoddef test_decorator(app) -> None:with app.setup:- from typing import Callable+ from collections.abc import Callable # noqa: TC003@app.celldef first():diff --git a/tests/_cli/test_cli.py b/tests/_cli/test_cli.pyindex 35a7d6b7ad..5ceedad6f3 100644--- a/tests/_cli/test_cli.py+++ b/tests/_cli/test_cli.py@@ -19,7 +19,7 @@ import timeimport urllib.errorimport urllib.requestfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Callable, Optional+from typing import TYPE_CHECKING, Any, Optionalfrom unittest.mock import patchimport pytest@@ -43,7 +43,7 @@ from marimo._utils.platform import is_windowsfrom marimo._utils.toml import toml_readerif TYPE_CHECKING:- from collections.abc import Iterator+ from collections.abc import Callable, IteratorHAS_UV = DependencyManager.which("uv")HAS_ZMQ = DependencyManager.zmq.has()diff --git a/tests/_config/test_manager.py b/tests/_config/test_manager.pyindex ec9b4753cb..ef746ca853 100644--- a/tests/_config/test_manager.py+++ b/tests/_config/test_manager.py@@ -1,8 +1,9 @@from __future__ import annotationsimport textwrap+from collections.abc import Callablefrom functools import wraps-from typing import TYPE_CHECKING, Any, Callable, TypeVar+from typing import TYPE_CHECKING, Any, TypeVarfrom unittest.mock import patchimport pytestdiff --git a/tests/_plugins/ui/_impl/dataframes/test_handlers.py b/tests/_plugins/ui/_impl/dataframes/test_handlers.pyindex 95e2afca2e..a687649a4d 100644--- a/tests/_plugins/ui/_impl/dataframes/test_handlers.py+++ b/tests/_plugins/ui/_impl/dataframes/test_handlers.py@@ -112,7 +112,9 @@ def assert_frame_equal_with_nans(assert len(values_a) == len(values_b), (f"Length mismatch in column {col}")- for idx, (val_a, val_b) in enumerate(zip(values_a, values_b)):+ for idx, (val_a, val_b) in enumerate(+ zip(values_a, values_b, strict=False)+ ):both_nan = (isinstance(val_a, float)and isinstance(val_b, float)@@ -157,6 +159,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": ["1", "2", "3"]}),create_test_dataframes({"A": [1, 2, 3]}),+ strict=False,)),)@@ -179,6 +182,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1.1, 2.2, 3.3]}),create_test_dataframes({"A": ["1.1", "2.2", "3.3"]}),+ strict=False,)),)@@ -204,6 +208,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": ["1", "2", "3", "a"]}),create_test_dataframes({"A": [1, 2, 3, None]}),+ strict=False,)),)@@ -226,6 +231,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3]}),create_test_dataframes({"B": [1, 2, 3]}),+ strict=False,)),)@@ -246,6 +252,7 @@ class TestTransformHandler:create_test_dataframes({"A": [3, 1, 2]}),create_test_dataframes({"A": [1, 2, 3]}),create_test_dataframes({"A": [3, 2, 1]}),+ strict=False,)),)@@ -279,6 +286,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3]}),create_test_dataframes({"A": [2, 3]}),+ strict=False,)),)@@ -318,6 +326,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [2], "B": [5]}),+ strict=False,)),)@@ -339,6 +348,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3, 4, 5]}),create_test_dataframes({"A": [1, 2, 3]}),+ strict=False,)),)@@ -360,6 +370,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3]}),create_test_dataframes({"A": [1, 3]}),+ strict=False,)),)@@ -381,6 +392,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [2, 3], "B": [5, 6]}),+ strict=False,)),)@@ -402,6 +414,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [3], "B": [6]}),+ strict=False,)),)@@ -428,6 +441,7 @@ class TestTransformHandler:create_test_dataframes({"date": [date(2001, 1, 1)]}, exclude=["pandas"]),+ strict=False,)),)@@ -453,6 +467,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [1, 2], "B": [4, 5]}),+ strict=False,)),)@@ -479,6 +494,7 @@ class TestTransformHandler:create_test_dataframes({"date": [date(2001, 1, 1)]}, exclude=["polars"]),+ strict=False,),],)@@ -512,6 +528,7 @@ class TestTransformHandler:{"A": [Decimal("1.99"), Decimal("3.25")]},exclude=["pandas"],),+ strict=False,)),)@@ -551,6 +568,7 @@ class TestTransformHandler:{"A": [Decimal("0.10")]},exclude=["pandas"],),+ strict=False,)),)@@ -751,6 +769,7 @@ class TestTransformHandler:{"A": [[1, 2], [3, 4]]}, exclude=["pyarrow"]),create_test_dataframes({"A": [[1, 2]]}, exclude=["pyarrow"]),+ strict=False,)),)@@ -777,6 +796,7 @@ class TestTransformHandler:create_test_dataframes({"A": [{"a": 1, "b": 2}]}, exclude=["ibis", "pyarrow"]),+ strict=False,)),)@@ -809,6 +829,7 @@ class TestTransformHandler:create_test_dataframes({"A": [{"a": 1, "b": None}]},),+ strict=False,)),)@@ -838,6 +859,7 @@ class TestTransformHandler:create_test_dataframes({"A": [None], "B": [6]}, exclude=["pandas"]),+ strict=False,),],)@@ -859,6 +881,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [3], "B": [6]}),+ strict=False,)),)@@ -882,6 +905,7 @@ class TestTransformHandler:{"A": ["foo", "bar", "baz"], "B": [1, 2, 3]}),create_test_dataframes({"A": ["baz"], "B": [3]}),+ strict=False,)),)@@ -910,6 +934,7 @@ class TestTransformHandler:exclude=["ibis"],),create_test_dataframes({"A": [3], "B": [6]}, exclude=["ibis"]),+ strict=False,),],)@@ -939,6 +964,7 @@ class TestTransformHandler:create_test_dataframes({"A": [3, None], "B": [6, 7]}, exclude=["ibis"]),+ strict=False,),],)@@ -966,6 +992,7 @@ class TestTransformHandler:{"A": [1, 2, 3, 4, 5], "B": [5, 4, 3, 2, 1]}),create_test_dataframes({"A": [3, 4, 5], "B": [3, 2, 1]}),+ strict=False,)),)@@ -992,6 +1019,7 @@ class TestTransformHandler:{"A": [1, 2, 3, 4, 5], "B": [5, 4, 3, 2, 1]}),create_test_dataframes({"A": [1, 3, 4, 5], "B": [5, 3, 2, 1]}),+ strict=False,)),)@@ -1016,6 +1044,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [True, False, True, False]}),create_test_dataframes({"A": [True, True]}),+ strict=False,)),)@@ -1045,6 +1074,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3]}),[KeyError],+ strict=False,)),)@@ -1070,6 +1100,7 @@ class TestTransformHandler:create_test_dataframes({1: [2, 3], 2: [5, 6]}, include=["pandas"]),+ strict=False,),],)@@ -1177,12 +1208,14 @@ class TestTransformHandler:{"A": ["foo", "foo", "bar"], "B": [1, 2, 4]}),create_test_dataframes({"A": ["foo", "bar"], "B_sum": [3, 4]}),+ strict=False,),*zip(create_test_dataframes({"A": ["foo", "foo", "bar", "bar"], "B": [1, 2, 3, 4]},),create_test_dataframes({"A": ["foo", "bar"], "B_sum": [3, 7]}),+ strict=False,),],)@@ -1214,6 +1247,7 @@ class TestTransformHandler:*zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A_sum": [6], "B_sum": [15]}),+ strict=False,),],)@@ -1237,6 +1271,7 @@ class TestTransformHandler:create_test_dataframes({"A_min": [1], "B_min": [4], "A_max": [3], "B_max": [6]},),+ strict=False,),),)@@ -1258,6 +1293,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [1, 2, 3]}),+ strict=False,)),)@@ -1277,6 +1313,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),+ strict=False,)),)@@ -1296,6 +1333,7 @@ class TestTransformHandler:zip(create_test_dataframes({"A": [1, 2, 3], "B": [4, 5, 6]}),create_test_dataframes({"A": [2, 3, 1], "B": [5, 6, 4]}),+ strict=False,)),)@@ -1365,6 +1403,7 @@ class TestTransformHandler:create_test_dataframes({"B": [1], "foo": [1], "bar": ["hello"]}),+ strict=False,)),)@@ -1411,6 +1450,7 @@ class TestTransformHandler:create_test_dataframes({"A": ["a", "b", "c"], "B": [1, 3, 5]},),+ strict=False,)],],@@ -1511,6 +1551,7 @@ class TestTransformHandler:aggregation="sum",)],+ strict=False,),*zip(create_test_dataframes(@@ -1568,6 +1609,7 @@ class TestTransformHandler:aggregation="sum",)],+ strict=False,),*zip(create_test_dataframes(@@ -1610,6 +1652,7 @@ class TestTransformHandler:aggregation="sum",)],+ strict=False,),*zip(create_test_dataframes(@@ -1645,6 +1688,7 @@ class TestTransformHandler:aggregation="sum",)],+ strict=False,),],)@@ -1692,6 +1736,7 @@ class TestTransformHandler:create_test_dataframes({"A": [1, 2, 3], "B": [4, 6, 5]}),create_test_dataframes({"A": [3, 2], "B": [5, 6]}),create_test_dataframes({"A": [2], "B": [6]}),+ strict=False,)),)@@ -1855,6 +1900,7 @@ class TestTransformHandler:create_test_dataframes({"date": [date(2001, 1, 1)]}, exclude=["pyarrow"]),+ strict=False,)),)@@ -1900,6 +1946,7 @@ class TestTransformHandler:create_test_dataframes({"nulls": [float("nan")]}, include=["pandas"]),+ strict=False,)),)@@ -1929,6 +1976,7 @@ class TestTransformHandler:{"nulls": [1, 2, 3, None, "hello"]}, include=["pandas"]),create_test_dataframes({"nulls": [None]}, include=["pandas"]),+ strict=False,)),)@@ -1962,6 +2010,7 @@ class TestTransformHandler:create_test_dataframes({"nulls": [float("nan")]}, exclude=["pandas", "ibis"]),+ strict=False,)),)@@ -1992,6 +2041,7 @@ class TestTransformHandler:strict=False,),create_test_dataframes({"nulls": [float("inf")]}),+ strict=False,)),)@@ -2022,6 +2072,7 @@ class TestTransformHandler:strict=False,),create_test_dataframes({"nulls": [float("-inf")]}),+ strict=False,)),)@@ -2063,6 +2114,7 @@ class TestTransformHandler:{"nulls": [float("nan"), float("inf"), None]},include=["pandas"],),+ strict=False,)),)@@ -2105,6 +2157,7 @@ class TestTransformHandler:{"nulls": [float("nan"), float("inf"), None]},exclude=["pandas", "ibis"],),+ strict=False,)),)diff --git a/tests/_plugins/ui/_impl/test_array.py b/tests/_plugins/ui/_impl/test_array.pyindex aa72fd5714..c015eff00e 100644--- a/tests/_plugins/ui/_impl/test_array.py+++ b/tests/_plugins/ui/_impl/test_array.py@@ -87,7 +87,7 @@ def test_container_emulation() -> None:assert array[0] == array.elements[0]assert array[1] == array.elements[1]# iter- for a, b in zip(array, array.elements):+ for a, b in zip(array, array.elements, strict=False):assert a == b# containsassert array[0] in arraydiff --git a/tests/_plugins/ui/_impl/test_dictionary.py b/tests/_plugins/ui/_impl/test_dictionary.pyindex bcc212c5c7..29a9e9b297 100644--- a/tests/_plugins/ui/_impl/test_dictionary.py+++ b/tests/_plugins/ui/_impl/test_dictionary.py@@ -65,7 +65,7 @@ def test_container_emulation() -> None:assert d["0"] == d.elements["0"]assert d["1"] == d.elements["1"]# iter- for a, b in zip(d, d.elements):+ for a, b in zip(d, d.elements, strict=False):assert a == b# containsassert "0" in ddiff --git a/tests/_plugins/ui/_impl/test_plotly.py b/tests/_plugins/ui/_impl/test_plotly.pyindex f552ac0595..e54191b0f4 100644--- a/tests/_plugins/ui/_impl/test_plotly.py+++ b/tests/_plugins/ui/_impl/test_plotly.py@@ -770,7 +770,7 @@ def test_heatmap_numpy_and_fallback_produce_same_results() -> None:fallback_sorted = sorted(fallback_result, key=sort_key)# Compare each cell- for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted):+ for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted, strict=False):assert np_cell["x"] == fb_cell["x"]assert np_cell["y"] == fb_cell["y"]assert np_cell["z"] == fb_cell["z"]@@ -863,7 +863,7 @@ def test_heatmap_numpy_and_fallback_datetime_x_axis() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted):+ for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted, strict=False):assert np_cell["x"] == fb_cell["x"]assert np_cell["y"] == fb_cell["y"]assert np_cell["z"] == fb_cell["z"]@@ -922,7 +922,7 @@ def test_scatter_numpy_and_fallback_datetime_x_axis() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_p, fb_p in zip(numpy_sorted, fallback_sorted):+ for np_p, fb_p in zip(numpy_sorted, fallback_sorted, strict=False):assert np_p["x"] == fb_p["x"]assert np_p["y"] == fb_p["y"]@@ -1002,7 +1002,7 @@ def test_bar_numpy_and_fallback_datetime_x_axis() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted):+ for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted, strict=False):assert np_bar["x"] == fb_bar["x"]assert np_bar["y"] == fb_bar["y"]@@ -1601,7 +1601,7 @@ def test_scatter_points_numpy_and_fallback() -> None:fallback_sorted = sorted(fallback_result, key=sort_key)# Compare each point- for np_point, fb_point in zip(numpy_sorted, fallback_sorted):+ for np_point, fb_point in zip(numpy_sorted, fallback_sorted, strict=False):assert np_point["x"] == fb_point["x"]assert np_point["y"] == fb_point["y"]assert np_point["curveNumber"] == fb_point["curveNumber"]@@ -1705,7 +1705,7 @@ def test_scattergl_points_numpy_and_fallback() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_point, fb_point in zip(numpy_sorted, fallback_sorted):+ for np_point, fb_point in zip(numpy_sorted, fallback_sorted, strict=False):assert np_point["x"] == fb_point["x"]assert np_point["y"] == fb_point["y"]assert np_point["curveNumber"] == fb_point["curveNumber"]@@ -2578,7 +2578,7 @@ def test_bar_numpy_and_fallback_match_categorical() -> None:fallback_sorted = sorted(fallback_result, key=sort_key)# Compare each bar- for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted):+ for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted, strict=False):assert np_bar["x"] == fb_bar["x"]assert np_bar["y"] == fb_bar["y"]assert np_bar["curveNumber"] == fb_bar["curveNumber"]@@ -2607,7 +2607,7 @@ def test_bar_numpy_and_fallback_match_numeric() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted):+ for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted, strict=False):assert np_bar["x"] == fb_bar["x"]assert np_bar["y"] == fb_bar["y"]assert np_bar["curveNumber"] == fb_bar["curveNumber"]@@ -2637,7 +2637,7 @@ def test_bar_numpy_and_fallback_match_horizontal() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted):+ for np_bar, fb_bar in zip(numpy_sorted, fallback_sorted, strict=False):assert np_bar["x"] == fb_bar["x"]assert np_bar["y"] == fb_bar["y"]assert np_bar["curveNumber"] == fb_bar["curveNumber"]@@ -2659,7 +2659,7 @@ def test_histogram_numpy_and_fallback_match_numeric() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_point, fb_point in zip(numpy_sorted, fallback_sorted):+ for np_point, fb_point in zip(numpy_sorted, fallback_sorted, strict=False):assert np_point == fb_point@@ -2742,7 +2742,7 @@ def test_histogram_numpy_and_fallback_match_categorical() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_point, fb_point in zip(numpy_sorted, fallback_sorted):+ for np_point, fb_point in zip(numpy_sorted, fallback_sorted, strict=False):assert np_point == fb_point@@ -2774,7 +2774,7 @@ def test_heatmap_numpy_and_fallback_numeric_axes() -> None:numpy_sorted = sorted(numpy_result, key=sort_key)fallback_sorted = sorted(fallback_result, key=sort_key)- for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted):+ for np_cell, fb_cell in zip(numpy_sorted, fallback_sorted, strict=False):assert np_cell["x"] == fb_cell["x"]assert np_cell["y"] == fb_cell["y"]assert np_cell["z"] == fb_cell["z"]@@ -3249,6 +3249,7 @@ def test_waterfall_numpy_and_fallback_match() -> None:for np_pt, fb_pt in zip(sorted(numpy_result, key=lambda p: p["pointIndex"]),sorted(fallback_result, key=lambda p: p["pointIndex"]),+ strict=False,):assert np_pt["x"] == fb_pt["x"]assert np_pt["y"] == fb_pt["y"]diff --git a/tests/_plugins/ui/_impl/test_ui_mpl.py b/tests/_plugins/ui/_impl/test_ui_mpl.pyindex e1ee40a3ff..cbe3d26e74 100644--- a/tests/_plugins/ui/_impl/test_ui_mpl.py+++ b/tests/_plugins/ui/_impl/test_ui_mpl.py@@ -289,7 +289,7 @@ def test_axes_bounds_match_constrained_layout() -> None:bbox.x1 * w,(1 - bbox.y0) * h,]- for actual, exp in zip(args["axes-pixel-bounds"], expected):+ for actual, exp in zip(args["axes-pixel-bounds"], expected, strict=False):assert abs(actual - exp) < 1e-6@@ -320,7 +320,7 @@ def test_axes_bounds_match_tight_layout() -> None:bbox.x1 * w,(1 - bbox.y0) * h,]- for actual, exp in zip(args["axes-pixel-bounds"], expected):+ for actual, exp in zip(args["axes-pixel-bounds"], expected, strict=False):assert abs(actual - exp) < 1e-6diff --git a/tests/_pyodide/test_bootstrap.py b/tests/_pyodide/test_bootstrap.pyindex 9d77069845..645bbf6617 100644--- a/tests/_pyodide/test_bootstrap.py+++ b/tests/_pyodide/test_bootstrap.py@@ -2,7 +2,7 @@from __future__ import annotationsimport json-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyimport pytest@@ -15,6 +15,7 @@ from marimo._session.model import SessionModefrom marimo._types.ids import CellId_tif TYPE_CHECKING:+ from collections.abc import Callablefrom pathlib import Pathdiff --git a/tests/_runtime/test_pytest_runtime.py b/tests/_runtime/test_pytest_runtime.pyindex 864a0be71c..a7b1d9c0ea 100644--- a/tests/_runtime/test_pytest_runtime.py+++ b/tests/_runtime/test_pytest_runtime.py@@ -109,7 +109,9 @@ def test_isolation_cells(notebook_env):defs=cell.defs, lcls=lcls, notebook_path=path)expected = tuple(- map(sum, zip(*[_DEF_COUNT[d] for d in cell.defs]))+ map(+ sum, zip(*[_DEF_COUNT[d] for d in cell.defs], strict=False)+ ))assert (response.passed,diff --git a/tests/_server/api/endpoints/test_ws.py b/tests/_server/api/endpoints/test_ws.pyindex a6eb1f08be..1d31e717ca 100644--- a/tests/_server/api/endpoints/test_ws.py+++ b/tests/_server/api/endpoints/test_ws.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport asynciofrom contextlib import contextmanagerfrom pathlib import Path-from typing import TYPE_CHECKING, Any, Callable+from typing import TYPE_CHECKING, Anyfrom unittest.mock import MagicMock, patchimport pytest@@ -31,6 +31,8 @@ from tests._server.conftest import get_kernel_tasks, get_user_config_managerfrom tests._server.mocks import get_session_managerif TYPE_CHECKING:+ from collections.abc import Callable+from starlette.testclient import TestClient, WebSocketTestSessiondiff --git a/tests/_server/mocks.py b/tests/_server/mocks.pyindex ded3dac375..6380a8d4f2 100644--- a/tests/_server/mocks.py+++ b/tests/_server/mocks.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport base64import contextlibimport tempfile-from typing import TYPE_CHECKING, Any, Callable, Optional, cast+from typing import TYPE_CHECKING, Any, Optional, castfrom marimo._config.manager import (MarimoConfigManager,@@ -20,7 +20,7 @@ from marimo._session.model import SessionModefrom marimo._utils.marimo_path import MarimoPathif TYPE_CHECKING:- from collections.abc import Iterator+ from collections.abc import Callable, Iteratorfrom starlette.testclient import TestClientdiff --git a/tests/_server/test_sessions.py b/tests/_server/test_sessions.pyindex 08c2314d24..7052a24354 100644--- a/tests/_server/test_sessions.py+++ b/tests/_server/test_sessions.py@@ -9,11 +9,12 @@ import queueimport sysimport threadingimport time+from collections.abc import Callablefrom multiprocessing.queues import Queue as MPQueuefrom pathlib import Pathfrom tempfile import NamedTemporaryFilefrom textwrap import dedent-from typing import Any, Callable, TypeVar+from typing import Any, TypeVarfrom unittest.mock import MagicMockimport pytestdiff --git a/tests/_session/state/test_session_view.py b/tests/_session/state/test_session_view.pyindex 2994f51727..d23b9b8b3c 100644--- a/tests/_session/state/test_session_view.py+++ b/tests/_session/state/test_session_view.py@@ -459,6 +459,7 @@ class TestModelReplayState:zip([tuple(p) for p in msg.buffer_paths],msg.buffers,+ strict=False,))assert path_buf == {("img",): b"png", ("data",): b"csv"}diff --git a/tests/_sql/test_connection_utils.py b/tests/_sql/test_connection_utils.pyindex 1dfdac7a5f..1ae69b97fe 100644--- a/tests/_sql/test_connection_utils.py+++ b/tests/_sql/test_connection_utils.py@@ -2,7 +2,7 @@from __future__ import annotationsimport time-from typing import Callable+from typing import TYPE_CHECKINGimport pytest@@ -20,6 +20,9 @@ from marimo._sql.connection_utils import (update_table_list_in_connection,)+if TYPE_CHECKING:+ from collections.abc import Callable+TIME_THRESHOLD_SECONDS = 0.1diff --git a/tests/_utils/test_lifespans.py b/tests/_utils/test_lifespans.pyindex 35e45ef5d8..e345a6339c 100644--- a/tests/_utils/test_lifespans.py+++ b/tests/_utils/test_lifespans.py@@ -1,7 +1,6 @@import asyncio-from collections.abc import AsyncIterator+from collections.abc import AsyncIterator, Callablefrom contextlib import asynccontextmanager-from typing import Callableimport pytestdiff --git a/tests/utils.py b/tests/utils.pyindex 9359e86ad0..2fa40c0515 100644--- a/tests/utils.py+++ b/tests/utils.py@@ -11,7 +11,7 @@ from marimo._messaging.msgspec_encoder import (from marimo._utils.parse_dataclass import parse_rawif TYPE_CHECKING:- from typing import Callable+ from collections.abc import Callableimport msgspec