Skip to main content

ol-notebook

Helpers for marimo notebooks in the data platform JupyterHub (images/marimo-jupyterlab) and for notebooks published with marimo-operator (images/marimo-runtime). Both images carry this package's wheel and serve it to uv as an index (image-uv.toml), so a notebook gets it by naming it in its header:

# /// script
# dependencies = ["marimo", "ol-notebook", "polars"]
# ///

Querying StarRocks as the viewer

@app.cell
def _():
    from ol_notebook import warehouse

    engine = warehouse.engine()
    return (engine,)


@app.cell
def _(engine, mo):
    mo.sql("SELECT current_user(), current_role()", engine=engine)

engine() logs in to StarRocks with the current user's Keycloak token on every connection, so queries run under that person's StarRocks roles, and different viewers of one published app can see different data. A top-level engine also fills marimo's data sources panel with the warehouse catalogs.

Where the token comes from:

  • Published app: the X-Access-Token header APISIX forwards after the viewer logs in, read from mo.app_meta().request. Code that marimo runs outside a page load or UI interaction (anywidget, mo.ui.chat and table callbacks) has no request, so it raises WarehouseAccessError; query from a cell instead.

  • JupyterHub single-user server: the ID token the hub keeps from your hub login, read from the hub API with the server's JUPYTERHUB_API_TOKEN on every connection. The hub API URL has to be HTTPS, since the reply holds your refresh token; anything else raises WarehouseAccessError before the token is sent. The hub refreshes it before it expires, so there is no login step in the notebook. If the hub's Keycloak session has ended, engine() raises WarehouseAccessError and asks you to sign in to JupyterHub again. A server started before the hub could read your tokens gets none back, and the error asks you to stop it from the JupyterHub control panel (/hub/home) and start it again.

  • Anywhere else: bin/starrocks-auth sets STARROCKS_USER, STARROCKS_HOST and STARROCKS_ID_TOKEN_FILE. --output exec keeps the port-forward open and the token file fresh while the command runs, and the forward ends at 127.0.0.1, which the certificate doesn't name. From the repository root:

    STARROCKS_TLS_VERIFY_IDENTITY=false \
        bin/starrocks-auth --env qa --port-forward --output exec -- \
        uv run --no-project --with ./packages/ol-notebook python my_script.py
    

Configuration, all from the environment:

Variable Meaning
STARROCKS_HOST FE host. Required. TLS is checked against this name, so it must be one the FE certificate covers.
STARROCKS_PORT FE MySQL port, default 9030.
STARROCKS_TLS_VERIFY_IDENTITY false skips the host name check, for a port-forward to 127.0.0.1. The chain is still verified.
STARROCKS_ID_TOKEN_FILE, STARROCKS_USER Log in with this token file instead of the hub's token or the request header.

StarRocks checks the token only at login, and engine() opens a new connection for each query, so keep queries inside the cell that runs them rather than holding a connection open across cells.

Metadata

Release files for ol-notebook 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ol-notebook 0.2.0
File Size Uploaded Provenance Actions
ol_notebook-0.2.0.tar.gz 9.3 kB With provenance Details for ol_notebook-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ol-notebook 0.2.0
File Interpreter ABI Platform Actions
ol_notebook-0.2.0-py3-none-any.whl Python 3 none any Details for ol_notebook-0.2.0-py3-none-any.whl

Total release size: 17.4 kB

Release files / ol_notebook-0.2.0.tar.gz

Download URL ol_notebook-0.2.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
675fdfed6d77eaa71e4dda65889b39c9bcd6985e5f6f9a40201050b33b83f1ca
BLAKE2b-256 checksum
How to use checksums
5d90e9ae22abedc7938da8b05f48f12cdb0568f8e6c826735c6c9784c1f57f47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / ol_notebook-0.2.0-py3-none-any.whl

Download URL ol_notebook-0.2.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7844ba9684b7afe39496ca6d074b07c71db872866e531bb408c806e6f0398baf
BLAKE2b-256 checksum
How to use checksums
1a5ff52422efc96bc8787725e1dea401fed1c64771474e45088282b42c1f3959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for ol-notebook 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ol_notebook-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page