sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
marimo-team/marimo:tests/_runtime/test_runtime_datasets.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._dependencies.dependencies import DependencyManager
from marimo._messaging.notification import (
DataSourceConnectionsNotification,
SQLMetadata,
SQLTableListPreviewNotification,
SQLTablePreviewN... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/test_runtime_datasets.py",
"license": "Apache License 2.0",
"lines": 502,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_sql/test_sql_parse.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from textwrap import dedent
import pytest
from marimo._dependencies.dependencies import DependencyManager
from marimo._sql.parse import (
SqlParseError,
SqlParseResult,
format_query_with_globals,
parse_sql,
replace_... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_sql/test_sql_parse.py",
"license": "Apache License 2.0",
"lines": 745,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/anywidget_smoke_tests/uchimata_example.py | # /// script
# requires-python = ">=3.12"
# dependencies = [
# "anywidget==0.9.18",
# "numpy==2.3.3",
# "polars==1.33.1",
# "traitlets==5.14.3",
# "uchimata==0.3.0",
# ]
# ///
import marimo
__generated_with = "0.19.7"
app = marimo.App(width="medium")
@app.cell
def _():
import anywidget
i... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/anywidget_smoke_tests/uchimata_example.py",
"license": "Apache License 2.0",
"lines": 66,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_output/md_extensions/breakless_lists.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import re
from typing import TYPE_CHECKING
from markdown import ( # type: ignore
Extension,
Markdown,
preprocessors,
treeprocessors,
)
if TYPE_CHECKING:
from xml.etree.ElementTree import Element
class BreaklessLis... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_output/md_extensions/breakless_lists.py",
"license": "Apache License 2.0",
"lines": 88,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_output/md_extensions/flexible_indent.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import re
from markdown import Extension, Markdown, preprocessors # type: ignore
class FlexibleIndentPreprocessor(preprocessors.Preprocessor): # type: ignore[misc]
"""
Preprocessor to standardize list indentation to specific ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_output/md_extensions/flexible_indent.py",
"license": "Apache License 2.0",
"lines": 105,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/api/endpoints/sql.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from starlette.authentication import requires
from marimo._server.api.utils import dispatch_control_request
from marimo._server.models.models import BaseResponse, ValidateSQLRequest
from marimo._server.r... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/api/endpoints/sql.py",
"license": "Apache License 2.0",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:tests/_server/api/endpoints/test_sql_endpoints.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from tests._server.mocks import token_header, with_read_session, with_session
if TYPE_CHECKING:
from starlette.testclient import TestClient
SESSION_ID = "session-123"
HEADERS = {
"Marimo-Session... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/api/endpoints/test_sql_endpoints.py",
"license": "Apache License 2.0",
"lines": 36,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/sql_error_handling.py | # /// script
# requires-python = ">=3.11"
# dependencies = [
# "duckdb",
# "marimo",
# ]
# ///
# Copyright 2026 Marimo. All rights reserved.
import marimo
__generated_with = "0.16.1"
app = marimo.App(width="medium")
with app.setup(hide_code=True):
import marimo as mo
import duckdb
@app.cell(hide_co... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/sql_error_handling.py",
"license": "Apache License 2.0",
"lines": 377,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_sql/error_utils.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Callable, Optional, TypedDict
from marimo._dependencies.dependencies import DependencyManager
if TYPE_CHECKING:
import ast
from marimo._messaging.errors import MarimoSQLError
from ma... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_sql/error_utils.py",
"license": "Apache License 2.0",
"lines": 213,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_sql/test_sql_error_handling.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._dependencies.dependencies import DependencyManager
from marimo._messaging.errors import MarimoSQLError
from marimo._sql.error_utils import (
MarimoSQLException,
_extract_sql_position,
create_sql_er... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_sql/test_sql_error_handling.py",
"license": "Apache License 2.0",
"lines": 323,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/sql_parsing_errors.py | # Copyright 2026 Marimo. All rights reserved.
"""Test file with SQL parsing errors to test log rules positioning."""
import marimo
__generated_with = "0.8.0"
app = marimo.App()
@app.cell
def _():
import marimo as mo
return mo,
@app.cell
def _(mo):
# This should trigger an MF005 SQL parsing error due t... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/sql_parsing_errors.py",
"license": "Apache License 2.0",
"lines": 47,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_log_rules.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import logging
from marimo._lint.context import LintContext, RuleContext
from marimo._lint.rules.formatting.parsing import (
MiscLogRule,
SqlParseRule,
)
from marimo._schemas.serialization import NotebookSerialization
class Tes... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_log_rules.py",
"license": "Apache License 2.0",
"lines": 134,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_sql_log_rules_snapshot.py | # Copyright 2026 Marimo. All rights reserved.
"""Snapshot tests for SQL log message lint rules."""
import pytest
from marimo._ast.parse import parse_notebook
from tests._lint.utils import lint_notebook
from tests.mocks import snapshotter
snapshot = snapshotter(__file__)
# Only run this in 3.12 since the formatting... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_sql_log_rules_snapshot.py",
"license": "Apache License 2.0",
"lines": 26,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_utils/test_strings.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import pytest
from marimo._utils.platform import is_windows
from marimo._utils.strings import (
_mslex_quote,
_quote_for_cmd,
_wrap_in_quotes,
cmd_quote,
standardize_annotation_quotes,
)
class TestCmdQuote:
"""T... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_strings.py",
"license": "Apache License 2.0",
"lines": 173,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_ignore_scripts.py | # Copyright 2026 Marimo. All rights reserved.
from marimo._lint import run_check
def test_ignore_scripts_flag(tmp_path):
"""Test that --ignore-scripts suppresses errors for non-marimo files."""
# Create a temporary non-marimo Python file
temp_file = tmp_path / "test_script.py"
temp_file.write_text("... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_ignore_scripts.py",
"license": "Apache License 2.0",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/slides_examples/centered_slides.py | import marimo
__generated_with = "0.16.0"
app = marimo.App(
width="medium",
layout_file="layouts/centered_slides.slides.json",
)
@app.cell
def _():
import marimo as mo
mo.iframe("https://marimo.io/")
return (mo,)
@app.cell
def _(mo):
mo.iframe("https://marimo.io/", height="600px")
retu... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/slides_examples/centered_slides.py",
"license": "Apache License 2.0",
"lines": 49,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ai/_tools/tools/datasource.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Optional
from marimo import _loggers
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.types import SuccessResult, ToolGuidelines
from marimo._a... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools/datasource.py",
"license": "Apache License 2.0",
"lines": 152,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_utils/fuzzy_match.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import re
def compile_regex(query: str) -> tuple[re.Pattern[str] | None, bool]:
"""
Returns compiled regex pattern and whether the query is a valid regex.
"""
try:
return re.compile(query, re.IGNORECASE), True
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/fuzzy_match.py",
"license": "Apache License 2.0",
"lines": 29,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_ai/tools/tools/test_datasource_tool.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
import pytest
from marimo._ai._tools.base import ToolContext
from marimo._ai._tools.tools.datasource import (
GetDatabaseTables,
GetDatabaseTablesArgs,
TableDeta... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/tools/test_datasource_tool.py",
"license": "Apache License 2.0",
"lines": 532,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_utils/test_fuzzy_match.py | # Copyright 2026 Marimo. All rights reserved.
from marimo._utils.fuzzy_match import compile_regex, is_fuzzy_match
def test_compile_regex_valid_pattern():
"""Test _compile_regex with valid regex pattern."""
pattern, is_regex = compile_regex("^user.*")
assert pattern is not None
assert is_regex is Tr... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_fuzzy_match.py",
"license": "Apache License 2.0",
"lines": 37,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_server/test_file_manager_filename.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from pathlib import Path
import pytest
from marimo._session.notebook import AppFileManager
from marimo._utils.http import HTTPException
from tests.mocks import EDGE_CASE_FILENAMES
class TestAppFileManagerFilenames:
"""Test AppFile... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/test_file_manager_filename.py",
"license": "Apache License 2.0",
"lines": 45,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_server/test_templates_filename.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import json
import pytest
from marimo._ast.app_config import _AppConfig
from marimo._config.config import MarimoConfig, PartialMarimoConfig
from marimo._server.templates.templates import (
_get_mount_config,
_html_escape,
js... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/test_templates_filename.py",
"license": "Apache License 2.0",
"lines": 302,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_server/test_utils_filename.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
import pytest
from marimo._session.notebook.file_manager import canonicalize_filename
class TestCanonicalizeFilename:
"""Test filename canonicalization with unicode, spaces, and special characters."""
@pytest.mark.p... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/test_utils_filename.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/star_import.py | import marimo
__generated_with = "0.15.2"
app = marimo.App()
@app.cell
def _():
# This should trigger MB005 - syntax error with star import hint
from math import *
result = sin(pi / 2)
return result,
@app.cell
def _():
from pandas import *
df = DataFrame({"a": [1, 2, 3]})
return df,
@... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/star_import.py",
"license": "Apache License 2.0",
"lines": 38,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_ai/_tools/tools/tables_and_variables.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Optional
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.types import SuccessResult, ToolGuidelines
from marimo._data.models import DataTableColumn
from marim... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools/tables_and_variables.py",
"license": "Apache License 2.0",
"lines": 105,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ai/_tools/tools_registry.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Any
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.tools.cells import (
GetCellOutputs,
GetCellRuntimeData,
GetLightweightCellMap,
)
from marimo._ai._tools.tools.datasource import GetDat... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools_registry.py",
"license": "Apache License 2.0",
"lines": 28,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_ai/tools/tools/test_tables_variables.py | from __future__ import annotations
from dataclasses import dataclass, field
import pytest
from marimo._ai._tools.base import ToolContext
from marimo._ai._tools.tools.tables_and_variables import (
DataTableMetadata,
GetTablesAndVariables,
TablesAndVariablesOutput,
)
from marimo._data.models import DataTab... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/tools/test_tables_variables.py",
"license": "Apache License 2.0",
"lines": 238,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_lint/rules/formatting/empty_cells.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import ast
from typing import TYPE_CHECKING
from marimo._ast.parse import ast_parse
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import UnsafeFixRule
from marimo._schemas.serialization import Note... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/formatting/empty_cells.py",
"license": "Apache License 2.0",
"lines": 153,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:tests/_lint/test_empty_cells.py | # Copyright 2026 Marimo. All rights reserved.
"""Snapshot tests for empty cells lint rule."""
from marimo._ast.parse import parse_notebook
from tests._lint.utils import lint_notebook
from tests.mocks import snapshotter
snapshot = snapshotter(__file__)
def test_empty_cells_detection_snapshot():
"""Test snapshot ... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_empty_cells.py",
"license": "Apache License 2.0",
"lines": 18,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/empty_cells.py | import marimo
__generated_with = "0.15.5"
app = marimo.App()
@app.cell
def _():
return
@app.cell
def has_pass():
# This is just a comment
pass
return
@app.cell
def has_comment():
# Only comment
# Another comment
return
@app.cell
def has_mix():
# Only whitespace and comment
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/empty_cells.py",
"license": "Apache License 2.0",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_messaging/test_serde.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import json
import msgspec
import pytest
from marimo._messaging.notification import (
AlertNotification,
CompletedRunNotification,
InterruptedNotification,
)
from marimo._messaging.serde import (
deserialize_kernel_messa... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_messaging/test_serde.py",
"license": "Apache License 2.0",
"lines": 116,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_data/test_models.py | from marimo._data.models import DataTableColumn
from tests.utils import assert_serialize_roundtrip
def test_data_table_column_post_init() -> None:
column = DataTableColumn(
name=123,
type="string",
external_type="string",
sample_values=[],
)
assert column.name == "123"
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_data/test_models.py",
"license": "Apache License 2.0",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_lint/rules/breaking/syntax_error.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from marimo._ast.errors import ImportStarError
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import LintRule
if TYPE_CHECKING:
from marimo._lint.context import... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/breaking/syntax_error.py",
"license": "Apache License 2.0",
"lines": 135,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_lint/test_files/syntax_errors.py | import marimo
__generated_with = "0.15.5"
app = marimo.App(width="medium")
@app.cell
def global_error():
tickers = ["AAPL", "GOOGL"]
global tickers #
@app.cell
def return_error(tickers):
if tickers is not None:
return tickers
return
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/syntax_errors.py",
"license": "Apache License 2.0",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:scripts/generate_lint_docs.py | # /// script
# requires-python = ">=3.13,<3.14"
# dependencies = []
#
# [tool.uv]
# exclude-newer = "2025-06-27T12:38:25.742953-04:00"
# ///
"""Generate documentation for marimo's lint rules.
This script automatically generates comprehensive documentation for all lint rules
in the marimo codebase, including:
- Main ru... | {
"repo_id": "marimo-team/marimo",
"file_path": "scripts/generate_lint_docs.py",
"license": "Apache License 2.0",
"lines": 401,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_utils/once.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import weakref
from functools import wraps
from typing import Any, Callable, TypeVar, cast
F = TypeVar("F", bound=Callable[..., Any])
def once(func: F) -> F:
"""
Decorator to ensure a function is called only once.
For metho... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/once.py",
"license": "Apache License 2.0",
"lines": 36,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_server/ai/tools/test_tool_manager.py | from __future__ import annotations
import pytest
from starlette.applications import Starlette
from marimo._ai._tools.tools_registry import SUPPORTED_BACKEND_AND_MCP_TOOLS
from marimo._server.ai.tools.tool_manager import ToolManager
from marimo._server.ai.tools.types import ToolCallResult
from tests._server.mocks impo... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/ai/tools/test_tool_manager.py",
"license": "Apache License 2.0",
"lines": 91,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_utils/test_once.py | # Copyright 2026 Marimo. All rights reserved.
from typing import Any
import pytest
from marimo._utils.once import once
def test_once_basic_functionality() -> None:
"""Test that a function decorated with @once is called only once."""
call_count = 0
@once
def increment() -> int:
nonlocal call... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_once.py",
"license": "Apache License 2.0",
"lines": 299,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_lint/context.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import asyncio
import heapq
import logging # noqa: TC003
import threading
from typing import TYPE_CHECKING
from marimo._ast.names import SETUP_CELL_NAME
# Note: load_notebook_ir not used - we do manual compilation for per-cell log capt... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/context.py",
"license": "Apache License 2.0",
"lines": 263,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_lint/diagnostic.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from typing import Literal, Optional, cast
from marimo._types.ids import CellId_t
class Severity(Enum):
"""Severity levels for diagnostic errors."""
FORMATTING = "formatt... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/diagnostic.py",
"license": "Apache License 2.0",
"lines": 66,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_lint/linter.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import asyncio
import re
from collections.abc import AsyncIterator, Iterator
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Union
from marimo._ast.load import get_notebook_status
from ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/linter.py",
"license": "Apache License 2.0",
"lines": 353,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_lint/rule_engine.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Optional
from marimo._lint.context import LintContext, RuleContext
from marimo._lint.diagnostic import Severity
from marimo._lint.rules import RULE_CODES
from marimo._schemas.serialization... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rule_engine.py",
"license": "Apache License 2.0",
"lines": 122,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_lint/rules/base.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Literal
from marimo._lint.diagnostic import Severity
if TYPE_CHECKING:
from marimo._lint.context import RuleContext
from marimo._lint.diagnostic import Diagno... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/base.py",
"license": "Apache License 2.0",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_lint/rules/breaking/graph.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from abc import abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING
from marimo._ast.parse import ast_parse
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import LintRu... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/breaking/graph.py",
"license": "Apache License 2.0",
"lines": 328,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_lint/rules/breaking/unparsable.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import LintRule
from marimo._schemas.serialization import UnparsableCell
if TYPE_CHECKING:
from marimo._lint.cont... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/breaking/unparsable.py",
"license": "Apache License 2.0",
"lines": 60,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_lint/rules/formatting/general.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import LintRule
if TYPE_CHECKING:
from marimo._lint.context import RuleContext
class GeneralFormattingRule(Lint... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/formatting/general.py",
"license": "Apache License 2.0",
"lines": 81,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_lint/rules/formatting/parsing.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import logging
import re
from typing import TYPE_CHECKING
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rules.base import LintRule
if TYPE_CHECKING:
from marimo._lint.context import RuleContext
class S... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/rules/formatting/parsing.py",
"license": "Apache License 2.0",
"lines": 227,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_lint/visitors.py | # Copyright 2026 Marimo. All rights reserved.
"""AST visitors for linting purposes."""
from __future__ import annotations
import ast
from typing import Optional
class VariableLineVisitor(ast.NodeVisitor):
"""AST visitor to find the line number of a variable definition."""
def __init__(self, target_variable... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_lint/visitors.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_cli/test_cli_check.py | # Copyright 2026 Marimo. All rights reserved.
"""CLI tests for the marimo check command."""
import tempfile
from click.testing import CliRunner
from marimo._cli.cli import check
class TestLintCLI:
"""Test the check CLI command."""
def test_check_command_basic(self):
"""Test basic check command fun... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_cli/test_cli_check.py",
"license": "Apache License 2.0",
"lines": 153,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_async_context_system.py | # Copyright 2026 Marimo. All rights reserved.
"""Unit tests for the async context-based lint system."""
from marimo._ast.parse import parse_notebook
from marimo._lint.context import LintContext, RuleContext
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rule_engine import RuleEngine
from ma... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_async_context_system.py",
"license": "Apache License 2.0",
"lines": 309,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/cycle_dependencies.py | import marimo
__generated_with = "0.15.2"
app = marimo.App()
@app.cell
def _(z):
x = 1 + z # This should trigger MR002 - cycle dependency
return (x,)
@app.cell
def _(x):
y = x + 1
return (y,)
@app.cell
def _(y):
z = y + 1
return (z,)
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/cycle_dependencies.py",
"license": "Apache License 2.0",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/formatting.py | """Example to test formatting issues."""
import marimo as mo # intentional to test import aliasing
statement = "not in a cell, so unexpected"
# no generate guard
app = mo.App()
statement = "not in a cell, so unexpected"
@app.cell
def _():
pass
# no run guard
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/formatting.py",
"license": "Apache License 2.0",
"lines": 10,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/multiple_definitions.py | import marimo
__generated_with = "0.15.2"
app = marimo.App()
@app.cell
def _():
print(1)
x = 1
return
@app.cell
def _():
x = 2 # This should trigger MR001 - multiple definitions
return
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/multiple_definitions.py",
"license": "Apache License 2.0",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/setup_dependencies.py | import marimo
__generated_with = "0.15.2"
app = marimo.App()
x = 1
with app.setup:
y = x + 1 # This should trigger MR003 - setup cell dependencies
@app.cell
def _():
x = 1
return (x,)
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/setup_dependencies.py",
"license": "Apache License 2.0",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_files/unparsable_cell.py | import marimo
__generated_with = "0.0.0"
app = marimo.App()
@app.cell
def _():
x = 1
return
# This should create an unparsable cell
app._unparsable_cell("""
x = 1 + # Syntax error
""")
@app.cell
def _():
y = 2
return
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_files/unparsable_cell.py",
"license": "Apache License 2.0",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_lint_system.py | # Copyright 2026 Marimo. All rights reserved.
"""Unit tests for the marimo lint system."""
from unittest.mock import patch
from marimo._ast.parse import parse_notebook
from marimo._lint.context import LintContext, RuleContext
from marimo._lint.rule_engine import RuleEngine
from marimo._lint.rules.base import Severity... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_lint_system.py",
"license": "Apache License 2.0",
"lines": 227,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_run_check.py | # Copyright 2026 Marimo. All rights reserved.
"""Unit tests for the run_check CLI integration."""
from pathlib import Path
from marimo._lint import FileStatus, Linter, run_check
from marimo._lint.diagnostic import Diagnostic, Severity
class TestRunCheck:
"""Test the run_check function and CLI integration."""
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_run_check.py",
"license": "Apache License 2.0",
"lines": 287,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/test_streaming_early_stopping.py | # Copyright 2026 Marimo. All rights reserved.
"""Unit tests for streaming diagnostics and early stopping functionality."""
import asyncio
from marimo._ast.parse import parse_notebook
from marimo._lint.context import LintContext
from marimo._lint.diagnostic import Diagnostic, Severity
from marimo._lint.rule_engine imp... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/test_streaming_early_stopping.py",
"license": "Apache License 2.0",
"lines": 310,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_lint/utils.py | """Utilities for lint tests."""
from marimo._lint.diagnostic import Diagnostic
from marimo._lint.rule_engine import RuleEngine
from marimo._schemas.serialization import NotebookSerializationV1
def lint_notebook(
notebook: NotebookSerializationV1, contents: str = ""
) -> list[Diagnostic]:
"""Lint a notebook a... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_lint/utils.py",
"license": "Apache License 2.0",
"lines": 10,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_ast/codegen_data/test_syntax_errors.py | import marimo
__generated_with = "0.15.5"
app = marimo.App(width="medium")
@app.cell
def global_error():
tickers = ["AAPL", "GOOGL"]
global tickers
@app.cell
def return_error(tickers):
if tickers is not None:
return tickers
return
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ast/codegen_data/test_syntax_errors.py",
"license": "Apache License 2.0",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_ast/codegen_data/test_decorators.py | import marimo
__generated_with = "0.15.3"
app = marimo.App(width="medium")
with app.setup():
def wrapper(fn):
return fn
# AST is slightly different when decorator is called
def called_wrapper():
return wrapper
@app.function
@wrapper
def my_wrapped():
pass
@wrapper
@app.function
de... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ast/codegen_data/test_decorators.py",
"license": "Apache License 2.0",
"lines": 62,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_output/superjson.py | # Copyright 2026 Marimo. All rights reserved.
# This data serializes
from __future__ import annotations
from typing import Any
class SuperJson: # noqa: B903
"""
This class bypasses the default msgspec encoder for the data provided and instead serializes
the result to something that is more human readabl... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_output/superjson.py",
"license": "Apache License 2.0",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:marimo/_ai/_tools/base.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import inspect
from abc import ABC, abstractmethod
from dataclasses import asdict, dataclass, is_dataclass
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
Optional,
TypeVar,
cast,
get_args,
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/base.py",
"license": "Apache License 2.0",
"lines": 424,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_ai/_tools/tools/cells.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import json
from dataclasses import dataclass, field
from enum import Enum
from typing import TYPE_CHECKING, Any, Optional
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.types import (
MarimoCellConsoleOutputs,
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools/cells.py",
"license": "Apache License 2.0",
"lines": 434,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_ai/_tools/tools/notebooks.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass, field
from marimo._ai._tools.base import ToolBase
from marimo._ai._tools.types import (
EmptyArgs,
MarimoNotebookInfo,
SuccessResult,
ToolGuidelines,
)
@dataclass
class SummaryInfo:
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/tools/notebooks.py",
"license": "Apache License 2.0",
"lines": 57,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ai/_tools/types.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal, Optional
from marimo._types.ids import CellId_t, SessionId
# helper classes
StatusValue = Literal["success", "error", "warning"]
@dataclass
class SuccessResult:... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/types.py",
"license": "Apache License 2.0",
"lines": 56,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ai/_tools/utils/exceptions.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import asdict, dataclass
from typing import Any, Optional
@dataclass
class ToolExecutionError(Exception):
"""Raise this from a tool to signal a descriptive, structured failure."""
message: str
code: str = "... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ai/_tools/utils/exceptions.py",
"license": "Apache License 2.0",
"lines": 31,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_ai/tools/test_base.py | from __future__ import annotations
import inspect
from dataclasses import dataclass
from typing import Any
import pytest
from marimo._ai._tools.base import ToolBase, ToolContext
from marimo._ai._tools.utils.exceptions import ToolExecutionError
@dataclass
class _Args:
value: int
@dataclass
class _Out:
dou... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/test_base.py",
"license": "Apache License 2.0",
"lines": 170,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_ai/tools/tools/test_cells.py | from __future__ import annotations
from dataclasses import dataclass, field
from unittest.mock import Mock
import pytest
from marimo._ai._tools.base import ToolContext
from marimo._ai._tools.tools.cells import (
CellRuntimeMetadata,
CellVariables,
GetCellOutputArgs,
GetCellOutputs,
GetCellRuntime... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/tools/test_cells.py",
"license": "Apache License 2.0",
"lines": 386,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_ai/tools/tools/test_notebooks.py | from __future__ import annotations
import os
from dataclasses import dataclass
from unittest.mock import Mock
import pytest
from marimo._ai._tools.base import ToolContext
from marimo._ai._tools.tools.notebooks import GetActiveNotebooks
from marimo._ai._tools.types import EmptyArgs, MarimoNotebookInfo
from marimo._se... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ai/tools/tools/test_notebooks.py",
"license": "Apache License 2.0",
"lines": 165,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_ipc/connection.py | # Copyright 2026 Marimo. All rights reserved.
"""ZeroMQ connection management for inter-process communication."""
from __future__ import annotations
import dataclasses
import queue
import sys
import typing
from marimo import _loggers
from marimo._ipc.queue_proxy import PushQueue, start_receiver_thread
from marimo._i... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ipc/connection.py",
"license": "Apache License 2.0",
"lines": 162,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_ipc/launch_kernel.py | # Copyright 2026 Marimo. All rights reserved.
"""Standalone kernel server entry point for IPC (using ZeroMQ)."""
from __future__ import annotations
import sys
from marimo._ipc.queue_manager import QueueManager
from marimo._ipc.types import KernelArgs
from marimo._runtime import runtime
def main() -> None:
"""L... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ipc/launch_kernel.py",
"license": "Apache License 2.0",
"lines": 46,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ipc/queue_manager.py | # Copyright 2026 Marimo. All rights reserved.
"""Queue manager for generic inter-process communication."""
from __future__ import annotations
import dataclasses
import typing
from marimo._ipc.connection import Connection
from marimo._ipc.types import ConnectionInfo
if typing.TYPE_CHECKING:
from marimo._messagin... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ipc/queue_manager.py",
"license": "Apache License 2.0",
"lines": 81,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_ipc/queue_proxy.py | # Copyright 2026 Marimo. All rights reserved.
"""Queue proxy for ZeroMQ sockets."""
from __future__ import annotations
import pickle
import threading
import typing
from marimo import _loggers
from marimo._session.queue import QueueType
LOGGER = _loggers.marimo_logger()
T = typing.TypeVar("T")
if typing.TYPE_CHECK... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ipc/queue_proxy.py",
"license": "Apache License 2.0",
"lines": 88,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_ipc/types.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import typing
import msgspec
import msgspec.json
from marimo._ast.cell import CellConfig
from marimo._config.config import MarimoConfig
from marimo._messaging.msgspec_encoder import encode_json_bytes
from marimo._runtime.commands import... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_ipc/types.py",
"license": "Apache License 2.0",
"lines": 36,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_ipc/test_kernel_communication.py | """Tests for ZeroMQ-based kernel communication."""
from __future__ import annotations
import json
import queue
import subprocess
import sys
import time
import pytest
from dirty_equals import IsFloat, IsList, IsUUID
from marimo._ast.app_config import _AppConfig
from marimo._ast.cell import CellConfig
from marimo._co... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ipc/test_kernel_communication.py",
"license": "Apache License 2.0",
"lines": 239,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_mcp/server/exceptions.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Optional
@dataclass
class ToolErrorDetails:
"""Structured representation of tool execution error details."""
message: str
code: str = "TOOL_ERROR"
status: int = ... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/server/exceptions.py",
"license": "Apache License 2.0",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_mcp/server/lifespan.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import contextlib
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
@... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/server/lifespan.py",
"license": "Apache License 2.0",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_mcp/server/main.py | # Copyright 2026 Marimo. All rights reserved.
"""
MCP (Model Context Protocol) Server Implementation for Marimo
This module implements an MCP server that provides LLMs with access to marimo
notebook context and functionality.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from marimo._ai._t... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/server/main.py",
"license": "Apache License 2.0",
"lines": 82,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_mcp/server/responses.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Literal, Optional
@dataclass(kw_only=True)
class SuccessResult:
status: Literal["success", "error", "warning"] = "success"
auth_required: bool = False
next_steps: Opt... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_mcp/server/responses.py",
"license": "Apache License 2.0",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_mcp/server/test_exceptions.py | """Tests for marimo._mcp.server.exceptions module."""
import json
import pytest
# Skip all MCP tests if Python < 3.10 or MCP not available
pytest.importorskip("mcp", reason="MCP requires Python 3.10+")
from marimo._mcp.server.exceptions import ToolExecutionError
def test_tool_execution_error_basic():
"""Test ... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_mcp/server/test_exceptions.py",
"license": "Apache License 2.0",
"lines": 83,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_mcp/server/test_responses.py | """Tests for marimo._mcp.server.responses module."""
from typing import TypedDict
import pytest
# Skip all MCP tests if Python < 3.10 or MCP not available
pytest.importorskip("mcp", reason="MCP requires Python 3.10+")
from marimo._mcp.server.responses import (
SuccessResult,
)
class SampleData(TypedDict):
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_mcp/server/test_responses.py",
"license": "Apache License 2.0",
"lines": 52,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_messaging/msgspec_encoder.py | # Copyright 2026 Marimo. All rights reserved.
"""Msgspec encoder with custom type support for marimo."""
from __future__ import annotations
import collections
import datetime
import decimal
import fractions
import uuid
from math import isnan
from pathlib import PurePath
from typing import Any
import msgspec
import m... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_messaging/msgspec_encoder.py",
"license": "Apache License 2.0",
"lines": 242,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_server/responses.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING
import starlette.responses
from marimo._messaging.msgspec_encoder import encode_json_bytes
if TYPE_CHECKING:
import msgspec
class StructResponse(starlette.responses.Response):
media_type = "ap... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/responses.py",
"license": "Apache License 2.0",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_messaging/mocks.py | from __future__ import annotations
from typing import Any, Optional
from marimo._messaging.mimetypes import ConsoleMimeType
from marimo._messaging.notification import (
CellNotification,
NotificationMessage,
)
from marimo._messaging.serde import deserialize_kernel_message
from marimo._messaging.types import K... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_messaging/mocks.py",
"license": "Apache License 2.0",
"lines": 45,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_server/ai/tools/types.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Callable, Literal, Optional, TypeVar
from marimo._config.config import CopilotMode
# Type aliases for tool system
FunctionArgs = dict[str, Any]
ValidationFunction = Callable[[Fun... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/ai/tools/types.py",
"license": "Apache License 2.0",
"lines": 26,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:tests/_ast/codegen_data/test_get_alias_import.py |
import marimo as mo
__generated_with = "0.14.11"
app = mo.App()
@app.cell
def one():
x: int = 0
return (x,)
if __name__ == "__main__":
app.run()
| {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_ast/codegen_data/test_get_alias_import.py",
"license": "Apache License 2.0",
"lines": 9,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/ipython/img_mimebundle.py | import marimo
__generated_with = "0.15.5"
app = marimo.App(width="medium")
@app.cell
def _():
from io import BytesIO
from PIL import Image, ImageDraw
class BlueOnGray:
def __init__(self, text, retina=False):
self.text = text
self.retina = retina
def _repr_mimebu... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/ipython/img_mimebundle.py",
"license": "Apache License 2.0",
"lines": 28,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_utils/timer.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import functools
import time
from typing import Any, Callable
def timer(func: Callable[..., Any]) -> Callable[..., Any]:
"""
A decorator that measures and prints the execution time of a function.
This should only be used fo... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/timer.py",
"license": "Apache License 2.0",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_server/codes.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from enum import IntEnum
class WebSocketCodes(IntEnum):
ALREADY_CONNECTED = 1003
NORMAL_CLOSE = 1000
FORBIDDEN = 1008
UNAUTHORIZED = 3000
UNEXPECTED_ERROR = 1011
| {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/codes.py",
"license": "Apache License 2.0",
"lines": 9,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_utils/cell_matching.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from marimo._types.ids import CellId_t
if TYPE_CHECKING:
from collections.abc import Sequence
def similarity_score(s1: str, s2: str) -> float:
"""Fast similarity score based on common... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/cell_matching.py",
"license": "Apache License 2.0",
"lines": 251,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:marimo/_utils/xdg.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
from pathlib import Path
def home_path() -> Path:
"""Get home directory or temp directory if home directory is not available.
Returns:
Path: The home directory.
"""
try:
return Path.home().reso... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_utils/xdg.py",
"license": "Apache License 2.0",
"lines": 67,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
marimo-team/marimo:tests/_utils/test_xdg.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from marimo._utils.platform import is_windows
from marimo._utils.xdg import (
home_path,
marimo_cache_dir,
marimo_config_path,
... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_xdg.py",
"license": "Apache License 2.0",
"lines": 240,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_runtime/test_dataflow_cases.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from functools import partial
from typing import TYPE_CHECKING, Optional, Union
import pytest
from marimo._ast import compiler
from marimo._dependencies.dependencies import DependencyManager
from marimo... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_runtime/test_dataflow_cases.py",
"license": "Apache License 2.0",
"lines": 667,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_smoke_tests/ai/github_model_check.py | # /// script
# dependencies = [
# "marimo",
# "openai==1.99.9",
# ]
# [tool.marimo.runtime]
# auto_instantiate = false
# ///
import marimo
__generated_with = "0.18.0"
app = marimo.App(width="medium")
@app.cell(hide_code=True)
def _():
import marimo as mo
import openai
import os
import httpx
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/ai/github_model_check.py",
"license": "Apache License 2.0",
"lines": 88,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
marimo-team/marimo:marimo/_smoke_tests/ai/model_check.py | # /// script
# requires-python = ">=3.12"
# dependencies = [
# "anthropic==0.64.0",
# "any-llm-sdk[anthropic]==0.12.1",
# "google-genai==1.30.0",
# "marimo",
# "polars==1.32.3",
# "protobuf==5.29.5",
# ]
# ///
import marimo
__generated_with = "0.15.5"
app = marimo.App(width="medium")
@app.ce... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_smoke_tests/ai/model_check.py",
"license": "Apache License 2.0",
"lines": 153,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_utils/test_formatter.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import sys
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from marimo._utils.formatter import (
BlackFormatter,
CellCodes,
DefaultFormatter,
FormatError,
Formatter,
RuffFormatter,
ruff,
)... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_utils/test_formatter.py",
"license": "Apache License 2.0",
"lines": 353,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:tests/_sql/test_engine_utils.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from typing import Literal
from unittest.mock import Mock, patch
import pytest
from marimo._dependencies.dependencies import DependencyManager
from marimo._sql.utils import convert_to_output
native_result = {"data": "native_result"}
po... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_sql/test_engine_utils.py",
"license": "Apache License 2.0",
"lines": 356,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
marimo-team/marimo:marimo/_server/ai/config.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
from dataclasses import dataclass
from typing import (
Any,
Optional,
Union,
cast,
)
from starlette.exceptions import HTTPException
from marimo._config.config import (
AiConfig,
CopilotMode,
MarimoConfig,
... | {
"repo_id": "marimo-team/marimo",
"file_path": "marimo/_server/ai/config.py",
"license": "Apache License 2.0",
"lines": 359,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
marimo-team/marimo:tests/_server/ai/test_ai_config.py | # Copyright 2026 Marimo. All rights reserved.
from __future__ import annotations
import os
from typing import Any, cast
from unittest.mock import patch
import pytest
from starlette.exceptions import HTTPException
from marimo._config.config import (
AiConfig,
MarimoConfig,
)
from marimo._dependencies.dependen... | {
"repo_id": "marimo-team/marimo",
"file_path": "tests/_server/ai/test_ai_config.py",
"license": "Apache License 2.0",
"lines": 1008,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.