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.

  • 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 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.1.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.1.0
File Size Uploaded Provenance Actions
ol_notebook-0.1.0.tar.gz 7.4 kB With provenance Details for ol_notebook-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.1 kB

Release files / ol_notebook-0.1.0.tar.gz

Download URL ol_notebook-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4d49f3e33afe2aaf641222c990f01f1ccfb3afb7973e660467de194ddc63e5e7
BLAKE2b-256 checksum
How to use checksums
ed063a507c0db3c47b38d3498677a724c5d6c085a0b462f845a6c8a894f2568e
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 Nov 24, 2026.

Transparency log

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

Download URL ol_notebook-0.1.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2359dff71b19cecc64f147f768da63cbfbe20516f08c7f7aa589c5125dfab48e
BLAKE2b-256 checksum
How to use checksums
fd6fe3b7dc0af8e8800b924558c1268c71f4c3102ef351b818de9ceca87cf37f
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 Nov 24, 2026.

Transparency log

Security for ol-notebook 0.1.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.1.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 Nov 24, 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.1.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