Skip to content

Python Jupyter Helper

ChiefVenzox edited this page Jun 5, 2026 · 1 revision

Python Jupyter Helper

NotebookFlowKit includes a small Python helper for authoring flows in Python or Jupyter notebooks.

The helper is located at:

Python/notebook_flow.py

Basic Usage

from notebook_flow import NotebookFlow

flow = NotebookFlow("StarterFlow")
flow.text(
    "welcome",
    title="Welcome",
    subtitle="Let's personalize your app",
    next="goal",
)
flow.choice(
    "goal",
    title="What is your goal?",
    options=["Focus", "Fitness", "Learning"],
    next="name",
)
flow.input(
    "name",
    title="What should we call you?",
    next="done",
)
flow.completion(
    "done",
    title="You're ready",
    subtitle="Your setup is complete",
)
flow.export("starter_flow.json")

Method Reference

text

flow.text(id, title, subtitle=None, next=None)

choice

flow.choice(id, title, options, subtitle=None, next=None, required=True)

multi_choice

flow.multi_choice(id, title, options, subtitle=None, next=None, required=True)

input

flow.input(id, title, subtitle=None, placeholder=None, next=None, required=True)

completion

flow.completion(id, title, subtitle=None)

export

flow.export("starter_flow.json")

Conditional Routing

Pass a Python dictionary as next to create answer-based routing.

flow.choice(
    "goal",
    title="What is your goal?",
    options=["Focus", "Fitness", "Learning"],
    next={
        "Fitness": "fitness_setup",
        "Learning": "learning_setup",
        "default": "focus_setup",
    },
)

Jupyter Workflow

A typical notebook workflow:

  1. Define flow screens in notebook cells.
  2. Export JSON with flow.export(...).
  3. Add the exported JSON file to your app bundle.
  4. Render the flow in SwiftUI with NotebookFlowView.

Clone this wiki locally