A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore(ruff): align lint rules with Ruff 0.16.6 (#10860)
Shahmir Varqhaa4f6f0dfcf86
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex ab9b229db8..7447795a63 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -39,7 +39,7 @@ repos:types: [python]- repo: https://github.com/astral-sh/ruff-pre-commit- rev: v0.16.7+ rev: v0.16.6hooks:# Run the linter- id: ruff-checkdiff --git a/marimo/_ai/_types.py b/marimo/_ai/_types.pyindex e06d0a9f31..dc2b031598 100644--- a/marimo/_ai/_types.py+++ b/marimo/_ai/_types.py@@ -253,7 +253,8 @@ class ChatMessage(msgspec.Struct, dict=True):return parse_raw(part, cls=PartType, allow_unknown_keys=True)- except Exception:+ # Each parser is expected to reject incompatible part types.+ except Exception: # noqa: S112continuereturn cast(ChatPart, part)diff --git a/marimo/_cli/development/commands.py b/marimo/_cli/development/commands.pyindex 88a9bb2d2c..3af1014882 100644--- a/marimo/_cli/development/commands.py+++ b/marimo/_cli/development/commands.py@@ -158,7 +158,8 @@ def _enrich_branded_types(try:hints = typing.get_type_hints(struct_cls)- except Exception:+ # Some models contain references that cannot be resolved here.+ except Exception: # noqa: S112continuefield_to_schema_key: dict[str, str] = {}diff --git a/marimo/_runtime/_wasm/_concurrency/_state.py b/marimo/_runtime/_wasm/_concurrency/_state.pyindex 67cadecb6c..62724089a4 100644--- a/marimo/_runtime/_wasm/_concurrency/_state.py+++ b/marimo/_runtime/_wasm/_concurrency/_state.py@@ -355,7 +355,8 @@ def request_shutdown() -> None:for process in list(live_processes):try:process.kill()- except Exception:+ # Shutdown is best effort; continue cleaning up remaining workers.+ except Exception: # noqa: S112continuefor thread in list(live_threads):task = getattr(thread, "_task", None)diff --git a/marimo/_runtime/complete.py b/marimo/_runtime/complete.pyindex 55dd5057f4..e5b83840f2 100644--- a/marimo/_runtime/complete.py+++ b/marimo/_runtime/complete.py@@ -227,7 +227,8 @@ def _param_types_from_signatures(for param in params:try:type_hint = cast(str, param.get_type_hint())- except Exception:+ # Jedi may not be able to resolve every parameter's type hint.+ except Exception: # noqa: S112continueif type_hint:param_types[param.name] = type_hintdiff --git a/marimo/_runtime/runtime.py b/marimo/_runtime/runtime.pyindex 0bce620461..9c13515dbe 100644--- a/marimo/_runtime/runtime.py+++ b/marimo/_runtime/runtime.py@@ -1726,7 +1726,7 @@ class Kernel:try:cell = compile_cell(er.code, cell_id=er.cell_id)- except Exception:+ except Exception: # noqa: S112# The cell was not parsable.continuegraph.register_cell(cell_id=cid, cell=cell)@@ -1736,7 +1736,8 @@ class Kernel:for er in execution_requests:try:cell = compile_cell(er.code, cell_id=er.cell_id)- except Exception:+ # Unparsable requests cannot contribute graph ancestors.+ except Exception: # noqa: S112continuegraph.register_cell(cell_id=er.cell_id, cell=cell)ancestors |= graph.ancestors(er.cell_id)diff --git a/pyproject.toml b/pyproject.tomlindex f1b405c55f..0d8d8a09ed 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -143,7 +143,7 @@ dev = [# Stubs for optional dataframe backends"pyarrow-stubs",# For linting- "ruff>=0.15.18",+ "ruff>=0.16.6",# For AI"pydantic-ai-slim[openai]>=1.107.0,<3.0.0",]@@ -272,7 +272,7 @@ typecheck = [docs = ["marimo_docs",- "ruff>=0.15.18",+ "ruff>=0.16.6","mkdocs>=1.6.1",# `mkdocs serve` silently loses live reload on click 8.3.x: MkDocs declares# --no-livereload/--livereload as a feature switch group, and click 8.3@@ -375,7 +375,6 @@ ignore = ["UP007", # Use `X | Y` for type annotations"DTZ012", # `date.fromtimestamp()` called without `tzinfo`"DTZ901", # `datetime.min` / `datetime.max` used- "S112", # `try`-`except`-`continue`"PLW1509", # `subprocess` `preexec_fn` argument"DTZ002", # `datetime.today()` called without tz"D421", # Property docstring should not start with a verb (preview rule)@@ -416,8 +415,6 @@ extend-select = ["ANN202", # missing-return-type-private-function"ANN205", # missing-return-type-static-method"ANN206", # missing-return-type-class-method- # isort- "I001",# Enable entire ruff rule section"ASYNC", # subset of flake8-async rules"TCH", # Rules around TYPE_CHECKING blocks@@ -434,21 +431,10 @@ extend-select = ["D3",# "D400", # First line should end with a period# "D401", # First line of docstring should be in imperative mood- "D402",- "D403",- "D412",- "D419","PGH004", # Use specific rule codes when using noqa- "PGH005", # Invalid unittest.mock.Mock methods/attributes/properties"RUF006", # Store a reference to the return value of asyncio.create_task# "S101", # Checks use `assert` outside the test cases, test cases should be added into the exclusions- "B004", # Checks for use of hasattr(x, "__call__") and replaces it with callable(x)- "B006", # Checks for uses of mutable objects as function argument defaults.- "B017", # Checks for pytest.raises context managers that catch Exception or BaseException.- "B019", # Use of functools.lru_cache or functools.cache on methods can lead to memory leaks- "TRY002", # Prohibit use of `raise Exception`, use specific exceptions instead."T201", # No print statements- "D3", # pydocstyle Quotes Issues"D4", # pydocstyle Docstring Content Issues"D207", # Docstring is under-indented"D208", # Docstring is over-indented