Skip to content

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.

chore: Update ruff version in dev dependencies to match pre-commit (#6585)

Myles Scolnick42001a26cc81
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1a0666dd15..718190ace9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -31,7 +31,7 @@ repos:
pass_filenames: false
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.13.1
+ rev: v0.13.2
hooks:
# Run the linter
- id: ruff
diff --git a/pyproject.toml b/pyproject.toml
index 4e65916c79..e7779ac750 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -110,7 +110,7 @@ dev = [
"duckdb>=1.0.0",
"sqlglot>=26.2.0",
# For linting
- "ruff~=0.9.1",
+ "ruff>=0.13.1",
# For AI
"openai>=1.55.3",
]
@@ -307,6 +307,7 @@ python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
features = ["docs"]
dependencies = [
"marimo_docs @ file://docs",
+ "ruff>=0.13.1",
]
[tool.uv.sources]
@@ -360,6 +361,7 @@ ignore = [
"PERF203", # try-except within a loop incurs performance overhead; not always possible
"PERF401", # Use {message_str} to create a transformed list; at the cost of readability
"PERF403", # Use a dictionary comprehension instead of a for-loop; at the cost of readability
+ "ASYNC240", # Async functions should not use os.path methods, use trio.Path or anyio.path
# TODO: we should fix these, and enable this rule
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"E501", # Line too long, we still trim
diff --git a/tests/_cli/test_cli_export.py b/tests/_cli/test_cli_export.py
index 5cd76fabcb..f49f44568a 100644
--- a/tests/_cli/test_cli_export.py
+++ b/tests/_cli/test_cli_export.py
@@ -301,7 +301,7 @@ class TestExportHTML:
)
async def test_export_watch(self, temp_marimo_file: str) -> None:
temp_out_file = temp_marimo_file.replace(".py", ".html")
- p = subprocess.Popen( # noqa: ASYNC101 ASYNC220
+ p = subprocess.Popen( # noqa: ASYNC220
[
"marimo",
"export",
@@ -325,7 +325,7 @@ class TestExportHTML:
assert not path.exists(temp_out_file)
# Modify file
- with open(temp_marimo_file, "a") as f: # noqa: ASYNC101 ASYNC230
+ with open(temp_marimo_file, "a") as f: # noqa: ASYNC230
f.write("\n# comment\n")
assert p.poll() is None
@@ -631,7 +631,7 @@ class TestExportScript:
)
async def test_export_watch_script(self, temp_marimo_file: str) -> None:
temp_out_file = temp_marimo_file.replace(".py", ".script.py")
- p = subprocess.Popen( # noqa: ASYNC101 ASYNC220
+ p = subprocess.Popen( # noqa: ASYNC220
[
"marimo",
"export",
@@ -655,7 +655,7 @@ class TestExportScript:
assert not path.exists(temp_out_file)
# Modify file
- with open(temp_marimo_file, "a") as f: # noqa: ASYNC101 ASYNC230
+ with open(temp_marimo_file, "a") as f: # noqa: ASYNC230
f.write("\n# comment\n")
assert p.poll() is None
@@ -749,7 +749,7 @@ class TestExportMarkdown:
)
async def test_export_watch_markdown(self, temp_marimo_file: str) -> None:
temp_out_file = temp_marimo_file.replace(".py", ".md")
- p = subprocess.Popen( # noqa: ASYNC101 ASYNC220
+ p = subprocess.Popen( # noqa: ASYNC220
[
"marimo",
"export",
@@ -773,7 +773,7 @@ class TestExportMarkdown:
assert not path.exists(temp_out_file)
# Modify file
- with open(temp_marimo_file, "a") as f: # noqa: ASYNC101 ASYNC230
+ with open(temp_marimo_file, "a") as f: # noqa: ASYNC230
f.write("\n# comment\n")
assert p.poll() is None
diff --git a/tests/_plugins/stateless/test_audio.py b/tests/_plugins/stateless/test_audio.py
index 7b6c989377..51cb16975a 100644
--- a/tests/_plugins/stateless/test_audio.py
+++ b/tests/_plugins/stateless/test_audio.py
@@ -142,7 +142,7 @@ async def test_audio_numpy_constructor() -> None:
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows CI")
async def test_audio_local_file(k: Kernel, exec_req: ExecReqProvider) -> None:
- with open(__file__, encoding="utf-8") as f: # noqa: ASYNC101 ASYNC230
+ with open(__file__, encoding="utf-8") as f: # noqa: ASYNC230
await k.run(
[
exec_req.get(
diff --git a/tests/_plugins/stateless/test_image.py b/tests/_plugins/stateless/test_image.py
index 90662accf0..90541e7c1d 100644
--- a/tests/_plugins/stateless/test_image.py
+++ b/tests/_plugins/stateless/test_image.py
@@ -163,7 +163,7 @@ async def test_image_numpy(k: Kernel, exec_req: ExecReqProvider) -> None:
async def test_image_local_file(k: Kernel, exec_req: ExecReqProvider) -> None:
# Just opens a file that exists, and make sure it gets registered
# in the virtual path registry
- with open(__file__, encoding="utf-8") as f: # noqa: ASYNC101 ASYNC230
+ with open(__file__, encoding="utf-8") as f: # noqa: ASYNC230
await k.run(
[
exec_req.get(
diff --git a/tests/_server/api/endpoints/test_ws.py b/tests/_server/api/endpoints/test_ws.py
index 95642b229b..c528ced046 100644
--- a/tests/_server/api/endpoints/test_ws.py
+++ b/tests/_server/api/endpoints/test_ws.py
@@ -218,7 +218,7 @@ async def test_file_watcher_calls_reload(client: TestClient) -> None:
session_manager.mode = SessionMode.RUN
filename = session_manager.file_router.get_unique_file_key()
assert filename
- with open(filename, "a") as f: # noqa: ASYNC101 ASYNC230
+ with open(filename, "a") as f: # noqa: ASYNC230
f.write("\n# test")
f.close()
assert session_manager.watcher_manager._watchers
diff --git a/tests/_smoke_tests/run_all.py b/tests/_smoke_tests/run_all.py
index f17af69f98..f5433c3e58 100644
--- a/tests/_smoke_tests/run_all.py
+++ b/tests/_smoke_tests/run_all.py
@@ -23,7 +23,7 @@ async def test_all_smoke_tests() -> None:
all_py_paths = list(pathlib.Path(root).rglob("*.py"))
assert all_py_paths, "No smoke tests found"
- with open(config_file) as f: # noqa: ASYNC101 ASYNC230
+ with open(config_file) as f: # noqa: ASYNC230
smoke_test_config = yaml.load(f.read(), Loader=yaml.FullLoader)
semaphore = asyncio.Semaphore(CONCURRENT_TESTS)
@@ -41,7 +41,7 @@ async def test_all_examples() -> None:
all_py_paths = list(pathlib.Path(root).rglob("*.py"))
assert all_py_paths, "No examples found"
- with open(config_file) as f: # noqa: ASYNC101 ASYNC230
+ with open(config_file) as f: # noqa: ASYNC230
smoke_test_config = yaml.load(f.read(), Loader=yaml.FullLoader)
semaphore = asyncio.Semaphore(CONCURRENT_TESTS)
@@ -71,7 +71,7 @@ async def _run_test(
)
input_data = file_config.get("input", None)
- with open(file) as f: # noqa: ASYNC101 ASYNC230
+ with open(file) as f: # noqa: ASYNC230
content = f.read()
if "marimo.App(" not in content:
return
diff --git a/tests/_utils/test_file_watcher.py b/tests/_utils/test_file_watcher.py
index c25c2dafa6..a719eb335c 100644
--- a/tests/_utils/test_file_watcher.py
+++ b/tests/_utils/test_file_watcher.py
@@ -30,7 +30,7 @@ async def test_polling_file_watcher() -> None:
# Wait a bit and then modify the file
await asyncio.sleep(0.2)
- with open(tmp_path, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path, "w") as f: # noqa: ASYNC230
f.write("modification")
# Wait for the watcher to detect the change
@@ -87,7 +87,7 @@ async def test_file_watcher_manager() -> None:
# Modify file1
await asyncio.sleep(0.2)
- with open(tmp_path1, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path1, "w") as f: # noqa: ASYNC230
f.write("modification1")
# Wait for callbacks
@@ -104,7 +104,7 @@ async def test_file_watcher_manager() -> None:
manager.remove_callback(tmp_path1, callback1)
# Modify file1 again
- with open(tmp_path1, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path1, "w") as f: # noqa: ASYNC230
f.write("modification2")
# Wait for callbacks
@@ -116,7 +116,7 @@ async def test_file_watcher_manager() -> None:
assert len(callback3_calls) == 0
# Modify file2
- with open(tmp_path2, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path2, "w") as f: # noqa: ASYNC230
f.write("modification3")
# Wait for callbacks
@@ -133,9 +133,9 @@ async def test_file_watcher_manager() -> None:
manager.remove_callback(tmp_path2, callback3)
# Modify both files
- with open(tmp_path1, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path1, "w") as f: # noqa: ASYNC230
f.write("modification4")
- with open(tmp_path2, "w") as f: # noqa: ASYNC101 ASYNC230
+ with open(tmp_path2, "w") as f: # noqa: ASYNC230
f.write("modification4")
# Wait for potential callbacks