Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _(databases_tab, history, mo, recent_tab, status, workspace):
@app.cell
def _(client, mo):
_df = mo.sql(
f"""
"""
SELECT 1 AS example_value
""",
engine=client
Expand Down
6 changes: 3 additions & 3 deletions hotdata_marimo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@
recent_results,
run_history,
)
from hotdata_marimo.sql_editor import SqlEditor, sql_editor
from hotdata_marimo.sql_engine import (
HotdataMarimoEngine,
register_hotdata_sql_engine,
unregister_hotdata_sql_engine,
)
from hotdata_marimo.sql_editor import SqlEditor, sql_editor
from hotdata_marimo.table_browser import TableBrowser, connection_picker, table_browser
from hotdata_marimo.workspace_selector import WorkspaceSelector, workspace_selector_from_env

__all__ = [
"__version__",
"HotdataClient",
"HotdataMarimoEngine",
"QueryResult",
"ManagedDatabaseWriter",
"QueryResult",
"RecentResults",
"SqlEditor",
"TableBrowser",
"WorkspaceSelector",
"__version__",
"connection_picker",
"connection_status",
"connections_panel",
Expand Down
1 change: 0 additions & 1 deletion hotdata_marimo/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Any

import marimo as mo

from hotdata_runtime import HotdataClient


Expand Down
7 changes: 5 additions & 2 deletions hotdata_marimo/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import tempfile

import marimo as mo

from hotdata_runtime import (
DEFAULT_SCHEMA,
HotdataClient,
Expand Down Expand Up @@ -47,7 +46,11 @@ def databases_panel(client: HotdataClient):
gap=1,
)
rows: list[dict[str, object]] = [
{"description": db.description or db.id, "id": db.id, "sql_prefix": f"{db.id}.{{schema}}.{{table}}"}
{
"description": db.description or db.id,
"id": db.id,
"sql_prefix": f"{db.id}.{{schema}}.{{table}}",
}
for db in dbs
]
return mo.vstack(
Expand Down
1 change: 0 additions & 1 deletion hotdata_marimo/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import marimo as mo

from hotdata_runtime import HotdataClient, QueryResult, workspace_health_lines


Expand Down
15 changes: 7 additions & 8 deletions hotdata_marimo/sql_editor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import marimo as mo

from hotdata_runtime import HotdataClient, QueryResult


Expand Down Expand Up @@ -182,13 +181,13 @@ def result(self) -> QueryResult:
)

result = self._execute_or_cached()
if result is not None:
return result

mo.stop(
True,
mo.md("SQL changed — click **Run on Hotdata** again to execute."),
)
if result is None:
mo.stop(
True,
mo.md("SQL changed — click **Run on Hotdata** again to execute."),
)
raise AssertionError("unreachable")
return result


def sql_editor(
Expand Down
4 changes: 2 additions & 2 deletions hotdata_marimo/sql_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Any, Literal

from hotdata_runtime import HotdataClient

from marimo import _loggers
from marimo._data.models import (
Database,
Expand Down Expand Up @@ -50,7 +49,8 @@ def source(self) -> str:

@property
def dialect(self) -> str:
# Marimo labels engines as ``{dialect} ({variable_name})``; display_name is patched to "Hotdata".
# Marimo labels engines as ``{dialect} ({variable_name})``;
# display_name is patched to "Hotdata".
return "hotdata"

@staticmethod
Expand Down
1 change: 0 additions & 1 deletion hotdata_marimo/table_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any

import marimo as mo

from hotdata_runtime import HotdataClient

from hotdata_marimo._options import (
Expand Down
47 changes: 46 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ requires-python = ">=3.10"
license = { text = "MIT" }
dependencies = [
"hotdata-runtime>=0.2.3",
"hotdata>=0.2.5",
"hotdata>=0.4.1",
"marimo>=0.10.0",
]

[dependency-groups]
dev = [
"mypy>=1.11",
"pytest>=8.0",
"ruff>=0.5",
]

[tool.uv]
Expand All @@ -29,6 +31,49 @@ packages = ["hotdata_marimo"]
[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.mypy]
python_version = "3.10"
strict = true
files = [
"hotdata_marimo",
"tests",
]
namespace_packages = true
explicit_package_bases = true
warn_unused_configs = true
disallow_any_decorated = true
disallow_any_explicit = true
disallow_any_expr = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
allow_untyped_globals = false
implicit_reexport = false
implicit_optional = false
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
strict_equality = true
strict_bytes = true
extra_checks = true

[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "UP", "N", "C4", "DTZ", "T20", "RET", "SIM", "RUF"]

[tool.ruff.lint.per-file-ignores]
"examples/**/*.py" = ["T201"]
"scripts/**/*.py" = ["T201", "E501"]

[tool.marimo.runtime]
# Reduces stale cell state when opening the example; overrides personal marimo.toml if unset.
auto_instantiate = true
1 change: 0 additions & 1 deletion scripts/check-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import re
import subprocess
import sys
from pathlib import Path


Expand Down
2 changes: 1 addition & 1 deletion scripts/extract-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def extract(changelog: str, version: str) -> str:
next_heading = re.search(r"^## \[", rest, re.M)
end = match.end() + (next_heading.start() if next_heading else len(rest))
section = changelog[start:end].strip()
title, _, body = section.partition("\n")
_title, _, body = section.partition("\n")
return body.strip() or f"Release {version}."


Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from unittest.mock import MagicMock

import pytest

from hotdata_runtime import QueryResult


Expand Down
4 changes: 2 additions & 2 deletions tests/test_databases_marimo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from types import SimpleNamespace
from unittest.mock import MagicMock, patch

import hotdata_marimo as hm
from hotdata_marimo.databases import ManagedDatabaseWriter, databases_panel
from hotdata_runtime import LoadManagedTableResult, ManagedDatabase

from hotdata_marimo.databases import ManagedDatabaseWriter, databases_panel


def test_databases_panel_empty_state(mock_client):
mock_client.list_managed_databases.return_value = []
Expand Down
5 changes: 2 additions & 3 deletions tests/test_hotdata_marimo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
from unittest.mock import MagicMock, patch

import pytest
from marimo._types.ids import VariableName

import hotdata_marimo as hm
from hotdata_runtime import HotdataClient
from hotdata_marimo._options import connection_options, unique_label_options
from hotdata_marimo.display import connections_panel
from hotdata_marimo.sql_engine import HotdataMarimoEngine
from hotdata_marimo.table_browser import TableBrowser
from hotdata_marimo.workspace_selector import WorkspaceSelector, workspace_selector_from_env
from marimo._types.ids import VariableName


def _selection(*, workspace_id: str, source: str, workspaces: list | None = None):
Expand Down Expand Up @@ -195,8 +194,8 @@ def test_hotdata_engine_display_name_in_marimo_ui(mock_client) -> None:
hm.register_hotdata_sql_engine()
try:
engine = HotdataMarimoEngine(mock_client, engine_name=VariableName("client"))
import marimo._sql.get_engines as ge
import marimo._runtime.runner.hooks_post_execution as hpe
import marimo._sql.get_engines as ge

for module in (ge, hpe):
conn = module.engine_to_data_source_connection(VariableName("client"), engine)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import importlib
import re
from importlib.metadata import version as dist_version
from pathlib import Path

import pytest
from importlib.metadata import version as dist_version

import hotdata_marimo as hm


REPO_ROOT = Path(__file__).resolve().parents[1]
SOURCE_ROOT = REPO_ROOT / "hotdata_marimo"
_RUNTIME_SUBMODULE = re.compile(
Expand Down
Loading