tour
notebooks/tour.py
jellycell tour
Exercises the core jc.* API without external deps. Run with
jellycell run notebooks/tour.py, then jellycell export tearsheet notebooks/tour.py to drop a curated summary into manuscripts/.
1. Config — a kind=setup cell
Setup cells surface their source in the tearsheet so parameters are obvious at a glance.
USERS = 120 SESSIONS = 450 CONVERSIONS = 38
2. Load — simulate reading project inputs
Real projects would read from data/; we keep this demo dep-free by
constructing a literal.
raw = {"users": USERS, "sessions": SESSIONS, "conversions": CONVERSIONS} print(f"loaded {len(raw)} metrics")
loaded 3 metrics
3. Transform with an explicit dep
raw
ok
5 ms
conversion_rate = raw["conversions"] / raw["sessions"] print(f"conversion rate: {conversion_rate:.2%}")
conversion rate: 8.44%
4. Persist a JSON summary via jc.save
The tearsheet auto-renders the saved JSON as a key/value table.
rate
ok
6 ms
import jellycell.api as jc summary = { "total_users": raw["users"], "total_sessions": raw["sessions"], "conversion_rate": round(conversion_rate, 4), "conversions": raw["conversions"], } jc.save(summary, "artifacts/summary.json")
PosixPath('/Users/blaise/Desktop/blaise-oss/jellycell/examples/demo/artifacts/summary.json')
artifacts
summary.json
99 B
5. Round-trip via jc.load
jc.load registers an implicit dep edge on the producing cell
(name=summary). Edit the summary cell → this cell's cache invalidates
automatically, no hand-written deps= needed.
reloaded = jc.load("artifacts/summary.json") assert reloaded == summary print(f"reloaded {len(reloaded)} keys: {sorted(reloaded)}")
reloaded 4 keys: ['conversion_rate', 'conversions', 'total_sessions', 'total_users']
6. Derived metric — exercises cache invalidation
Change CONVERSIONS in the setup cell and only the downstream
subgraph (rate → summary → this cell) re-runs.
summary
ok
5 ms
headline = f"{raw['conversions']} of {raw['sessions']} sessions converted" jc.save({"headline": headline}, "artifacts/headline.json") print(headline)
38 of 450 sessions converted
artifacts
headline.json
48 B