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
[pre-commit.ci] pre-commit autoupdate (#3416)
pre-commit-ci[bot]becf8e515414
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 0cc14ec507..9cf3de3a45 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -30,7 +30,7 @@ repos:- id: typos- repo: https://github.com/astral-sh/ruff-pre-commit- rev: v0.8.6+ rev: v0.9.1hooks:# Run the linter- id: ruffdiff --git a/marimo/_ai/llm.py b/marimo/_ai/llm.pyindex 6e6e686aab..f10b947bcc 100644--- a/marimo/_ai/llm.py+++ b/marimo/_ai/llm.py@@ -128,7 +128,7 @@ class openai(ChatModel):client: AzureOpenAI | OpenAI = AzureOpenAI(api_key=self._require_api_key,api_version=api_version,- azure_endpoint=f"{cast(str,parsed_url.scheme)}://{cast(str,parsed_url.hostname)}",+ azure_endpoint=f"{cast(str, parsed_url.scheme)}://{cast(str, parsed_url.hostname)}",)else:client = OpenAI(diff --git a/marimo/_cli/cli.py b/marimo/_cli/cli.pyindex c7910b27ad..51db340551 100644--- a/marimo/_cli/cli.py+++ b/marimo/_cli/cli.py@@ -540,9 +540,7 @@ Example:default=120,show_default=True,type=int,- help=(- "Seconds to wait before closing a session on " "websocket disconnect."- ),+ help=("Seconds to wait before closing a session on websocket disconnect."),)@click.option("--watch",diff --git a/marimo/_plugins/stateless/tree.py b/marimo/_plugins/stateless/tree.pyindex f89c901f16..276413e17a 100644--- a/marimo/_plugins/stateless/tree.py+++ b/marimo/_plugins/stateless/tree.py@@ -20,7 +20,9 @@ def tree(Example:```python3- mo.tree(["entry", "another entry", {"key": [0, 1, 2]}], label="A tree.")+ mo.tree(+ ["entry", "another entry", {"key": [0, 1, 2]}], label="A tree."+ )```Args:diff --git a/marimo/_plugins/ui/_impl/altair_chart.py b/marimo/_plugins/ui/_impl/altair_chart.pyindex 4b459f5318..d7955519e6 100644--- a/marimo/_plugins/ui/_impl/altair_chart.py+++ b/marimo/_plugins/ui/_impl/altair_chart.py@@ -296,8 +296,7 @@ class altair_chart(UIElement[ChartSelection, ChartDataType]):if not isinstance(chart, (alt.TopLevelMixin)):raise ValueError(- "Invalid type for chart: "- f"{type(chart)}; expected altair.Chart"+ f"Invalid type for chart: {type(chart)}; expected altair.Chart")# Make full-width if no width is specifieddiff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.pyindex 6400a91c6f..a1e1e040ef 100644--- a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py@@ -21,7 +21,7 @@ def python_print_transforms(strs: List[str] = []for transform in transforms:strs.append(- f"{df_next_name} = {print_transform(df_next_name,all_columns, transform)}" # noqa: E501+ f"{df_next_name} = {print_transform(df_next_name, all_columns, transform)}" # noqa: E501)return "\n".join([f"{df_next_name} = {df_name}"] + strs)@@ -128,7 +128,7 @@ def python_print_pandas()if not column_ids:return f"{df_name}.agg({_list_of_strings(aggregations)})"- return f'{df_name}.agg({{{", ".join(f"{_as_literal(column_id)}: {_list_of_strings(aggregations)}" for column_id in column_ids)}}})' # noqa: E501+ return f"{df_name}.agg({{{', '.join(f'{_as_literal(column_id)}: {_list_of_strings(aggregations)}' for column_id in column_ids)}}})" # noqa: E501elif transform.type == TransformType.GROUP_BY:column_ids, aggregation, drop_na = (@@ -480,7 +480,7 @@ def _as_literal(value: Any) -> str:def _list_of_strings(value: Union[List[Any], Any]) -> str:if isinstance(value, list):- return f'[{", ".join(_as_literal(v) for v in value)}]'+ return f"[{', '.join(_as_literal(v) for v in value)}]"return _as_literal(value)diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/types.py b/marimo/_plugins/ui/_impl/dataframes/transforms/types.pyindex 1e791975c8..1cf52d3e43 100644--- a/marimo/_plugins/ui/_impl/dataframes/transforms/types.py+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/types.py@@ -75,9 +75,9 @@ class Condition:def __post_init__(self) -> None:if self.operator == "in":- assert isinstance(- self.value, list- ), "value must be a list for 'in' operator"+ assert isinstance(self.value, list), (+ "value must be a list for 'in' operator"+ )@dataclassdiff --git a/marimo/_runtime/app_meta.py b/marimo/_runtime/app_meta.pyindex 2e39a8c20a..63e94041ab 100644--- a/marimo/_runtime/app_meta.py+++ b/marimo/_runtime/app_meta.py@@ -62,7 +62,9 @@ class AppMeta:```python# Only show this content when editing the notebook- mo.md("# Developer Notes") if mo.app_meta().mode == "edit" else None+ mo.md(+ "# Developer Notes"+ ) if mo.app_meta().mode == "edit" else None```Returns:diff --git a/marimo/_runtime/requests.py b/marimo/_runtime/requests.pyindex c31d90dd7a..d2396e3029 100644--- a/marimo/_runtime/requests.py+++ b/marimo/_runtime/requests.py@@ -51,9 +51,9 @@ class ExecuteMultipleRequest:]def __post_init__(self) -> None:- assert len(self.cell_ids) == len(- self.codes- ), "Mismatched cell_ids and codes"+ assert len(self.cell_ids) == len(self.codes), (+ "Mismatched cell_ids and codes"+ )@dataclass@@ -74,9 +74,9 @@ class SetUIElementValueRequest:token: str = field(default_factory=lambda: str(uuid4()))def __post_init__(self) -> None:- assert len(self.object_ids) == len(- self.values- ), "Mismatched object_ids and values"+ assert len(self.object_ids) == len(self.values), (+ "Mismatched object_ids and values"+ )@staticmethoddef from_ids_and_values(diff --git a/marimo/_runtime/runner/hooks_on_finish.py b/marimo/_runtime/runner/hooks_on_finish.pyindex 9a6b86c0d9..3c13ef271d 100644--- a/marimo/_runtime/runner/hooks_on_finish.py+++ b/marimo/_runtime/runner/hooks_on_finish.py@@ -74,8 +74,7 @@ def _send_cancellation_errors(runner: cell_runner.Runner) -> None:exception_type = type(runner.exceptions[raising_cell]).__name__data = MarimoExceptionRaisedError(msg=(- "An ancestor raised an exception "- f"({exception_type}): "+ f"An ancestor raised an exception ({exception_type}): "),exception_type=exception_type,raising_cell=raising_cell,diff --git a/marimo/_runtime/runtime.py b/marimo/_runtime/runtime.pyindex 385d317ecc..27030a0ff6 100644--- a/marimo/_runtime/runtime.py+++ b/marimo/_runtime/runtime.py@@ -250,7 +250,9 @@ def app_meta() -> AppMeta:import altair as alt# Enable dark theme for Altair when marimo is in dark mode- alt.themes.enable("dark" if mo.app_meta().theme == "dark" else "default")+ alt.themes.enable(+ "dark" if mo.app_meta().theme == "dark" else "default"+ )```Show content only in edit mode:diff --git a/marimo/_save/ast.py b/marimo/_save/ast.pyindex b602ab8636..2a7f954836 100644--- a/marimo/_save/ast.py+++ b/marimo/_save/ast.py@@ -159,9 +159,9 @@ def strip_function(fn: Callable[..., Any]) -> ast.Module:code, _ = inspect.getsourcelines(fn)function_ast = ast.parse(textwrap.dedent("".join(code)))body = function_ast.body.pop()- assert isinstance(- body, (ast.FunctionDef, ast.AsyncFunctionDef)- ), "Expected a function definition"+ assert isinstance(body, (ast.FunctionDef, ast.AsyncFunctionDef)), (+ "Expected a function definition"+ )extracted = ast.Module(body.body, type_ignores=[])module = RemoveReturns().visit(extracted)assert isinstance(module, ast.Module), "Expected a module"diff --git a/marimo/_save/hash.py b/marimo/_save/hash.pyindex 5326e45145..f7c0fdbfbb 100644--- a/marimo/_save/hash.py+++ b/marimo/_save/hash.py@@ -322,9 +322,9 @@ class BlockHasher:if not scoped_refs:scoped_refs = set()else:- assert (- not apply_content_hash- ), "scoped_refs should only be used with deferred hashing."+ assert not apply_content_hash, (+ "scoped_refs should only be used with deferred hashing."+ )self._hash: Optional[str] = Noneself.graph = graphdiff --git a/marimo/_save/loaders/loader.py b/marimo/_save/loaders/loader.pyindex 0c3d36447e..03e92ce147 100644--- a/marimo/_save/loaders/loader.py+++ b/marimo/_save/loaders/loader.py@@ -57,9 +57,9 @@ class Loader(ABC):loaded = self.load_cache(hashed_context, cache_type)# TODO: Consider more robust verificationassert loaded.hash == hashed_context, INCONSISTENT_CACHE_BOILER_PLATE- assert set(defs | stateful_refs) == set(- loaded.defs- ), INCONSISTENT_CACHE_BOILER_PLATE+ assert set(defs | stateful_refs) == set(loaded.defs), (+ INCONSISTENT_CACHE_BOILER_PLATE+ )return Cache(loaded.defs,hashed_context,diff --git a/marimo/_save/loaders/memory.py b/marimo/_save/loaders/memory.pyindex c4b19ee52b..2e576d1829 100644--- a/marimo/_save/loaders/memory.py+++ b/marimo/_save/loaders/memory.py@@ -55,9 +55,9 @@ class MemoryLoader(Loader):return self._maybe_lock(lambda: key in self._cache)def load_cache(self, hashed_context: str, cache_type: CacheType) -> Cache:- assert self.cache_hit(- hashed_context, cache_type- ), INCONSISTENT_CACHE_BOILER_PLATE+ assert self.cache_hit(hashed_context, cache_type), (+ INCONSISTENT_CACHE_BOILER_PLATE+ )self.hits += 1key = self.build_path(hashed_context, cache_type)if self.is_lru:diff --git a/marimo/_save/loaders/pickle.py b/marimo/_save/loaders/pickle.pyindex acab1fe1fe..a81bc10007 100644--- a/marimo/_save/loaders/pickle.py+++ b/marimo/_save/loaders/pickle.py@@ -27,13 +27,13 @@ class PickleLoader(Loader):return os.path.exists(path) and os.path.getsize(path) > 0def load_cache(self, hashed_context: str, cache_type: CacheType) -> Cache:- assert self.cache_hit(- hashed_context, cache_type- ), INCONSISTENT_CACHE_BOILER_PLATE+ assert self.cache_hit(hashed_context, cache_type), (+ INCONSISTENT_CACHE_BOILER_PLATE+ )with open(self.build_path(hashed_context, cache_type), "rb") as handle:cache = pickle.load(handle)assert isinstance(cache, Cache), (- "Excepted cache object, got" f"{type(cache)} ",+ f"Excepted cache object, got{type(cache)} ",INCONSISTENT_CACHE_BOILER_PLATE,)return cachediff --git a/marimo/_save/save.py b/marimo/_save/save.pyindex 9f20d5a64e..e9004a05e0 100644--- a/marimo/_save/save.py+++ b/marimo/_save/save.py@@ -480,7 +480,7 @@ class persistent_cache(object):sys.settrace(self._old_trace) # Clear to previous set trace.if not self._entered_trace:raise CacheException(- ("Unexpected block format" f"{UNEXPECTED_FAILURE_BOILERPLATE}")+ (f"Unexpected block format{UNEXPECTED_FAILURE_BOILERPLATE}"))# Backfill the loaded values into global scope.@@ -493,8 +493,7 @@ class persistent_cache(object):# NB: exception is a type.if exception:assert not isinstance(instance, SkipWithBlock), (- "Cache was not correctly set"- f"{UNEXPECTED_FAILURE_BOILERPLATE}"+ f"Cache was not correctly set{UNEXPECTED_FAILURE_BOILERPLATE}")if isinstance(instance, BaseException):raise instance from CacheException("Failure during save.")diff --git a/marimo/_server/ai/prompts.py b/marimo/_server/ai/prompts.pyindex c63f617ba2..bb4c249e4f 100644--- a/marimo/_server/ai/prompts.py+++ b/marimo/_server/ai/prompts.py@@ -55,7 +55,7 @@ class Prompter:"Do not output markdown or backticks.",] + language_rules[language]rules = "\n".join(- f"{i+1}. {rule}" for i, rule in enumerate(all_rules)+ f"{i + 1}. {rule}" for i, rule in enumerate(all_rules))system_prompt = (f"You are a helpful assistant that can answer questions about {language}."@@ -109,7 +109,7 @@ class Prompter:continuerules = "\n".join(- f"{i+1}. {rule}"+ f"{i + 1}. {rule}"for i, rule in enumerate(language_rules[language]))diff --git a/marimo/_server/api/endpoints/ai.py b/marimo/_server/api/endpoints/ai.pyindex d8f0b22c62..56e2fec24a 100644--- a/marimo/_server/api/endpoints/ai.py+++ b/marimo/_server/api/endpoints/ai.py@@ -107,7 +107,7 @@ def get_openai_client(config: MarimoConfig) -> "OpenAI":api_key=key,api_version=api_version,azure_deployment=deployment_model,- azure_endpoint=f"{cast(str,parsed_url.scheme)}://{cast(str,parsed_url.hostname)}",+ azure_endpoint=f"{cast(str, parsed_url.scheme)}://{cast(str, parsed_url.hostname)}",)else:return OpenAI(diff --git a/marimo/_server/api/middleware.py b/marimo/_server/api/middleware.pyindex 47cc4c2f1d..d8dcc029c6 100644--- a/marimo/_server/api/middleware.py+++ b/marimo/_server/api/middleware.py@@ -375,7 +375,7 @@ class ProxyMiddleware:websocket = WebSocket(scope, receive=receive, send=send)original_params = websocket.query_paramsif original_params:- ws_url = f"{ws_url}?{'&'.join(f'{k}={v}' for k,v in original_params.items())}"+ ws_url = f"{ws_url}?{'&'.join(f'{k}={v}' for k, v in original_params.items())}"await websocket.accept()async with connect(ws_url) as ws_client:diff --git a/marimo/_server/models/models.py b/marimo/_server/models/models.pyindex 90816d5bc2..7c9e4dbe81 100644--- a/marimo/_server/models/models.py+++ b/marimo/_server/models/models.py@@ -28,9 +28,9 @@ class UpdateComponentValuesRequest:# Validate same lengthdef __post_init__(self) -> None:- assert len(self.object_ids) == len(- self.values- ), "Mismatched object_ids and values"+ assert len(self.object_ids) == len(self.values), (+ "Mismatched object_ids and values"+ )@dataclass@@ -89,9 +89,9 @@ class RunRequest:# Validate same lengthdef __post_init__(self) -> None:- assert len(self.cell_ids) == len(- self.codes- ), "Mismatched cell_ids and codes"+ assert len(self.cell_ids) == len(self.codes), (+ "Mismatched cell_ids and codes"+ )@dataclass@@ -121,15 +121,15 @@ class SaveNotebookRequest:# Validate same lengthdef __post_init__(self) -> None:- assert len(self.cell_ids) == len(- self.codes- ), "Mismatched cell_ids and codes"- assert len(self.cell_ids) == len(- self.names- ), "Mismatched cell_ids and names"- assert len(self.cell_ids) == len(- self.configs- ), "Mismatched cell_ids and configs"+ assert len(self.cell_ids) == len(self.codes), (+ "Mismatched cell_ids and codes"+ )+ assert len(self.cell_ids) == len(self.names), (+ "Mismatched cell_ids and names"+ )+ assert len(self.cell_ids) == len(self.configs), (+ "Mismatched cell_ids and configs"+ )@dataclass@@ -147,9 +147,9 @@ class CopyNotebookRequest:f'File "{self.source}" does not exist.'+ "Please save the notebook and try again.")- assert not os.path.exists(- self.destination- ), f'File "{destination}" already exists in this directory.'+ assert not os.path.exists(self.destination), (+ f'File "{destination}" already exists in this directory.'+ )@dataclassdiff --git a/marimo/_server/router.py b/marimo/_server/router.pyindex 779ed6292e..f269820af5 100644--- a/marimo/_server/router.py+++ b/marimo/_server/router.py@@ -37,12 +37,12 @@ class APIRouter(Router):def __post_init__(self) -> None:if self.prefix:- assert self.prefix.startswith(- "/"- ), "Path prefix must start with '/'"- assert not self.prefix.endswith(- "/"- ), "Path prefix must not end with '/'"+ assert self.prefix.startswith("/"), (+ "Path prefix must start with '/'"+ )+ assert not self.prefix.endswith("/"), (+ "Path prefix must not end with '/'"+ )def post(self, path: strdiff --git a/marimo/_server/sessions.py b/marimo/_server/sessions.pyindex 11ca538d2b..05f0cd0a2a 100644--- a/marimo/_server/sessions.py+++ b/marimo/_server/sessions.py@@ -365,9 +365,9 @@ class Room:self.consumers[consumer] = consumer_idself.disposables[consumer] = disposeif main:- assert (- self.main_consumer is None- ), "Main session consumer already exists"+ assert self.main_consumer is None, (+ "Main session consumer already exists"+ )self.main_consumer = consumerdef remove_consumer(self, consumer: SessionConsumer) -> None:diff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.pyindex 09ab36514f..4e2c72d255 100644--- a/marimo/_server/templates/templates.py+++ b/marimo/_server/templates/templates.py@@ -155,17 +155,23 @@ def static_notebook_template(<script data-marimo="true">window.__MARIMO_STATIC__ = {{}};window.__MARIMO_STATIC__.version = "{__version__}";- window.__MARIMO_STATIC__.notebookState = {json.dumps({- "cellIds": cell_ids,- "cellNames": _serialize_list_to_base64(cell_names),- "cellCodes": _serialize_list_to_base64(cell_codes),- "cellConfigs": _serialize_list_to_base64([- json.dumps(config.asdict())- for config in cell_configs- ]),- "cellOutputs": serialized_cell_outputs,- "cellConsoleOutputs": serialized_cell_console_outputs,- })};+ window.__MARIMO_STATIC__.notebookState = {+ json.dumps(+ {+ "cellIds": cell_ids,+ "cellNames": _serialize_list_to_base64(cell_names),+ "cellCodes": _serialize_list_to_base64(cell_codes),+ "cellConfigs": _serialize_list_to_base64(+ [+ json.dumps(config.asdict())+ for config in cell_configs+ ]+ ),+ "cellOutputs": serialized_cell_outputs,+ "cellConsoleOutputs": serialized_cell_console_outputs,+ }+ )+ };window.__MARIMO_STATIC__.assetUrl = "{asset_url}";window.__MARIMO_STATIC__.files = {json.dumps(files)};</script>diff --git a/tests/_cli/test_cli_development.py b/tests/_cli/test_cli_development.pyindex 72aaf9fc12..e06015c7a6 100644--- a/tests/_cli/test_cli_development.py+++ b/tests/_cli/test_cli_development.py@@ -33,6 +33,6 @@ def test_openapi_up_to_date() -> None:del generated_content["info"]["version"]cmd = "marimo development openapi > openapi/api.yaml && make fe-codegen"- assert (- current_content == generated_content- ), f"openapi/api.yaml is not up to date. Run '{cmd}' to update it."+ assert current_content == generated_content, (+ f"openapi/api.yaml is not up to date. Run '{cmd}' to update it."+ )diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.pyindex 1f479382da..51f31cea19 100644--- a/tests/_cli/test_cli_export.py+++ b/tests/_cli/test_cli_export.py@@ -450,9 +450,9 @@ class TestExportScript:],capture_output=True,)- assert (- p.returncode != 0- ), "Expected non-zero return code due to multiple definitions"+ assert p.returncode != 0, (+ "Expected non-zero return code due to multiple definitions"+ )error_message = p.stderr.decode()assert ("MultipleDefinitionError: This app can't be run because it has multiple definitions of the name x"diff --git a/tests/_convert/test_ipynb.py b/tests/_convert/test_ipynb.pyindex 8a3a0ffad6..adf39460c0 100644--- a/tests/_convert/test_ipynb.py+++ b/tests/_convert/test_ipynb.py@@ -250,21 +250,18 @@ def test_transform_magic_commands_complex():"%env MY_VAR=value",]result = transform_magic_commands(sources)- assert (- result- == [- '_df = mo.sql("""\nSELECT *\nFROM table\nWHERE condition\n""")',- (- "# magic command not supported in marimo; please file an issue to add support\n" # noqa: E501- "# %%time\nfor i in range(1000000):\n"- " pass"- ),- (- "# '%load_ext autoreload\\n%autoreload 2' command supported automatically in marimo" # noqa: E501- ),- "import os\nos.environ['MY_VAR'] = 'value'",- ]- )+ assert result == [+ '_df = mo.sql("""\nSELECT *\nFROM table\nWHERE condition\n""")',+ (+ "# magic command not supported in marimo; please file an issue to add support\n" # noqa: E501+ "# %%time\nfor i in range(1000000):\n"+ " pass"+ ),+ (+ "# '%load_ext autoreload\\n%autoreload 2' command supported automatically in marimo" # noqa: E501+ ),+ "import os\nos.environ['MY_VAR'] = 'value'",+ ]@pytest.mark.skipif(diff --git a/tests/_messaging/test_run_id_context.py b/tests/_messaging/test_run_id_context.pyindex 348727e9aa..f12b70c9b5 100644--- a/tests/_messaging/test_run_id_context.py+++ b/tests/_messaging/test_run_id_context.py@@ -7,9 +7,9 @@ class TestRunIDContext:def test_run_id_context(self):with run_id_context():run_id = RUN_ID_CTX.get()- assert (- run_id is not None- ), "within run_id context but unable to obtain run_id"+ assert run_id is not None, (+ "within run_id context but unable to obtain run_id"+ )# out of context managerwith pytest.raises(LookupError):diff --git a/tests/_plugins/stateless/test_routes.py b/tests/_plugins/stateless/test_routes.pyindex a2d9d50e89..9f0a863838 100644--- a/tests/_plugins/stateless/test_routes.py+++ b/tests/_plugins/stateless/test_routes.py@@ -75,7 +75,7 @@ async def test_routes_non_lazy(k: Kernel, exec_req: ExecReqProvider) -> None:assert len(context.function_registry.namespaces.values()) == 0routes = k.globals["routes"]- children = "<span>42</span>" "<span>45</span>"+ children = "<span>42</span><span>45</span>"assert children in routes.textassert ("data-routes='["#/", "{/*path}"]'" in routes.textdiff --git a/tests/_plugins/ui/_impl/tables/test_narwhals.py b/tests/_plugins/ui/_impl/tables/test_narwhals.pyindex c987ae741d..5cd187c213 100644--- a/tests/_plugins/ui/_impl/tables/test_narwhals.py+++ b/tests/_plugins/ui/_impl/tables/test_narwhals.py@@ -839,6 +839,6 @@ def test_get_field_types_with_many_columns_is_performant(df: Any) -> None:# This can be slow if get_field_types is not optimized.# https://github.com/marimo-team/marimo/issues/3107total_ms = (end_time - start_time) * 1000- assert (- total_ms < 500- ), f"Total time: {total_ms}ms for {df.shape[1]} columns with {type(df)}"+ assert total_ms < 500, (+ f"Total time: {total_ms}ms for {df.shape[1]} columns with {type(df)}"+ )diff --git a/tests/_runtime/test_trace.py b/tests/_runtime/test_trace.pyindex f8e8d11657..c1625c5868 100644--- a/tests/_runtime/test_trace.py+++ b/tests/_runtime/test_trace.py@@ -47,7 +47,7 @@ class TestScriptTrace:result = p.stderr.decode()assert "ZeroDivisionError: division by zero" in result- assert ('script_exception_with_output.py"' ", line 11") in result+ assert ('script_exception_with_output.py", line 11') in resultassert "y / x" in result@staticmethoddiff --git a/tests/_save/test_cache.py b/tests/_save/test_cache.pyindex fe90abc9c3..297d49adc2 100644--- a/tests/_save/test_cache.py+++ b/tests/_save/test_cache.py@@ -770,9 +770,9 @@ class TestCacheDecorator:f.base_block.execution_refs,f.base_block.content_refs,)- assert f.base_block.context_refs == {- "ns"- }, f.base_block.context_refs+ assert f.base_block.context_refs == {"ns"}, (+ f.base_block.context_refs+ )returnapp.run()@@ -851,9 +851,9 @@ class TestCacheDecorator:assert f.hits == 0assert f() == 1assert f.hits == 1- assert (- f.base_block.execution_refs == set()- ), f.base_block.execution_refs+ assert f.base_block.execution_refs == set(), (+ f.base_block.execution_refs+ )assert f.base_block.missing == {"ns"}, f.base_block.missingreturndiff --git a/tests/_save/test_hash.py b/tests/_save/test_hash.pyindex 2e35bcd8e5..4ede3813ae 100644--- a/tests/_save/test_hash.py+++ b/tests/_save/test_hash.py@@ -410,9 +410,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)@app.cell@@ -424,9 +424,9 @@ class TestDataHash:two = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (two,)@app.cell@@ -468,9 +468,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)@app.cell@@ -482,9 +482,9 @@ class TestDataHash:two = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (two,)@app.cell@@ -528,9 +528,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)@app.cell@@ -544,9 +544,9 @@ class TestDataHash:two = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (two,)@app.cell@@ -591,12 +591,12 @@ class TestDataHash:_A = torch.sum(_a)one = _A- assert (- _cache._cache.cache_type == "ContextExecutionPath"- ), _cache._cache.cache_type- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.cache_type == "ContextExecutionPath", (+ _cache._cache.cache_type+ )+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)app.run()@@ -638,9 +638,9 @@ class TestDataHash:assert strand == siblingassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)app.run()@@ -685,9 +685,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)@app.cell@@ -702,9 +702,9 @@ class TestDataHash:two = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (two,)@app.cell@@ -754,9 +754,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContextExecutionPath"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)app.run()@@ -798,9 +798,9 @@ class TestDataHash:one = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (one,)@app.cell@@ -813,9 +813,9 @@ class TestDataHash:two = _Aassert _cache._cache.cache_type == "ContentAddressed"- assert (- _cache._cache.hash == expected_hash- ), f"expected_hash != {_cache._cache.hash}"+ assert _cache._cache.hash == expected_hash, (+ f"expected_hash != {_cache._cache.hash}"+ )return (two,)@app.celldiff --git a/tests/_server/test_utils.py b/tests/_server/test_utils.pyindex b551c43f9a..e284b7883f 100644--- a/tests/_server/test_utils.py+++ b/tests/_server/test_utils.py@@ -7,9 +7,9 @@ from marimo._server.api.utils import parse_title, require_headerdef test_require_header() -> None:# Happy pathheader = ["Content-Type"]- assert (- require_header(header) == "Content-Type"- ), "The function should return the single header value"+ assert require_header(header) == "Content-Type", (+ "The function should return the single header value"+ )with pytest.raises(ValueError) as e:require_header(None)diff --git a/tests/_smoke_tests/run_all.py b/tests/_smoke_tests/run_all.pyindex 111fea9f46..161156a776 100644--- a/tests/_smoke_tests/run_all.py+++ b/tests/_smoke_tests/run_all.py@@ -83,25 +83,25 @@ async def _run_test(if failed_reason:# Expecting an error- assert (- process.returncode != 0- ), f"{relative_file} Expected error: {failed_reason}"+ assert process.returncode != 0, (+ f"{relative_file} Expected error: {failed_reason}"+ )if isinstance(failed_reason, list):- assert any(- reason in stderr for reason in failed_reason- ), f"File: {file}. Expected error one of {failed_reason} in {stderr}" # noqa: E501+ assert any(reason in stderr for reason in failed_reason), (+ f"File: {file}. Expected error one of {failed_reason} in {stderr}"+ ) # noqa: E501else:assert failed_reason in stderr, f"File: {file}"# Allow MarimoStopelif "MarimoStop" in stderr:- assert (- process.returncode != 0- ), f"{relative_file} Unexpected error: {stderr}"+ assert process.returncode != 0, (+ f"{relative_file} Unexpected error: {stderr}"+ )else:# Expecting no error, allow MarimoStop- assert (- process.returncode == 0- ), f"{relative_file} Unexpected error: {stderr}"+ assert process.returncode == 0, (+ f"{relative_file} Unexpected error: {stderr}"+ )assert not any(line.startswith("Traceback") for line in stderr.splitlines())