Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions marimo/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from marimo._cli.cli import main

if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions marimo/_ai/_tools/tools/notebooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Optional

Expand Down
4 changes: 3 additions & 1 deletion marimo/_ai/_tools/tools/tables_and_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Optional

Expand Down Expand Up @@ -63,7 +65,7 @@ def handle(self, args: TablesAndVariablesArgs) -> TablesAndVariablesOutput:
return self._get_tables_and_variables(session, args.variable_names)

def _get_tables_and_variables(
self, session: "Session", variable_names: list[str]
self, session: Session, variable_names: list[str]
) -> TablesAndVariablesOutput:
session_view = session.session_view
# convert to set for O(1) lookup
Expand Down
2 changes: 2 additions & 0 deletions marimo/_ai/_tools/tools_registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from typing import Any

from marimo._ai._tools.base import ToolBase
Expand Down
1 change: 1 addition & 0 deletions marimo/_ai/llm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2025 Marimo. All rights reserved.

from marimo._ai.llm._impl import anthropic, bedrock, google, groq, openai

__all__ = ["openai", "anthropic", "google", "groq", "bedrock"]
1 change: 1 addition & 0 deletions marimo/_ast/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
5 changes: 3 additions & 2 deletions marimo/_ast/app_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

import os
from dataclasses import asdict, dataclass, field
Expand Down Expand Up @@ -43,7 +44,7 @@ class _AppConfig:
@staticmethod
def from_untrusted_dict(
updates: dict[str, Any], silent: bool = False
) -> "_AppConfig":
) -> _AppConfig:
# Certain flags are useful to pass to App for construction, but
# shouldn't make it into the config. (e.g. the _filename flag is
# internal)
Expand All @@ -65,7 +66,7 @@ def asdict(self) -> dict[str, Any]:
k: v for (k, v) in asdict(self).items() if not k.startswith("_")
}

def update(self, updates: dict[str, Any]) -> "_AppConfig":
def update(self, updates: dict[str, Any]) -> _AppConfig:
config_dict = asdict(self)
for key in updates:
if key in config_dict:
Expand Down
2 changes: 2 additions & 0 deletions marimo/_ast/cell_id.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

import random
import string
from uuid import UUID, uuid4
Expand Down
1 change: 1 addition & 0 deletions marimo/_ast/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations


class SetupRootError(Exception):
Expand Down
2 changes: 2 additions & 0 deletions marimo/_ast/names.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

DEFAULT_CELL_NAME = "_"
SETUP_CELL_NAME = "setup"
# Intentionally an invalid name character
Expand Down
1 change: 1 addition & 0 deletions marimo/_ast/sql_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from typing import Literal, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions marimo/_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
2 changes: 2 additions & 0 deletions marimo/_cli/cli_validators.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from pathlib import Path
from typing import Any, Optional

Expand Down
2 changes: 2 additions & 0 deletions marimo/_cli/export/cloudflare.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from pathlib import Path

from marimo._cli.print import bold, echo, green
Expand Down
6 changes: 5 additions & 1 deletion marimo/_cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from pathlib import Path
from sys import stdout
from typing import TYPE_CHECKING

import click

from marimo._config.settings import GLOBAL_SETTINGS

if TYPE_CHECKING:
from pathlib import Path


