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
fix: do not run create __marimo__/cache by default (#5910)
Dylan Madisetti65d17efdae4f
diff --git a/marimo/_save/stores/file.py b/marimo/_save/stores/file.pyindex 6049cc785e..6983e6a47e 100644--- a/marimo/_save/stores/file.py+++ b/marimo/_save/stores/file.py@@ -15,7 +15,9 @@ def _valid_path(path: Path) -> bool:class FileStore(Store):def __init__(self, save_path: Optional[str] = None) -> None:self.save_path = Path(save_path or self._default_save_path())- self._init_save_path()+ # NB. construction may be called on store import, so do not create+ # directories until needed.+ self._initialized = Falsedef _default_save_path(self) -> Path:if (root := notebook_dir()) is not None:@@ -27,6 +29,9 @@ class FileStore(Store):self.save_path.mkdir(parents=True, exist_ok=True)def get(self, key: str) -> Optional[bytes]:+ if not self._initialized:+ self._init_save_path()+ self._initialized = Truepath = self.save_path / keyif not _valid_path(path):return None@@ -35,6 +40,7 @@ class FileStore(Store):def put(self, key: str, value: bytes) -> bool:path = self.save_path / keypath.parent.mkdir(parents=True, exist_ok=True)+ self._initialized = Truepath.write_bytes(value)return Truediff --git a/tests/_save/stores/test_file.py b/tests/_save/stores/test_file.pynew file mode 100644index 0000000000..f4312a6eb3--- /dev/null+++ b/tests/_save/stores/test_file.py@@ -0,0 +1,24 @@+# Copyright 2025 Marimo. All rights reserved.++from __future__ import annotations++from marimo._save.stores.file import FileStore+++class TestFileStore:+ def test_init_doesnt_make_file(self, tmp_path) -> None:+ """Test that initializing FileStore does not create a file."""+ _store = FileStore(tmp_path / "test_store")+ # Should not be created just on initialization+ assert not (tmp_path / "test_store").exists()++ def test_get_put(self, tmp_path) -> None:+ """Test put and get functionality of FileStore."""+ store = FileStore(tmp_path / "test_store")+ assert not (tmp_path / "test_store").exists()+ data = b"hello world"+ store.put("key", data)+ assert store.get("key") == data+ # Store is actually created+ assert (tmp_path / "test_store").exists()+ assert (tmp_path / "test_store" / "key").exists()