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.

fix: remove some deprecation warnings (#8113)

Myles Scolnick2e500b3d75cd
diff --git a/marimo/_ast/parse.py b/marimo/_ast/parse.py
index a5ca277211..f21836987a 100644
--- a/marimo/_ast/parse.py
+++ b/marimo/_ast/parse.py
@@ -3,7 +3,6 @@ from __future__ import annotations
import ast
import io
-import sys
import token as token_types
import warnings
from pathlib import Path
@@ -1000,9 +999,9 @@ def is_body_cell(node: Node) -> bool:
def _is_ellipsis(node: Optional[Node]) -> bool:
if node is None:
return False
- if sys.version_info < (3, 14):
- return isinstance(node, ast.Ellipsis)
- return isinstance(node, ast.Constant) and node.value == ...
+ # ast.Ellipsis is deprecated in 3.12+ and removed in 3.14
+ # Use ast.Constant check which works across all Python versions
+ return isinstance(node, ast.Constant) and node.value is ...
def _is_setup_call(node: Node) -> bool:
diff --git a/marimo/_cli/envinfo.py b/marimo/_cli/envinfo.py
index 0e003fbd94..b8c1716edc 100644
--- a/marimo/_cli/envinfo.py
+++ b/marimo/_cli/envinfo.py
@@ -50,8 +50,27 @@ def get_default_locale() -> str:
try:
import locale
- default_locale, _ = locale.getdefaultlocale()
- return default_locale or "--"
+ # getdefaultlocale is deprecated in 3.13+ and removed in 3.15
+ # Use getlocale() with LC_ALL as a fallback chain
+ loc = locale.getlocale(locale.LC_ALL)
+ if loc[0]:
+ return loc[0]
+ # Try LC_MESSAGES on Unix-like systems
+ try:
+ loc = locale.getlocale(locale.LC_MESSAGES)
+ if loc[0]:
+ return loc[0]
+ except AttributeError:
+ pass
+ # Fall back to environment variable check
+ import os
+
+ for env_var in ("LC_ALL", "LC_MESSAGES", "LANG", "LANGUAGE"):
+ val = os.environ.get(env_var)
+ if val:
+ # Extract locale name (e.g., "en_US" from "en_US.UTF-8")
+ return val.split(".")[0]
+ return "--"
except Exception:
return "--"
diff --git a/marimo/_utils/rst_to_html.py b/marimo/_utils/rst_to_html.py
index 30f0da5d82..7d61589168 100644
--- a/marimo/_utils/rst_to_html.py
+++ b/marimo/_utils/rst_to_html.py
@@ -9,12 +9,15 @@ def convert_rst_to_html(rst_content: str) -> str:
"""Convert RST content to HTML."""
from docutils.core import publish_parts # type: ignore[import-untyped]
+ from docutils.writers.html4css1 import (
+ Writer, # type: ignore[import-untyped]
+ )
# redirect stderr and ignore it to silence error messages
with contextlib.redirect_stderr(io.StringIO()) as _:
parts = publish_parts(
rst_content,
- writer_name="html",
+ writer=Writer(),
settings_overrides={
"warning_stream": None,
"file_insertion_enabled": False,
diff --git a/tests/_data/test_preview_column.py b/tests/_data/test_preview_column.py
index 80fe34b60b..8e30b51163 100644
--- a/tests/_data/test_preview_column.py
+++ b/tests/_data/test_preview_column.py
@@ -566,7 +566,12 @@ def test_sanitize_dtypes_enum() -> None:
),
)
def test_preview_column_duration_dtype(df) -> None:
- for column_name in df.columns:
+ columns = (
+ df.collect_schema().names()
+ if hasattr(df, "collect_schema")
+ else df.columns
+ )
+ for column_name in columns:
result = get_column_preview_dataset(
table=get_table_manager(df),
table_name="table",
diff --git a/tests/_plugins/ui/_impl/test_plotly.py b/tests/_plugins/ui/_impl/test_plotly.py
index 11062e6366..ca770bb382 100644
--- a/tests/_plugins/ui/_impl/test_plotly.py
+++ b/tests/_plugins/ui/_impl/test_plotly.py
@@ -2160,6 +2160,7 @@ def test_scattermap_selection_with_customdata() -> None:
assert result[0]["customdata"][1] == 0
[email protected]("ignore:.*scattermapbox.*:DeprecationWarning")
def test_scattermapbox_selection() -> None:
"""Test scattermapbox (deprecated) selection works."""
fig = go.Figure(
diff --git a/tests/conftest.py b/tests/conftest.py
index f11d13fd80..c8446d8852 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -419,6 +419,8 @@ def app() -> Generator[App, None, None]:
class TestableModuleStub(ModuleStub):
+ __test__ = False
+
def __eq__(self, other: Any) -> bool:
# Used for testing, equality otherwise not useful.
if not isinstance(other, ModuleStub):