def prompt_to_overwrite(path: Path) -> bool:
if GLOBAL_SETTINGS.YES:
Expand Down
1 change: 1 addition & 0 deletions marimo/_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
2 changes: 2 additions & 0 deletions marimo/_convert/notebook.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from marimo._schemas.notebook import (
NotebookCell,
NotebookCellConfig,
Expand Down
2 changes: 2 additions & 0 deletions marimo/_entrypoints/ids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from typing import Literal

# Internal entrypoints. Not user-facing as the API is not stable.
Expand Down
4 changes: 3 additions & 1 deletion marimo/_entrypoints/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

import os
from importlib.metadata import entry_points
from typing import TYPE_CHECKING, Generic, Optional, TypeVar, cast
Expand Down Expand Up @@ -150,7 +152,7 @@ def __repr__(self) -> str:
return f"{type(self).__name__}(group={self.entry_point_group!r}, registered={self.names()!r})"


def get_entry_points(group: KnownEntryPoint) -> "EntryPoints":
def get_entry_points(group: KnownEntryPoint) -> EntryPoints:
ep = entry_points()
if hasattr(ep, "select"):
return ep.select(group=group)
Expand Down
1 change: 1 addition & 0 deletions marimo/_islands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2024 Marimo. All rights reserved.

__all__ = [
"MarimoIslandGenerator",
"MarimoIslandStub",
Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/formatters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2025 Marimo. All rights reserved.
"""Formatters for diagnostic output."""

from __future__ import annotations

from marimo._lint.formatters.base import DiagnosticFormatter
from marimo._lint.formatters.full import FullFormatter
from marimo._lint.formatters.json import (
Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/rules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from marimo._lint.rules.base import LintRule
from marimo._lint.rules.breaking import BREAKING_RULE_CODES
from marimo._lint.rules.formatting import FORMATTING_RULE_CODES
Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/rules/breaking/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from marimo._lint.rules.base import LintRule
from marimo._lint.rules.breaking.graph import (
CycleDependenciesRule,
Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/rules/formatting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from marimo._lint.rules.base import LintRule, UnsafeFixRule
from marimo._lint.rules.formatting.empty_cells import EmptyCellRule
from marimo._lint.rules.formatting.general import GeneralFormattingRule
Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/rules/runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

from marimo._lint.rules.base import LintRule
from marimo._lint.rules.runtime.self_import import SelfImportRule

Expand Down
2 changes: 2 additions & 0 deletions marimo/_lint/visitors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2025 Marimo. All rights reserved.
"""AST visitors for linting purposes."""

from __future__ import annotations

import ast
from typing import Optional

Expand Down
7 changes: 5 additions & 2 deletions marimo/_mcp/server/lifespan.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

import contextlib
from collections.abc import AsyncIterator
from typing import TYPE_CHECKING

from marimo._loggers import marimo_logger

LOGGER = marimo_logger()

if TYPE_CHECKING:
from collections.abc import AsyncIterator

from starlette.applications import Starlette


@contextlib.asynccontextmanager
async def mcp_server_lifespan(app: "Starlette") -> AsyncIterator[None]:
async def mcp_server_lifespan(app: Starlette) -> AsyncIterator[None]:
"""Lifespan for MCP server functionality (exposing marimo as MCP server)."""

try:
Expand Down
6 changes: 4 additions & 2 deletions marimo/_mcp/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
notebook context and functionality.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from marimo._ai._tools.base import ToolContext
Expand All @@ -17,9 +19,10 @@

if TYPE_CHECKING:
from starlette.applications import Starlette
from starlette.types import Receive, Scope, Send


def setup_mcp_server(app: "Starlette") -> None:
def setup_mcp_server(app: Starlette) -> None:
"""Create and configure MCP server for marimo integration.

Args:
Expand All @@ -34,7 +37,6 @@ def setup_mcp_server(app: "Starlette") -> None:
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.responses import JSONResponse
from starlette.routing import Mount
from starlette.types import Receive, Scope, Send

mcp = FastMCP(
"marimo-mcp-server",
Expand Down
1 change: 1 addition & 0 deletions marimo/_messaging/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_output/formatters/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
2 changes: 2 additions & 0 deletions marimo/_output/justify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from marimo._output.formatting import as_html
from marimo._output.hypertext import Html
from marimo._output.rich_help import mddoc
Expand Down
6 changes: 5 additions & 1 deletion marimo/_output/md_extensions/breakless_lists.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

import re
from xml.etree.ElementTree import Element
from typing import TYPE_CHECKING

from markdown import ( # type: ignore
Extension,
Expand All @@ -10,6 +11,9 @@
treeprocessors,
)

if TYPE_CHECKING:
from xml.etree.ElementTree import Element


class BreaklessListsPreprocessor(preprocessors.Preprocessor): # type: ignore[misc]
"""
Expand Down
7 changes: 6 additions & 1 deletion marimo/_output/md_extensions/external_links.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from typing import TYPE_CHECKING
from urllib.parse import urlparse
from xml.etree.ElementTree import Element

from markdown import Extension, Markdown, treeprocessors # type: ignore

if TYPE_CHECKING:
from xml.etree.ElementTree import Element

# Adapted from https://github.com/squidfunk/mkdocs-material/discussions/3660#discussioncomment-6725823 # noqa: E501


Expand Down
1 change: 1 addition & 0 deletions marimo/_output/md_extensions/flexible_indent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

import re

Expand Down
2 changes: 2 additions & 0 deletions marimo/_output/superjson.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2025 Marimo. All rights reserved.
# This data serializes
from __future__ import annotations

from typing import Any


Expand Down
1 change: 1 addition & 0 deletions marimo/_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_plugins/stateless/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_plugins/ui/_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_plugins/ui/_impl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_plugins/ui/_impl/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
1 change: 1 addition & 0 deletions marimo/_plugins/ui/_impl/dataframes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
2 changes: 2 additions & 0 deletions marimo/_pyodide/restartable_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2025 Marimo. All rights reserved.
from __future__ import annotations

import asyncio
from typing import Any, Callable, Optional

Expand Down
1 change: 1 addition & 0 deletions marimo/_runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
2 changes: 2 additions & 0 deletions marimo/_runtime/context/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

__all__ = [
"get_context",
"safe_get_context",
Expand Down
4 changes: 3 additions & 1 deletion marimo/_runtime/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

import os
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable
Expand Down Expand Up @@ -34,7 +36,7 @@ def interrupt_handler(signum: int, frame: Any) -> None:
return interrupt_handler


def construct_sigterm_handler(kernel: "Kernel") -> Callable[[int, Any], None]:
def construct_sigterm_handler(kernel: Kernel) -> Callable[[int, Any], None]:
del kernel

@dataclass
Expand Down
2 changes: 2 additions & 0 deletions marimo/_runtime/input_override.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

import functools
import sys

Expand Down
2 changes: 2 additions & 0 deletions marimo/_runtime/packages/package_managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations

from marimo._runtime.packages.conda_package_manager import PixiPackageManager
from marimo._runtime.packages.package_manager import PackageManager
from marimo._runtime.packages.pypi_package_manager import (
Expand Down
1 change: 1 addition & 0 deletions marimo/_runtime/reload/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Copyright 2024 Marimo. All rights reserved.
from __future__ import annotations
Loading
Loading