Build live notebook-backed presentations from Python functions.
Project description
cast
Present from a notebook with two decorators.
import cast, polars as pl, plotly.express as px
cast.serve(port=8000) # live page in a background thread
@cast.data # function returns a polars LazyFrame
def sales():
return pl.scan_parquet("sales.parquet")
@cast.figure # a factory: takes one table, returns a Plotly figure
def trend(tbl: pl.LazyFrame):
df = tbl.select(["date", "value"]).collect()
return px.line(df, x="date", y="value")
sales() # register the table (data is injected from the browser)
@cast.figure registers a factory at decoration time — you don't pass a
table in the notebook. Open the printed URL and use the controls to add the
figure to the inventory with a chosen table. The same factory can be added many
times with different data, and each instance has its own table dropdown; picking
a table re-runs your figure function on the server against it. Calling a
@cast.data function again updates its data and the page refreshes live.
See examples/demo.py for a runnable showcase.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cast_func-0.1.0.tar.gz.
File metadata
- Download URL: cast_func-0.1.0.tar.gz
- Upload date:
- Size: 29.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.14.0 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05f11ed542dc81332ba07cb601887ab0035d8ed01753ef3f59b8ac0902980b8f
|
|
| MD5 |
4495df1d41a4b66253c2260cbd0c3141
|
|
| BLAKE2b-256 |
3f9a5e2b7b19f437e43cc38e0d622f7af8d1a4794fe756a363528455d9bfc436
|
File details
Details for the file cast_func-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cast_func-0.1.0-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.14.0 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
277ece1ff64ad9a2e639d1c4aa617a7253899061f03de375e6dc25fc2e630d06
|
|
| MD5 |
b56dfd076603089674cfaf6acdac5dd4
|
|
| BLAKE2b-256 |
35d0d01e52e9463a7a166892a87b9823e4bfb8c3c07ae479fe0058fa2b9febd6
|