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
ci: Add additional test for lowest resolution bounds (#6198)
Dylan Madisetti78988f0826ae
diff --git a/.github/workflows/test_be.yaml b/.github/workflows/test_be.yamlindex 03505456c3..073c5e8566 100644--- a/.github/workflows/test_be.yaml+++ b/.github/workflows/test_be.yaml@@ -88,6 +88,9 @@ jobs:- os: ubuntu-latestpython-version: '3.13'dependencies: 'core,optional'+ - os: ubuntu-latest+ python-version: '3.9'+ dependencies: 'minimal'steps:- name: 🛑 Cancel Previous Runsuses: styfle/[email protected]@@ -112,8 +115,8 @@ jobs:if: ${{ matrix.python-version == '3.12' }}run: hatch run typecheck:check- # Test with minimal dependencies- - name: Test with minimal dependencies+ # Test with base dependencies+ - name: Test with base dependenciesif: ${{ matrix.dependencies == 'core' }}run: |hatch run +py=${{ matrix.python-version }} test:test -v tests/ -k "not test_cli" --durations=10@@ -124,6 +127,16 @@ jobs:run: |hatch run +py=${{ matrix.python-version }} test-optional:test -v tests/ -k "not test_cli" --durations=10+ # Test with minimal dependencies using lowest resolution+ # https://docs.astral.sh/uv/concepts/resolution/#lowest-resolution+ # https://docs.astral.sh/uv/reference/environment/#uv_resolution+ - name: Test with minimal dependencies (lowest resolution)+ if: ${{ matrix.dependencies == 'minimal' }}+ run: |+ hatch run +py=${{ matrix.python-version }} test:test -v tests/ -k "not test_cli" --durations=10+ env:+ UV_RESOLUTION: lowest+# Only run coverage on `main` so it is not blockingtest_coverage:needs: changesdiff --git a/marimo/_runtime/reload/autoreload.py b/marimo/_runtime/reload/autoreload.pyindex 0afbf4a089..61a1e4ced3 100644--- a/marimo/_runtime/reload/autoreload.py+++ b/marimo/_runtime/reload/autoreload.py@@ -39,6 +39,9 @@ func_attrs = ["__dict__",]+M = TypeVar("M", bound=types.ModuleType)+T = TypeVar("T")+@dataclassclass ModuleMTime:@@ -52,6 +55,21 @@ OldObjectsMapping = dict[]+# Compat with cmodules in Python < 3.10+def safe_getattr(obj: M, attr: str, default: T | None = None) -> T | None:+ try:+ return getattr(obj, attr, default)+ except ModuleNotFoundError:+ return default+++def safe_hasattr(obj: M, attr: str) -> bool:+ try:+ return hasattr(obj, attr)+ except ModuleNotFoundError:+ return False++def modules_imported_by_cell(cell: CellImpl, sys_modules: dict[str, types.ModuleType]) -> set[str]:@@ -146,7 +164,7 @@ class ModuleReloader:def filename_and_mtime(self, module: types.ModuleType) -> ModuleMTime | None:- if not hasattr(module, "__file__") or module.__file__ is None:+ if not safe_hasattr(module, "__file__") or module.__file__ is None:return Noneif getattr(module, "__name__", None) in [@@ -369,9 +387,6 @@ def update_generic(a: object, b: object) -> bool:return False-T = TypeVar("T")--class StrongRef(Generic[T]):def __init__(self, obj: T) -> None:self.obj = objdiff --git a/marimo/_runtime/reload/module_watcher.py b/marimo/_runtime/reload/module_watcher.pyindex 41d10e7d5e..2457c78e35 100644--- a/marimo/_runtime/reload/module_watcher.py+++ b/marimo/_runtime/reload/module_watcher.py@@ -14,6 +14,7 @@ from marimo._runtime import dataflowfrom marimo._runtime.reload.autoreload import (ModuleReloader,modules_imported_by_cell,+ safe_getattr,)if TYPE_CHECKING:@@ -56,7 +57,7 @@ def _depends_on(for found_module in itertools.chain([src_module], module_dependencies.values()):- file = getattr(found_module, "__file__", None)+ file = safe_getattr(found_module, "__file__", None)if file is None:continue@@ -76,7 +77,7 @@ def _depends_on(def _is_third_party_module(module: types.ModuleType) -> bool:- filepath = getattr(module, "__file__", None)+ filepath = safe_getattr(module, "__file__", None)if filepath is None:return Falsereturn "site-packages" in pathlib.Path(filepath).partsdiff --git a/pixi.lock b/pixi.lockindex 1082ef47b1..bdb608cfc4 100644--- a/pixi.lock+++ b/pixi.lock@@ -206,10 +206,10 @@ environments:- pypi: https://files.pythonhosted.org/packages/c0/5a/9cac0c82afec3d09ccd97c8b6502d48f165f9124db81b4bcb90b4af974ee/jedi-0.19.2-py2.py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/32/ee/7e042a13e93f09c24618dc804f01849735d81740f8b74827124ff7fc8396/loro-1.5.0-cp312-cp312-macosx_11_0_arm64.whl- pypi: https://files.pythonhosted.org/packages/3f/08/83871f3c50fc983b88547c196d11cf8c3340e37c32d2e9d6152abe2c61f7/Markdown-3.7-py3-none-any.whl- - pypi: https://files.pythonhosted.org/packages/41/c1/e9bc6b67c774e7c1f939c91ea535f18f7644fedc61b20d6baa861ad52b34/narwhals-1.33.0-py3-none-any.whl+ - pypi: https://files.pythonhosted.org/packages/7d/81/1cf7a468ef2f8e88266d5c3e5ab026a045aa76150e6640bfe9c5450a8c11/narwhals-2.3.0-py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/c6/ac/dac4a63f978e4dcb3c6d3a78c4d8e0192a113d288502a1216950c41b1027/parso-0.8.4-py2.py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/04/8b/30f930733afe425e3cbfc0e1468a30a18942350c1a8816acfade80c005c4/psutil-7.0.0-cp36-abi3-macosx_11_0_arm64.whl- - pypi: https://files.pythonhosted.org/packages/eb/f5/b9e2a42aa8f9e34d52d66de87941ecd236570c7ed2e87775ed23bbe4e224/pymdown_extensions-10.14.3-py3-none-any.whl+ - pypi: https://files.pythonhosted.org/packages/e4/06/43084e6cbd4b3bc0e80f6be743b2e79fbc6eed8de9ad8c629939fa55d972/pymdown_extensions-10.16.1-py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/a0/4b/528ccf7a982216885a1ff4908e886b8fb5f19862d1962f56a3fce2435a70/starlette-0.46.1-py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/61/14/33a3a1352cfa71812a3a21e8c9bfb83f60b0011f5e36f2b1399d51928209/uvicorn-0.34.0-py3-none-any.whl- pypi: https://files.pythonhosted.org/packages/3d/69/1a681dd6f02180916f116894181eab8b2e25b31e484c5d0eae637ec01f7c/websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl@@ -1160,10 +1160,10 @@ packages:- pkg:pypi/more-itertools?source=hash-mappingsize: 61359timestamp: 1745349566387-- pypi: https://files.pythonhosted.org/packages/41/c1/e9bc6b67c774e7c1f939c91ea535f18f7644fedc61b20d6baa861ad52b34/narwhals-1.33.0-py3-none-any.whl+- pypi: https://files.pythonhosted.org/packages/22/58/a12a534269aa5ba9abdf73a9e0deb600297b71cbf7291bca212944663143/narwhals-1.39.0-py3-none-any.whlname: narwhals- version: 1.33.0- sha256: f653319112fd121a1f1c18a40cf70dada773cdacfd53e62c2aa0afae43c17129+ version: 1.39.0+ sha256: 50b6778f4b4249eb86c88dd17c3907dd004a16ec25b02d5effaf226a2bcfb940requires_dist:- cudf>=24.10.0 ; extra == 'cudf'- dask[dataframe]>=2024.8 ; extra == 'dask'@@ -1177,12 +1177,13 @@ packages:- polars>=0.20.3 ; extra == 'polars'- pyarrow>=11.0.0 ; extra == 'pyarrow'- pyspark>=3.5.0 ; extra == 'pyspark'+ - pyspark[connect]>=3.5.0 ; extra == 'pyspark-connect'- sqlframe>=3.22.0 ; extra == 'sqlframe'requires_python: '>=3.8'-- pypi: https://files.pythonhosted.org/packages/22/58/a12a534269aa5ba9abdf73a9e0deb600297b71cbf7291bca212944663143/narwhals-1.39.0-py3-none-any.whl+- pypi: https://files.pythonhosted.org/packages/7d/81/1cf7a468ef2f8e88266d5c3e5ab026a045aa76150e6640bfe9c5450a8c11/narwhals-2.3.0-py3-none-any.whlname: narwhals- version: 1.39.0- sha256: 50b6778f4b4249eb86c88dd17c3907dd004a16ec25b02d5effaf226a2bcfb940+ version: 2.3.0+ sha256: 5507b1a9a9c2b1c55a627fdf6cf722fef2e23498bd14362a332c8848a311c321requires_dist:- cudf>=24.10.0 ; extra == 'cudf'- dask[dataframe]>=2024.8 ; extra == 'dask'@@ -1192,13 +1193,13 @@ packages:- pyarrow-hotfix ; extra == 'ibis'- rich ; extra == 'ibis'- modin ; extra == 'modin'- - pandas>=0.25.3 ; extra == 'pandas'- - polars>=0.20.3 ; extra == 'polars'- - pyarrow>=11.0.0 ; extra == 'pyarrow'+ - pandas>=1.1.3 ; extra == 'pandas'+ - polars>=0.20.4 ; extra == 'polars'+ - pyarrow>=13.0.0 ; extra == 'pyarrow'- pyspark>=3.5.0 ; extra == 'pyspark'- pyspark[connect]>=3.5.0 ; extra == 'pyspark-connect'- - sqlframe>=3.22.0 ; extra == 'sqlframe'- requires_python: '>=3.8'+ - sqlframe>=3.22.0,!=3.39.3 ; extra == 'sqlframe'+ requires_python: '>=3.9'- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.condasha256: 3fde293232fa3fca98635e1167de6b7c7fda83caf24b9d6c91ec9eefb4f4d586md5: 47e340acb35de30501a76c7c799c41d7@@ -1525,24 +1526,24 @@ packages:- pkg:pypi/pygments?source=hash-mappingsize: 888600timestamp: 1736243563082-- pypi: https://files.pythonhosted.org/packages/eb/f5/b9e2a42aa8f9e34d52d66de87941ecd236570c7ed2e87775ed23bbe4e224/pymdown_extensions-10.14.3-py3-none-any.whl+- pypi: https://files.pythonhosted.org/packages/a7/d1/c54e608505776ce4e7966d03358ae635cfd51dff1da6ee421c090dbc797b/pymdown_extensions-10.15-py3-none-any.whlname: pymdown-extensions- version: 10.14.3- sha256: 05e0bee73d64b9c71a4ae17c72abc2f700e8bc8403755a00580b49a4e9f189e9+ version: '10.15'+ sha256: 46e99bb272612b0de3b7e7caf6da8dd5f4ca5212c0b273feb9304e236c484e5frequires_dist:- markdown>=3.6- pyyaml- pygments>=2.19.1 ; extra == 'extra'requires_python: '>=3.8'-- pypi: https://files.pythonhosted.org/packages/a7/d1/c54e608505776ce4e7966d03358ae635cfd51dff1da6ee421c090dbc797b/pymdown_extensions-10.15-py3-none-any.whl+- pypi: https://files.pythonhosted.org/packages/e4/06/43084e6cbd4b3bc0e80f6be743b2e79fbc6eed8de9ad8c629939fa55d972/pymdown_extensions-10.16.1-py3-none-any.whlname: pymdown-extensions- version: '10.15'- sha256: 46e99bb272612b0de3b7e7caf6da8dd5f4ca5212c0b273feb9304e236c484e5f+ version: 10.16.1+ sha256: d6ba157a6c03146a7fb122b2b9a121300056384eafeec9c9f9e584adfdb2a32drequires_dist:- markdown>=3.6- pyyaml- pygments>=2.19.1 ; extra == 'extra'- requires_python: '>=3.8'+ requires_python: '>=3.9'- conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.12.10-h9e4cc4f_0_cpython.condasha256: 4dc1da115805bd353bded6ab20ff642b6a15fcc72ac2f3de0e1d014ff3612221md5: a41d26cd4d47092d683915d058380decdiff --git a/pyproject.toml b/pyproject.tomlindex 5db77f6dfb..74bad6b5f6 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -15,10 +15,10 @@ dependencies = [# code completion"jedi>=0.18.0",# compile markdown to html- "markdown>=3.4,<4",+ "markdown>=3.6,<4",# add features to markdown# Pinned to specific version for introduction of codeblock handling.- "pymdown-extensions>=10.11.2,<11",+ "pymdown-extensions>=10.15,<11",# syntax highlighting of code in markdown"pygments>=2.13,<3",# for reading, writing configs@@ -29,9 +29,9 @@ dependencies = [# - 0.22.0 introduced timeout-graceful-shutdown, which we use"uvicorn >= 0.22.0",# web framework- # - 0.26.1 introduced lifespans, which we use+ # - 0.29.0 introduced Middleware kwargs, which we use# - starlette 0.36.0 introduced a bug- "starlette>=0.26.1,!=0.36.0",+ "starlette>=0.35.0,!=0.36.0",# websockets for use with starlette, and for lsp"websockets >= 14.2.0",# loro for collaborative editing@@ -45,7 +45,7 @@ dependencies = [# required dependency in Starlette for SessionMiddleware support"itsdangerous>=2.0.0",# for dataframe support- "narwhals>=1.12.0",+ "narwhals>=1.34.1",# for packaging.version; not sure what the lower bound is."packaging",]@@ -82,7 +82,7 @@ marimo_converter = "marimo._utils.docs:MarimoConverter"sql = ["duckdb>=1.0.0","polars[pyarrow]>=1.9.0",- "sqlglot>=23.4"+ "sqlglot>=25.32"]# List of deps that are recommended for most users@@ -92,7 +92,7 @@ recommended = ["duckdb>=1.0.0", # SQL cells"altair>=5.4.0", # Plotting in datasource viewer"polars[pyarrow]>=1.9.0", # SQL output back in Python- "sqlglot>=23.4", # SQL cells parsing+ "sqlglot>=25.32", # SQL cells parsing"openai>=1.55.3", # AI features"ruff", # Formatting"nbformat>=5.7.0", # Export as IPYNB@@ -106,7 +106,7 @@ dev = ["opentelemetry-sdk~=1.26.0",# For SQL"duckdb>=1.0.0",- "sqlglot>=23.4",+ "sqlglot>=25.32",# For linting"ruff~=0.9.1",# For AI@@ -170,9 +170,9 @@ dependencies = ["panel~=1.5.3","polars~=1.9.0",# Types in 2.2.0 don't work great with mypy- "narwhals>=1.12.0, <2.2.0",+ "narwhals>=1.34.1, <2.2.0","matplotlib>=3.8.0",- "sqlglot>=23.4",+ "sqlglot>=25.32","sqlalchemy>=2.0.40","google-genai>=1.0.0","openai>=1.55.3",@@ -248,7 +248,7 @@ extra-dependencies = ["altair>=5.4.0","plotly>=5.14.0","polars>=1.32.2",- "sqlglot>=23.4",+ "sqlglot>=25.32","sqlalchemy>=2.0.40","pyiceberg>=0.9.0",# For testing clickhousediff --git a/tests/mocks.py b/tests/mocks.pyindex 340b99c736..dcecd89526 100644--- a/tests/mocks.py+++ b/tests/mocks.py@@ -1,6 +1,9 @@from __future__ import annotationsimport difflib+import re+import sys+from html.parser import HTMLParserfrom pathlib import Pathfrom typing import Callable@@ -10,6 +13,28 @@ from marimo import __version__from marimo._utils.paths import maybe_make_dirs+class ToText(HTMLParser):+ def __init__(self) -> None:+ HTMLParser.__init__(self)+ self._text = []++ def handle_data(self, data: str) -> None:+ text = data.strip()+ if len(text) > 0:+ text = re.sub("[ \t\r\n]+", " ", text)+ self._text.append(text.strip())++ def text(self) -> str:+ return " ".join(self._text).strip()++ @staticmethod+ def apply(html: str) -> str:+ parser = ToText()+ parser.feed(html)+ parser.close()+ return parser.text()++def snapshotter(current_file: str) -> Callable[[str, str], None]:"""Utility function to create and compare snapshots.@@ -76,6 +101,15 @@ def snapshotter(current_file: str) -> Callable[[str, str], None]:)if result != expected:+ # Old versions of markdown are allowed to have different+ # tags and whitespace+ if sys.version_info < (3, 10):+ if ToText.apply(result) == ToText.apply(expected):+ pytest.xfail(+ "Different tags in older markdown versions"+ )+ return+write_result()print("Snapshot updated")