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
return cell name in run mode (#8524)
Shahmir Varqhab746ef1ccd58
diff --git a/marimo/_server/api/endpoints/ws/ws_kernel_ready.py b/marimo/_server/api/endpoints/ws/ws_kernel_ready.pyindex d0ea967650..409c1c6af1 100644--- a/marimo/_server/api/endpoints/ws/ws_kernel_ready.py+++ b/marimo/_server/api/endpoints/ws/ws_kernel_ready.py@@ -127,7 +127,7 @@ def _extract_cell_data(codes, names, configs, cell_ids = tuple(zip(*tuple(- ("", "", cell_data.config, cell_data.cell_id)+ ("", cell_data.name, cell_data.config, cell_data.cell_id)for cell_data in app.cell_manager.cell_data()))diff --git a/tests/_server/api/endpoints/test_ws.py b/tests/_server/api/endpoints/test_ws.pyindex fc61899d80..33ebdb81ba 100644--- a/tests/_server/api/endpoints/test_ws.py+++ b/tests/_server/api/endpoints/test_ws.py@@ -303,6 +303,40 @@ async def test_cannot_connect_kiosk_with_run_session(assert exc_info.value.reason == "MARIMO_KIOSK_NOT_ALLOWED"+async def test_kernel_ready_sends_names_but_not_code_when_include_code_false(+ client: TestClient,+) -> None:+ """Cell names are sent in kernel-ready even when include_code=False.++ This ensures data-cell-name attributes are populated in the DOM when+ running with marimo run (without --include-code).++ The 4 fields from _extract_cell_data (ws_kernel_ready.py) behave as:+ - codes -> blanked ("") to hide source code+ - names -> preserved (needed for data-cell-name DOM attribute)+ - configs -> preserved (needed for cell rendering)+ - cell_ids -> preserved (needed for cell identity)+ """+ session_manager = get_session_manager(client)+ session_manager.mode = SessionMode.RUN+ session_manager.include_code = False+ with client.websocket_connect(WS_URL) as websocket:+ data = websocket.receive_json()+ assert_kernel_ready_response(+ data,+ create_response(+ {+ "codes": [""], # hidden+ "names": ["__"], # preserved+ "configs": [+ {"disabled": False, "hide_code": False}+ ], # preserved+ "cell_ids": ["Hbol"], # preserved+ }+ ),+ )++async def test_connects_to_existing_session_with_same_file(client: TestClient,temp_marimo_file: str,