hotdata-marimo 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,124 @@
1
+ Metadata-Version: 2.4
2
+ Name: hotdata-marimo
3
+ Version: 0.1.0
4
+ Summary: Marimo integration for Hotdata runtime
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: hotdata-runtime>=0.1.0
8
+ Requires-Dist: marimo>=0.10.0
9
+ Description-Content-Type: text/markdown
10
+
11
+ # hotdata-marimo
12
+
13
+ Marimo UI helpers for [Hotdata](https://hotdata.dev): run SQL from a notebook, browse catalog metadata, and render results as tables.
14
+
15
+ ## Features
16
+
17
+ - **Workspace-aware setup** — build a `HotdataClient` from environment variables, or use `workspace_selector_from_env()` to choose a workspace interactively when no workspace is pinned.
18
+ - **Connection health** — show a compact status callout with API, workspace, and optional sandbox context.
19
+ - **Catalog browsing** — browse Hotdata connections, schemas, tables, and columns from Marimo UI controls.
20
+ - **SQL editor widget** — run SQL against Hotdata, cache the latest successful result, and render results in downstream reactive cells.
21
+ - **Native `mo.sql` engine** — register `HotdataMarimoEngine` so Marimo SQL cells can execute through a live `HotdataClient` with `engine=client`.
22
+ - **Result display helpers** — render query results, recent results, and run history as notebook-friendly UI.
23
+ - **Marimo UI aliases** — importing `hotdata_marimo` attaches helpers such as `mo.ui.hotdata_sql_editor` and `mo.ui.hotdata_table_browser` for discoverability.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ uv pip install hotdata-marimo
29
+ # or: pip install hotdata-marimo
30
+ ```
31
+
32
+ Requires Python 3.10+, **Marimo**, and [**hotdata-runtime**](https://github.com/hotdata-dev/hotdata-runtime) (Hotdata SDK + runtime/session semantics — pulled in automatically when you `pip install hotdata-marimo`).
33
+
34
+ ## Environment
35
+
36
+ | Variable | Required | Description |
37
+ |----------|----------|-------------|
38
+ | `HOTDATA_API_KEY` | Yes | API key for the Hotdata API |
39
+ | `HOTDATA_API_URL` | No | API base URL (default: `https://api.hotdata.dev`) |
40
+ | `HOTDATA_WORKSPACE` | No | Workspace id; if unset, the first active workspace is used |
41
+ | `HOTDATA_SANDBOX` | No | Sandbox session id, passed through to the SDK |
42
+
43
+ ## Minimal notebook
44
+
45
+ ```python
46
+ import marimo as mo
47
+ import hotdata_marimo as hm
48
+
49
+ client = hm.from_env()
50
+ editor = hm.sql_editor(client, default_sql="SELECT 1 AS ok")
51
+ return editor.ui
52
+ ```
53
+
54
+ ```python
55
+ return hm.query_result(editor.result)
56
+ ```
57
+
58
+ Importing `hotdata_marimo` registers discoverability aliases on Marimo’s UI namespace, so you can also use `mo.ui.hotdata_sql_editor`, `mo.ui.hotdata_table_browser`, `mo.ui.hotdata_query_result`, and `mo.ui.hotdata_connection_status`.
59
+
60
+ Use `hm.connection_status(client)` (or `mo.ui.hotdata_connection_status(client)`) for a small API/workspace health callout.
61
+
62
+ ## Marimo SQL Cells
63
+
64
+ Register the Hotdata SQL engine once during setup, then pass a `HotdataClient` to Marimo SQL cells:
65
+
66
+ ```python
67
+ import hotdata_marimo as hm
68
+
69
+ hm.register_hotdata_sql_engine()
70
+ client = hm.from_env()
71
+ ```
72
+
73
+ ```python
74
+ _df = mo.sql(
75
+ """
76
+ SELECT 1 AS example_value
77
+ """,
78
+ engine=client,
79
+ )
80
+ ```
81
+
82
+ The engine also exposes Hotdata catalog metadata to Marimo's data-source UI. Hotdata connections are labeled **Hotdata** in the SQL connection picker.
83
+
84
+ ## Two-cell pattern
85
+
86
+ Keep the editor in one cell and consume `editor.result` in another. The editor caches the last successful run so downstream cells do not re-query the API on every refresh; click **Run on Hotdata** again after you change SQL. While a query is running, a Marimo status spinner is shown.
87
+
88
+ Marimo only shows **what you `return` from a cell**. Calling `mo.vstack(...)` or `hm.query_result(...)` without returning it produces no visible output.
89
+
90
+ See `examples/demo.py` for a full runnable notebook flow.
91
+
92
+ ## Examples
93
+
94
+ - `examples/demo.py` — tabbed explorer with workspace selection, connection health, recent results (selectable table), run history, and a native `mo.sql` cell.
95
+
96
+ Run locally (single-user machine):
97
+
98
+ ```bash
99
+ uv run marimo edit examples/demo.py --no-token
100
+ ```
101
+
102
+ On a **shared or networked host**, omit `--no-token` and use the access token printed in the terminal URL. Without it, anyone who can reach the Marimo port can run queries against your Hotdata workspace.
103
+
104
+ ## Layout
105
+
106
+ This repo is intentionally thin: **API client, env helpers, and result models** live in **hotdata-runtime**; **hotdata-marimo** only adds Marimo widgets (`sql_editor`, `table_browser`, `display` for tables/status/history, `workspace_selector`). Import `HotdataClient` / `QueryResult` / `from_env` from **`hotdata_marimo`** or directly from **`hotdata_runtime`**.
107
+
108
+ ## Development
109
+
110
+ This package depends on [**hotdata-runtime**](https://github.com/hotdata-dev/hotdata-runtime) (PyPI name `hotdata-runtime`). Development uses **uv**; keep a sibling checkout at `../hotdata-runtime` so the lockfile resolves the runtime from disk (see `[tool.uv.sources]` in `pyproject.toml`).
111
+
112
+ ```bash
113
+ uv sync --locked
114
+ uv run pytest
115
+ marimo edit examples/demo.py --no-token
116
+ ```
117
+
118
+ To pin **hotdata-runtime** from Git instead of the sibling path, remove the `[tool.uv.sources]` block, set the dependency line as needed, and run `uv lock` again.
119
+
120
+ For a **publishable** `uv.lock` (CI that only clones this repo), remove `[tool.uv.sources]`, point `hotdata-runtime` at PyPI or `git+https://…`, then `uv lock`.
121
+
122
+ The **`[project] name`** in [hotdata-runtime](https://github.com/hotdata-dev/hotdata-runtime) `pyproject.toml` is **`hotdata-runtime`** and the import package is **`hotdata_runtime`**.
123
+
124
+ Use **`--no-token`** for local development so the editor does not redirect to `/auth/login` (session auth is easy to hit with a global Marimo config). For a public or shared machine, omit it and use the printed URL with an access token instead.
@@ -0,0 +1,10 @@
1
+ hotdata_marimo/__init__.py,sha256=cnq5DzMM2xYTkzwzC07tPkA_S8Zzjg2HoohRHP6EP1E,2617
2
+ hotdata_marimo/_options.py,sha256=hHyj0tiJ4SuKoyqfr2DjlEVSNbBBFmuxdAs9uVvYiSw,2617
3
+ hotdata_marimo/display.py,sha256=9rnXTmuYphqlEpy_XBFFfYQuYNYgzFMyDCjJS56CFyQ,6086
4
+ hotdata_marimo/sql_editor.py,sha256=wHZQh1Ia3bLwLFGl8QoOfoI8A8wspNgdvo6JMJclQcU,6455
5
+ hotdata_marimo/sql_engine.py,sha256=JEr7GtvQAuC85c3JchsF-03scYc-Ep7L2RisZISPBCE,12166
6
+ hotdata_marimo/table_browser.py,sha256=s8l2QFat9dQGocORKqQIy0hxEgYZqvhi8zPwP8m5LIg,7334
7
+ hotdata_marimo/workspace_selector.py,sha256=83dR4ABttQ64fAPmfDIsTmNEB375TS8SWhtgEolTu_c,2665
8
+ hotdata_marimo-0.1.0.dist-info/METADATA,sha256=nLUOgcZqA5SkedgAXhkmkwfV87YwMWeSTIzreKYljG4,5685
9
+ hotdata_marimo-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
10
+ hotdata_marimo-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any