Skip to content

export

panel_flowdash.export

Exporting a dashboard's report as HTML, PDF, Word, Markdown or a Jupyter notebook.

An export is a snapshot: :func:build_document reads the report a dashboard reads as (its own, or the one derived from its groups and tiles) into an :class:ExportDocument of plain blocks, with the outputs as they are now, and a writer turns that into a file. Questions of the report not answered yet are never run for an export.

The HTML and Markdown writers need nothing more; charts need vl-convert-python, Word python-docx and notebooks nbformat (pip install 'panel-flowdash[export]'), and PDF WeasyPrint (the pdf extra) or Playwright with Chromium. A missing package raises :class:ExportUnavailable naming it.

A component exports itself by defining __export__(ctx), which returns a block, a list of blocks or None to be read from its view; ctx is an :class:ExportContext with helpers for charts and tables.

Block = Heading | Text | KPI | Chart | Table | Image | Code | Placeholder | Section module-attribute

EXPORT_HOOK = '__export__' module-attribute

FORMATS = {f.name: f for f in (ExportFormat('html', 'Web page (HTML)', 'html', 'text/html'), ExportFormat('pdf', 'PDF', 'pdf', 'application/pdf'), ExportFormat('docx', 'Word', 'docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'), ExportFormat('md', 'Markdown', 'md', 'text/markdown'), ExportFormat('ipynb', 'Jupyter notebook', 'ipynb', 'application/x-ipynb+json'))} module-attribute

MAX_ROWS = 50 module-attribute

__all__ = ['EXPORT_HOOK', 'FORMATS', 'KPI', 'MAX_ROWS', 'Block', 'Chart', 'Code', 'ExportContext', 'ExportDocument', 'ExportFile', 'ExportFormat', 'ExportUnavailable', 'Heading', 'Image', 'Placeholder', 'Provenance', 'Section', 'Table', 'Text', 'build_document', 'cell_text', 'check_format', 'dashboard_yaml', 'export_filename', 'export_report', 'export_report_async', 'load_dashboard', 'render_chart', 'show_node', 'table_block', 'wait_for_outputs', 'write'] module-attribute

Chart dataclass

A chart as an image: SVG markup, PNG bytes or both.

caption = '' class-attribute instance-attribute

node = None class-attribute instance-attribute

png = None class-attribute instance-attribute

svg = None class-attribute instance-attribute

title = '' class-attribute instance-attribute

Code dataclass

Source code, e.g. a node's SQL, shown verbatim.

language = '' class-attribute instance-attribute

node = None class-attribute instance-attribute

source instance-attribute

title = '' class-attribute instance-attribute

ExportContext dataclass

What a component's __export__(ctx) is told about the export being built.

Attributes:

Name Type Description
format str | None

The format the document will be written as ("html", "pdf", "docx", "md", "ipynb"), or None when not known.

max_rows int

How many rows of a table to include.

node str | None

The name of the node being exported.

format = None class-attribute instance-attribute

max_rows = MAX_ROWS class-attribute instance-attribute

node = None class-attribute instance-attribute

warnings = field(default_factory=list) class-attribute instance-attribute

chart(spec, title='', caption='')

Return a Vega or Vega-Lite spec as a :class:Chart, or a Placeholder if it cannot be drawn.

table(frame, caption='')

Return the first :attr:max_rows rows of a DataFrame as a :class:Table.

ExportDocument dataclass

A report as plain data: its title, provenance and blocks, which every writer reads.

blocks = field(default_factory=list) class-attribute instance-attribute

provenance instance-attribute

title instance-attribute

to_dict()

Return the document as JSON-serializable data, bytes as base64 and each block with its type.

walk()

Yield every block, those in sections included, in document order.

ExportFile dataclass

An exported file: its bytes, the name to save it under and its media type.

data instance-attribute

document instance-attribute

filename instance-attribute

mime instance-attribute

ExportFormat dataclass

A format a report exports to: its label, file extension and media type.

extension instance-attribute

label instance-attribute

mime instance-attribute

name instance-attribute

ExportUnavailable

Bases: RuntimeError

An export format needs a package that is not installed; the message says which.

FlowDash

Bases: Viewer

A dataflow wiring canvas and dashboard layout editor over a set of components.

The editor pairs a ReactFlow canvas, where components are placed and their typed ports wired together, with a tile grid that lays the same components out as a dashboard. Everything to do with routing, pages and identity lives in :class:~panel_flowdash.app.FlowDashApp instead, so this can be embedded anywhere.

Parameters:

Name Type Description Default
components

The components to offer. Accepts a decorated function, a Viewer subclass, a mapping of explicit component ids, a project directory to scan, or a list mixing any of those. See :func:~panel_flowdash.component_library.normalize_components.

None
settings_class

A subclass of :class:~panel_flowdash.settings.DashboardSettings adding dashboard-wide parameters of your own, persisted with each dashboard.

required

Examples:

>>> editor = FlowDash(components=[ticker_select, price_chart])
>>> src = editor.add_component("Components/ticker_select")
>>> dst = editor.add_component("Components/price_chart")
>>> editor.connect(src, "ticker", dst, "ticker")
True

agent_state = param.ClassSelector(class_=RunState, default=None, allow_None=True, doc='\n The panel-agents ``RunState`` holding the agent\'s runs, which\n "How was this made?" shows. None uses the edit history\'s, which an\n assistant shares when history is on.') class-attribute instance-attribute

ask = param.Boolean(default=False, doc="\n Whether Ask is open. In view mode it docks the Explore view's feed\n left of the dashboard or the report, resizable by its right edge;\n on a phone, which has no room for it, Ask is the Explore view\n itself. In edit mode it is the host's assistant, see `assistant`.\n Edit mode starts with Ask as view mode left it, and view mode gets\n back the Ask it had as edit mode ends, whatever happened to the\n assistant meanwhile; `set_ask_aside` closes it for something taking\n its place in view mode without changing what view mode gets back.") class-attribute instance-attribute

ask_docked property

Whether Ask is docked left of the dashboard or the report: open, in view mode, on a wide screen.

assistant = param.Boolean(default=False, doc="\n Whether a host docks an assistant beside the editor that Ask opens in\n edit mode, as FlowDashApp does with its agent's drawer. Without one,\n Ask is offered in view mode only.") class-attribute instance-attribute

authorize_admin = param.Callable(default=None, doc='\n Called with a keyword ``fresh`` to decide whether this session\n administers the project. Node actions registered as ``admin_only``\n (see :mod:`panel_flowdash.node_actions`) are offered while it says so\n with ``fresh=False``, which should be cheap as menus ask it on every\n edit, and run only if it says so with ``fresh=True``, which should\n check again, e.g. with the project file read afresh. `FlowDashApp`\n supplies one. None makes no one an admin.') class-attribute instance-attribute

authorize_component = param.Callable(default=None, doc="\n Called with a component's `RegistryEntry` to decide whether this\n session may use it. Components it refuses are left out of the palette\n and `add_component` raises `PermissionError` for them; a loaded\n dashboard shows them as locked placeholders that are never created\n and are saved back unchanged. `FlowDashApp`\n supplies one that evaluates each component's ``allow_*``/``deny_*``\n rules and ``authorize`` callback against the signed-in user. None\n allows every component.") class-attribute instance-attribute

authorize_dashboard = param.Callable(default=None, doc='\n Called with the stored `AssetModel` and the access it needs,\n ``"view"`` or ``"edit"``, to decide whether this session may still\n read or overwrite it. `save` asks for ``"edit"`` against the\n dashboard\'s current sharing rules, so edit rights revoked from another\n session take effect without reloading; reloading and discarding\n changes ask for ``"view"``. `FlowDashApp` supplies one that checks the\n signed-in user. None allows both.') class-attribute instance-attribute

authorize_rename = param.Callable(default=None, doc="\n Called with the stored `AssetModel` to decide whether this session\n may rename it, as an administrator of the dashboard. `set_title` asks\n before renaming and `save` before storing a new title. `FlowDashApp`\n supplies one that checks the signed-in user. None lets only the\n dashboard's owner, the editor's `user`, rename it.") class-attribute instance-attribute

breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.') class-attribute instance-attribute

can_redo property

Whether :meth:redo has an undone edit to redo.

can_undo property

Whether :meth:undo has an edit to undo.

code_drafts = param.Boolean(default=False, doc='\n Whether the code panel holds edits that have not been run. Managed by\n the editor; like ``dirty``, watch it to prompt before discarding work.') class-attribute instance-attribute

code_panel property

The :class:~panel_flowdash.ui.code_panel.CodePanel docked under the canvas, made on first use.

code_panel_node = param.String(default=None, allow_None=True, constant=True, doc='The id of the node the code panel under the canvas shows, or None while it is closed.') class-attribute instance-attribute

code_panel_open property

Whether the code panel shows a node, under the canvas or in the sidecar's Spec tab.

component_specs property

Specs for the available components, keyed by component id.

components = param.Parameter(default=None, doc='\n The components to offer in the editor. A decorated function, a Viewer\n subclass, a mapping of explicit component ids, a project directory, or a\n list mixing any of those. Read at construction time.') class-attribute instance-attribute

context = copy_context(self.context) class-attribute instance-attribute

controls_bar = param.Boolean(default=True, doc='\n Whether to show the views of components registered with\n ``sidebar=True`` beside the tiles (see `controls_position`), while\n the dashboard is viewed or laid out. Turn it off to render the\n `sidebar` views in a layout of your own instead. In full screen the\n editor shows them either way, since nothing around it is visible, so\n leave them out of your layout while `fullscreen` is on.') class-attribute instance-attribute

controls_position = param.Selector(default='top', objects=['top', 'left'], doc='\n Default of the ``controls_position`` dashboard setting for dashboards\n that do not store one: where the views of components registered with\n ``sidebar=True`` go. "top" puts them in one slim row above the tiles,\n which suits the few filters most dashboards have; "left" stacks them\n in a collapsible panel left of the tiles, which suits many controls.') class-attribute instance-attribute

dashboard = param.ClassSelector(class_=AssetModel, default=None, doc='\n The dashboard currently loaded. Updated by `load`, `load_model`,\n `new_dashboard` and `save`. May be passed at construction as either a\n AssetModel or, when a store is configured, a dashboard id or title.') class-attribute instance-attribute

dirty = param.Boolean(default=False, doc='\n Whether the canvas has unsaved changes. Managed by the editor; watch it\n to prompt before discarding work.') class-attribute instance-attribute

edit_history property

The versions of the open dashboard, one per edit; see :mod:panel_flowdash.history.

Its state is the panel-agents RunState they are published in, to show them in an ArtifactView or share with an AgentRunner.

editable = param.Boolean(default=True, doc='\n Whether the dashboard can be edited. When False the side panel is hidden\n and the tile grid is shown locked, giving a pure view of the dashboard.') class-attribute instance-attribute

edited = param.Event(doc='Triggered after each edit is recorded in its turn.') class-attribute instance-attribute

explore = param.Boolean(default=False, doc="\n Whether the Explore view is shown in place of the workspace: the same\n as ``surface == 'explore'``. Setting it to False returns to the\n workspace. Ask (`ask`) docks the same feed beside it instead.") class-attribute instance-attribute

explore_feed property

The :class:~panel_flowdash.explore.ExploreFeed the Explore view shows, made on first use.

feed_shown property

Whether the Explore view's feed is on screen, docked in Ask or as the Explore view.

filters property

The dashboard's global filters as a copy, the views they exclude by instance id.

See :mod:panel_flowdash.global_filters.

fullscreen = param.Boolean(default=False, doc="\n Whether the dashboard is presented on its own: the tiles and the\n controls bar fill the screen, without the dashboard bar or the page\n around the editor, and a small overlay shows the title, the health and\n an exit button while the pointer moves. Turning it on from a click\n also puts the editor into the browser's full screen; otherwise, e.g.\n when set at load time, the editor covers the browser window. Leaving\n the browser's full screen turns it off. Only available in view mode:\n switching to edit mode turns it off.") class-attribute instance-attribute

graph property

The live dataflow graph wiring the placed components together.

groups property

The groups on the canvas by id, as copies, nodes by instance id.

See :mod:panel_flowdash.groups.

header_layout = param.Selector(default='compact', objects=['compact', 'full'], doc='\n Default of the ``header_layout`` dashboard setting for dashboards that\n do not store one: how the dashboard bar is laid out. "compact" keeps\n it to one line, which a FlowDashApp with the default navigation folds\n into its top bar; "full" gives it a row of its own with a large title\n over the description, the health chip and when the dashboard was last\n refreshed.') class-attribute instance-attribute

history = param.Boolean(default=True, doc="\n Whether every edit becomes a version of the dashboard's edit history,\n which `undo` and `redo` move through and the store keeps across\n sessions (see `history_limit`). Read at each edit.") class-attribute instance-attribute

history_coalesce = param.Number(default=BURST_SECONDS, bounds=(0, None), doc="\n Seconds without an edit that end a batch of the person's edits in\n the edit history, so a burst of edits, such as a drag, typing into\n a config field or a few quick changes, is one version. An edit of the\n agent, a save, undo and redo end a batch too, and each request to the\n agent is one version. Zero records each of the person's edits on its own.") class-attribute instance-attribute

history_limit = param.Integer(default=500, bounds=(1, None), allow_None=True, doc="\n The most versions a dashboard's stored history keeps; older ones are\n dropped. None keeps them all.") class-attribute instance-attribute

history_max_bytes = param.Integer(default=HISTORY_MAX_BYTES, bounds=(0, None), allow_None=True, doc="\n About how many bytes of dashboard YAML a dashboard's stored history\n keeps; the oldest versions are dropped past it, the latest is always\n kept. None keeps versions however large they are.") class-attribute instance-attribute

history_max_days = param.Number(default=90, bounds=(0, None), allow_None=True, doc="\n How many days the store keeps a version of a dashboard's history.\n None keeps versions however old they are.") class-attribute instance-attribute

import_unknown_components = param.Boolean(default=True, doc='\n Whether importing a file may add or change items whose component this\n editor does not offer. They are imported as they are, shown as\n unavailable and saved back unchanged, so a dashboard keeps them until\n the component is offered again. Set it to False when users are\n restricted by giving each a smaller set of components rather than\n through `authorize_component`: a component one user lacks may be one\n another has, so such an item is then treated like a restricted one,\n keeping its stored config and wiring or being left out of the import.\n `authorize_component` is the better mechanism, since it also shows a\n known but denied component as restricted rather than unavailable.') class-attribute instance-attribute

include_builtin_components = param.Boolean(default=True, doc='Include Select, MultiChoice and Slider in the component palette.') class-attribute instance-attribute

include_page_dialog = param.Boolean(default=True, doc="\n Whether the editor lays out the session's page dialog, the one\n `open_dialog` and `confirm` use. Set it to False when the surrounding\n page already places `page_dialog()` itself, as `FlowDashApp` does; the\n dialog must appear in only one layout. Read when the workspace is built,\n so it needs a served session to take effect.") class-attribute instance-attribute

inspect_outputs = param.Boolean(default=False, doc="\n Whether each tile in the dashboard grid gets an Inspect action that\n opens a side sheet with the current value of every output the\n component publishes. The action is shown in the dashboard view and in\n preview, not while arranging tiles. It reveals outputs the tile itself\n may not display, so while the editor is ``read_only`` (in a\n ``FlowDashApp``, for anyone who may not edit the dashboard) it is only\n shown if the dashboard's ``viewers_can_inspect`` setting allows it. A\n component can add its own explanation per output by defining\n ``__flowdash_inspect__(self, port)``.") class-attribute instance-attribute

is_chat property

Whether the loaded asset is a chat, which shows its own bar in place of the dashboard bar.

is_report property

Whether the loaded asset is a standalone report, which has no tile grid.

layout property

The current tile layout, whether or not the grid is on screen.

One entry per tile, keyed by the tile's instance_id.

mode = param.Selector(default='wiring', objects=['wiring', 'dashboard', 'split'], doc="\n Which workspace is shown: 'wiring' for the ReactFlow canvas, 'dashboard'\n for the tile grid and 'split' for both side by side, with the canvas\n on the left. Only meaningful while `editable`.") class-attribute instance-attribute

node_previews = param.Boolean(default=False, doc='\n Default of the ``node_previews`` dashboard setting for dashboards that\n do not store one: whether each card on the wiring canvas previews its\n current value below its ports, e.g. the first rows of a table or a\n sparkline of a series, rather than summarizing it in one line.') class-attribute instance-attribute

notifications = param.Boolean(default=True, doc='\n Whether to surface user-facing messages as Panel notifications. When\n disabled (or when no notification area exists) messages are logged.') class-attribute instance-attribute

parameters property

The parameters of the open dashboard by name, as copies, nodes by instance id.

Parameters on nodes the user may not use are left out. See :mod:panel_flowdash.parameters.

popup_hover_delay = param.Integer(default=500, bounds=(0, None), doc='Delay in milliseconds before a hover value preview opens.') class-attribute instance-attribute

popup_trigger = param.ObjectSelector(default='click', objects=['click', 'hover', 'none'], doc='\n Whether live port values open on click, hover, or not automatically.\n On hover the popups cover the nodes the pointer passes over, so they\n open on click by default.') class-attribute instance-attribute

preview = param.Boolean(default=False, doc="\n Lock the tile grid as an end user sees it without leaving edit mode.\n Only meaningful while `editable` and in 'dashboard' mode. The\n dashboard bar offers no control for it, since view mode is the preview.") class-attribute instance-attribute

project = param.ClassSelector(class_=Project, default=None, allow_None=True, doc='\n The project file the app reads, which node actions get to save a\n section of it with ``Project.set``. `FlowDashApp` supplies its own.') class-attribute instance-attribute

propagate_failures = param.Boolean(default=False, doc='\n Carry a failing output or edge transform downstream instead of leaving\n the connected inputs on their last value. An input declared in\n `handles_failures` receives the failure as a `param.ReactiveError`; the\n tile of a component with any other failed input is covered by a message\n naming the failure, and its outputs pass the failure on. Read at\n construction time.') class-attribute instance-attribute

provenance = param.Boolean(default=True, doc='\n Whether a node an agent\'s request created offers "How was this\n made?", in its tile\'s More menu and in the inspector, opening a side\n sheet with that request: its question, model calls, tool calls and\n the versions it published, from the run the node\'s origin turn\n names. People who may not edit the dashboard see the request\'s\n shape without its content.') class-attribute instance-attribute

provenance_labels = param.Boolean(default=False, doc='\n Whether the views of nodes that report their provenance (see\n :mod:`panel_flowdash.node_actions`), e.g. "Metric: capacity" or "Ad\n hoc", show it as a chip in view mode too. While the dashboard is\n edited the chip is always shown, and so is a warning (a provenance\n whose level is "warning", e.g. that a row limit cut the numbers).') class-attribute instance-attribute

read_only = param.Boolean(default=False, doc='\n Whether saving is forbidden. The canvas can still be rearranged but\n `save` refuses. Set this from your own authorization logic.') class-attribute instance-attribute

refresh = param.Event(doc='\n Triggered every ``settings.refresh_period`` seconds while a dashboard is\n shown, and whenever the user clicks the refresh button. Components that\n show live data subscribe to it, see `current_dashboard`.') class-attribute instance-attribute

refuse_placement = param.Callable(default=None, doc='\n Called with a component id to ask whether this session may add new\n instances of it: None if it may, else why not, e.g. ``"turned off by\n an admin"``. A refused component is left out of the palette, the\n command palette and the agent\'s components, and `add_component`\n raises `PermissionError` for it. Unlike `authorize_component`, it\n leaves the instances a dashboard already places alone, and they keep\n working; editors are told once when a dashboard they edit has some.\n `FlowDashApp` supplies one from the project file\'s ``components``\n section.') class-attribute instance-attribute

report property

The dashboard's report as a copy, nodes by instance id, or None if it has none.

Blocks referring to nodes, groups or turns the dashboard no longer has are left out. A dashboard without a report reads as the one :func:~panel_flowdash.report.report_blocks derives from its layout. See :mod:panel_flowdash.report.

report_view property

The :class:~panel_flowdash.ui.report_view.ReportView the Report view shows, made on first use.

retitled = param.Event(doc="Triggered when the open dashboard's title changes in the editor, e.g. by set_title or undo.") class-attribute instance-attribute

run_pending = param.Callable(default=None, allow_None=True, doc="\n Called with the id of a pending turn when an editor runs its question\n from the report, e.g. to ask the assistant, which then answers it\n through :meth:`answer_pending`. None, the default without an agent,\n leaves the report's Run buttons disabled.") class-attribute instance-attribute

running_pending = param.List(default=[], item_type=str, doc='\n The ids of the pending turns whose question is being run, from the\n click on Run until the request answering it ends. Their Run buttons\n show that they are running and cannot be pressed again.') class-attribute instance-attribute

saved = param.Event(doc='Triggered after a dashboard is successfully saved.') class-attribute instance-attribute

settings = param.ClassSelector(class_=DashboardSettings, constant=True, doc="\n The dashboard-wide settings, an instance of `settings_class`. Filled\n from the loaded dashboard and written back on save. Edited in edit mode\n through the dashboard bar's Settings form.") class-attribute instance-attribute

settings_class = param.ClassSelector(class_=DashboardSettings, default=DashboardSettings, is_instance=False, doc='\n The class of `settings`. Subclass `DashboardSettings` to add your own\n dashboard-wide parameters. Read at construction time.') class-attribute instance-attribute

show_in_editor = param.Callable(default=None, allow_None=True, doc="\n Called with a tile's instance id when someone viewing the dashboard\n asks to see that component in the editor, from the tile's More menu or\n its failure message. The action is offered in view mode while this is\n set and `read_only` is False; the caller decides what showing a\n component in the editor means, e.g. switching to edit mode.") class-attribute instance-attribute

sidebar = Children(default=[], doc='\n Views of placed components that declare `sidebar=True`, which are kept\n out of the tile grid. Managed by the editor; render these wherever your\n layout wants them.') class-attribute instance-attribute

store = param.ClassSelector(class_=BaseAssetStore, default=None, doc='\n Dashboard persistence backend. Accepts a store instance or a path to a\n SQLite file. When None the editor is ephemeral and `save` merely returns\n the model for the caller to persist.') class-attribute instance-attribute

surface = param.Selector(default='workspace', objects=list(SURFACES), doc="\n What the editor shows, in view and in edit mode: 'workspace' for the\n canvas or the tile grid (as `mode` and `editable` say), 'explore' for\n the Explore view, the dashboard's turns as a feed with the outputs\n each made (see :mod:`panel_flowdash.explore`), or 'report' for the\n Report view, the dashboard read as a document (see\n :mod:`panel_flowdash.report`). The views of the tiles move between\n them, so only one is ever on screen.") class-attribute instance-attribute

tile_cards = param.Boolean(default=True, doc='\n Default of the ``tile_cards`` dashboard setting for dashboards that do\n not store one: whether tiles are drawn as framed cards. Each dashboard\n can change it in its settings.') class-attribute instance-attribute

tile_titles = param.Boolean(default=False, doc="\n Default of the ``tile_titles`` dashboard setting for dashboards that do\n not store one: whether a tile's card shows its title.") class-attribute instance-attribute

toolbar = param.Boolean(default=True, doc='\n Whether to render the dashboard bar above the workspace. In view mode\n it holds the title, Refresh and the View/Edit control; in edit mode\n the Dataflow/Layout tabs and the Settings, Discard, Save and Done\n actions. The component palette is shown regardless.') class-attribute instance-attribute

toolbar_extra = Children(default=[], doc="\n Additional items placed in the dashboard bar's actions, before the\n View/Edit control in view mode and after Settings in edit mode.") class-attribute instance-attribute

turns property

The turns of the open dashboard, oldest first, as copies.

A turn is one request to the agent, or one batch of the person's edits made between requests; each node records the turn that created it as its origin. The editor opens a turn at the first edit that needs one: an edit made in an agent's tool call joins the turn of that agent run, any other edit the person's open turn. See :mod:panel_flowdash.turns.

user = param.String(default='local', doc='Principal recorded as the owner of dashboards created here.') class-attribute instance-attribute

value_repr = param.Callable(default=None, allow_None=True, doc='Optional callable converting a live port value to a Panel viewable or displayable value.') class-attribute instance-attribute

add_component(component_id, config=None, position=None, instance_id=None, *, arrange=False)

Place a component on the canvas and return its instance id.

Parameters:

Name Type Description Default
component_id str

Id of a registered component.

required
config dict | None

Design-time configuration overrides for this instance.

None
position dict | tuple | None

Canvas position as {"x": ..., "y": ...} or (x, y). Defaults to a free spot near the top-left of the visible canvas.

None
instance_id str | None

Id for the new instance, which is also its node's name in the dashboard YAML, as a node a YAML file names gets it. It must be a valid node name without __, at most MAX_NAME_LENGTH (64) characters, that no node on the canvas has. Defaults to a generated <component>_<6 hex> id.

None
arrange bool

Without a position, place the node by its dataflow, beside the nodes it is connected to, and move it again as it is connected until someone moves it by hand, and lay its tile out with the tiles of its kind (see :mod:panel_flowdash.auto_layout). The agent's add_node does this.

False

Returns:

Type Description
str

The new instance's id, for use with connect and remove_component.

Raises:

Type Description
KeyError

If component_id is not a registered component.

ValueError

If instance_id is not a valid node name or is taken.

PermissionError

If authorize_component or refuse_placement refuses it.

answer_pending(turn_id, run_id=None)

Make the pending turn turn_id the turn of the agent request run_id's next edits.

The request's edits so far stay in its own turn. Its next edit runs the pending turn: the turn records the request, and the nodes the request creates get it as their origin, so the question's block in the report shows them as its answer. Without an edit the turn stays pending. The turn is returned.

Raises:

Type Description
ValueError

If no pending turn has the id turn_id.

arrange_canvas()

Lay out every node on the canvas by its dataflow, as one edit.

Sources go on the left and views on the right, in columns by their depth in the dataflow, ordered to reduce crossing edges. Positions set by hand are replaced too; that is what the request is for.

arrange_layout(order=None, style='grid', sizes=None)

Lay out every visible tile by its kind, as one edit.

Controls go first, then KPIs, both at their default width, charts in two columns, tables at full width and the tiles of data sources and transforms last; text tiles stay in front of the tile they preceded. Hidden tiles stay hidden. Layouts made for narrower breakpoint bands are dropped, so those bands follow the arranged layout again.

Parameters:

Name Type Description Default
order Sequence[str] | None

Instance ids of tiles to put first, in this order within their kind; the other tiles follow in their current order.

None
style str

"grid" lays the tiles out by kind as above, "stack" puts them one to a row at full width in their order.

'grid'
sizes Mapping[str, Mapping[str, float]] | None

The width and height of tiles sized on purpose, by instance id, which they keep; the other tiles of their rows make room for them.

None

ask_in_report(question, index=None)

Add a question to the report, not run yet, before the block at index (last for None).

The question becomes a pending turn and a turn block showing it, in one undoable edit, and its id is returned. A dashboard without a report of its own gets the derived one first.

Raises:

Type Description
ValueError

If question is empty or index is not a place in the report.

bind_parameters(values, *, timeout=None)

Write values into their parameters' fields, as one edit, after checking them.

Each value is read as its parameter's type, so text such as "10" for a number parameter is accepted. Before anything changes, the contract of each parameter's component checks the value against what the parameter recorded, the node's config takes the value, and the component's config check (register(check_config=...)) passes the result. Values that change nothing record no edit. Returns the warnings of the contracts.

Raises:

Type Description
ParameterError

If a name is not a parameter the user can see, a value is not of its type or not one the field takes, or a config check refuses it; nothing is changed.

ContractError

If a contract refuses a value; nothing is changed. Its problems name the nodes that would fail.

check_parameters(values)

Return what the contracts find wrong with binding values, without binding them.

Includes warnings, see :class:~panel_flowdash.parameters.ContractProblem.

Raises:

Type Description
ParameterError

If a name is not a parameter or a value is not of its type.

clear()

Remove every component and edge from the canvas.

close_code_panel()

Close the code panel, holding a draft it shows until the field is opened again.

collapse_group(group_id, collapsed=True)

Draw a group as one node with its ports, or expand it again, as one edit.

Expanding pushes the nodes to its right and below aside by the room the expanded group needs, and collapsing moves back the nodes it pushed that have not been moved since.

connect(source_id, source_port, target_id, target_port, transform=None, *, adjust_target=False)

Wire an output port to an input port.

Parameters:

Name Type Description Default
transform list[dict[str, Any]] | None

Steps applied to the values carried along the edge, see :meth:set_edge_transform.

None
adjust_target bool

Let the target component adjust its config to the new edge through its on_connect method (see :class:~panel_flowdash.Upstream), in the same edit. Off for edges that restore an earlier state, such as a load or an undo.

False

Returns:

Type Description
bool or str

True on success, or a message explaining the rejection (unknown port, type mismatch, cycle, an input that is already connected, or an invalid transform). An input fed by a component this session may not use counts as connected.

customize_report()

Make the report derived from the dashboard its own, to be edited, and return whether it did.

The derived blocks are written into the report as one undoable edit; the title stays the dashboard's until it is changed. A dashboard that already has a report keeps it.

declare_parameter(name, node, field, type='value', description=None)

Declare a parameter on a config field of a node, or redeclare one, and return it.

The parameter's expects is computed by the contract of the node's component, if it has one (register(contract=...)).

Parameters:

Name Type Description Default
name str

The parameter's name.

required
node str

The instance id of the node.

required
field str

The config field, or a dotted path into one, e.g. spec.tables.orders.

required
type str

One of :data:~panel_flowdash.parameters.PARAMETER_TYPES.

'value'
description str | None

What the parameter is, for whoever binds it.

None

Raises:

Type Description
ParameterError

If the name, field or type is malformed, the node does not exist, is one the user may not use, or the field is not one of its component's config fields, or the name is taken by a parameter the user may not see.

delete_group(group_id)

Remove a group and its nodes from the dashboard; returns the removed instance ids.

disconnect(source_id, source_port, target_id, target_port)

Remove the edge between two ports.

disconnect_input(instance_id, port)

Remove every edge into the input port of instance_id, as one edit.

dispose()

Tear down the editor, disposing every placed component.

Empties the dataflow graph, the canvas and the tile grid, then calls the dispose hook of each component that was placed, once. The editor is left empty and consistent, so it can still be used afterwards.

An editor created inside a server session disposes its components automatically when that session ends. In a notebook, under pyodide or for an editor created outside a session, call this yourself.

drop_code_drafts()

Forget the edits the code panel holds without running them, e.g. when leaving the dashboard.

edit_spec(instance_id, field=None)

Open the spec of the node instance_id in the code panel, showing the canvas if needed.

Where the browser keeps the panel in the sidecar, or the window is too narrow for it under the canvas, the sidecar's Spec tab shows it in the tab already open. Returns False to viewers.

end_agent_turns(run_id=None)

End the turns of the agent's requests, so the next request's edits start a new turn.

The dashboard tools call it when a request ends, whether it finished, failed or was cancelled. Each request's edits then become one version of the edit history. With run_id only that request's turn ends, so another agent's request running at the same time keeps its own.

end_ask_aside()

Let view mode keep Ask as it shows now, once what set_ask_aside made room for is gone.

E.g. the host's assistant closed in view mode without editing: Ask stays off, and edit mode ending later does not bring it back.

end_turn()

End the turn of the person's edits, so their next edit starts a new turn.

Call it when the person sends a request to an agent, which the FlowDash assistant does, so the edits made before and after the request form separate turns.

ensure_components_loaded(component_ids=None)

Import component modules and build their specs, if not done already.

Called automatically whenever specs are needed. On a live server prefer :meth:ensure_components_loaded_async, which imports off the event loop.

Parameters:

Name Type Description Default
component_ids Iterable[str] | None

Import only these components. Defaults to the whole catalog, which is what the editor palette needs; viewing a dashboard passes just the components it places, so an unrelated component doing work at import time cannot slow it down.

None

ensure_components_loaded_async(component_ids=None) async

Async :meth:ensure_components_loaded, importing off the event loop.

If the awaiting task is cancelled (e.g. by a newer navigation) the imports already running finish in their thread, but nothing is marked loaded and their import errors are not reported; the next call retries whatever is still unimported and reports its errors then.

exclude_from_filter(column, instance_id, excluded=True)

Opt the view instance_id out of the global filter on column, or back in.

expand_group(group_id)

Expand a collapsed group, see :meth:collapse_group.

export_dashboard(*, questions=True)

Return the canvas as a JSON-serializable dict, as the Download button writes it.

The dashboard id, owner and sharing rules are omitted, so the file can be loaded into any dashboard with :meth:import_dashboard. With questions False its turns leave out what was asked of the agent, see :func:export_model.

group_nodes(instance_ids, label=None, *, group_id=None, collapsed=False)

Frame nodes together on the canvas as one group, as one edit, and return its id.

The nodes keep their place, config, connections and tiles. A group can be collapsed into one node showing the ports its connections cross, see :meth:collapse_group.

Raises:

Type Description
ValueError

If there are no nodes, a node is not on the canvas or already in a group, or group_id is taken or not a valid name.

group_of(instance_id)

Return the id of the group a node is in, or None.

import_dashboard(data, *, keep_turns=False)

Replace the canvas with an exported dashboard, as dropping its file does.

data is a downloaded dashboard file, as JSON text or a dict, or a dashboard in the YAML format (see :mod:panel_flowdash.agent). The loaded dashboard keeps its id, owner, title and sharing rules, so saving writes the imported contents to it. Without a loaded dashboard the file's title is used and saving creates a new one. The canvas is marked dirty.

The import is an edit of its own, in the turn of whoever makes it (see :attr:turns). By default the file's turns and node origins replace the canvas's, and nodes the file gives no origin get the import's turn. With keep_turns the file's turns and origins are ignored instead: the canvas keeps its turns, nodes already on it keep their origin and new nodes get the import's turn. That is how the agent's changes are loaded, so it cannot rewrite who made what. Nodes are matched by name: a node given another component under the same name keeps its origin, and a renamed node is a new node with the import's turn as its origin. A file that changes nothing opens no turn.

Raises:

Type Description
ValueError

If data is neither a dashboard export nor a dashboard in the YAML format.

input_values(instance_id)

Return the literal values set on the unconnected inputs of a placed node, by port.

A connected input's literal is listed too; it applies once the connection is removed.

is_admin(*, fresh=False)

Whether this session administers the project, as :attr:authorize_admin says.

With fresh the host checks again from its sources, e.g. the project file read afresh, as before an admin action runs.

keep_tile_placement(instance_id)

Keep the tile of the node instance_id where it is when the agent's request ends.

While a request runs, tiles it adds are laid out only when it ends (all at once). A host that places the tile itself during the request calls this, so the layout at the end does not move it again.

later_turns(instance_id)

Return copies of the turns after a node's origin whose summary says they changed it.

load(asset_id)

Load a dashboard from the configured store, by id or title.

load_model(model)

Hydrate the canvas from an :class:AssetModel.

Items and edges that cannot be restored, such as a component this editor does not offer or an edge whose port no longer exists, do not abort the load. They are shown as placeholders and saved back unchanged.

Only the components the model places are imported, so a component that does work at import time cannot slow down dashboards that do not use it. On a live server prefer :meth:load_model_async, which imports off the event loop.

load_model_async(model) async

Async :meth:load_model, importing the model's components off the event loop.

made_by_agent(instance_id)

Whether "How was this made?" applies: an agent's request created the node.

may_rename()

Whether this session may rename the open dashboard, see :attr:authorize_rename.

A dashboard that is not stored yet may always be renamed.

new_dashboard(title)

Start a new empty dashboard, persisting it if a store is configured.

node_actions(instance_id, *, admin=None)

Return the registered node actions offered for a node to the person using the editor.

A restricted node or a placeholder gets none, nor does an action outside the editor's mode (see NodeAction.modes); an admin_only action needs :meth:is_admin, and an action whose applies fails is left out. admin says whether the session is an admin, which :meth:is_admin is asked otherwise.

node_component(instance_id)

Return the live component of the node instance_id, or None.

None for a function component, which has no instance, and for an id that is not on the canvas. The reverse of :meth:node_id.

node_id(component)

Return the id of the node component was created for, or None if it is not one of this editor's.

Only components that are Viewer classes are known by instance; a function component can call :func:current_node_id from its body.

node_inputs(instance_id, port=None)

Return the edges into the node instance_id, or only those into its input port.

Each is a dict with the source node's instance id, its source_port, the target (instance_id), the target_port and the edge's transform steps, in the order they were connected. Changing the dicts changes nothing on the canvas.

node_name(instance_id)

Return the name the node instance_id has in the dashboard YAML, e.g. "sales_chart".

node_names()

Return the YAML names of the canvas's nodes, by instance id.

They are worked out again only when the nodes change.

node_origin(instance_id)

Return the id of the turn that created a node, or None if no turn is recorded.

node_provenance(instance_id)

Return the provenance a node's numbers have, and the id of the node that reports it.

That is the node's own __flowdash_provenance__ or else the nearest upstream node's, following its inputs breadth first, each hook told the edges between it and this node (via), see :mod:panel_flowdash.node_actions. None when no node reports one.

note_own_run(run_id)

Record that the person using this editor asked for run run_id, so it is never redacted for them.

open_code_panel(instance_id, field=None, *, focus=True)

Edit the spec field field of the node instance_id in the code panel.

field defaults to the node's first spec field, a code field or a spec dict; a node without one shows its result only. The panel opens under the canvas where it was last docked there and fits, otherwise in the sidecar's Spec tab, which then shows the node. Returns False, leaving the panel as it was, where it cannot be shown: to viewers, or for a node or field it cannot edit. Callers then fall back to the field's own editor.

open_spec_in_sidecar(instance_id)

Move the code panel into the sidecar's Spec tab, remembered for the browser, showing instance_id.

origin_turn(instance_id)

Return a copy of the turn that created a node, or None if no turn is recorded.

parameters_schema()

Return the JSON Schema of a form binding the parameters, each defaulting to its field's value.

See :func:~panel_flowdash.parameters.parameters_schema.

provenance_warning(instance_id)

Return the nearest warning about a node's numbers, which tiles, reports and exports show.

Unlike :meth:node_provenance it looks past nearer provenance that is no warning, e.g. a capped analysis read through a node labelled "Derived": a label says what the nearest source is, a warning holds for everything computed from the numbers it is about. The walk stops :data:_PROVENANCE_DEPTH (64) edges up, so a warning further up than that is not found.

redo()

Redo what the last :meth:undo undid, all of it, and return whether anything was redone.

Redo is available until the next edit.

Raises:

Type Description
PermissionError

As for :meth:undo.

refresh_provenance(nodes=None)

Offer anew the node actions and provenance labels of every node, or of nodes and those downstream.

After an edit the editor does this itself for the nodes the edit may have changed. Call it when what a __flowdash_provenance__ hook or an action's applies reads changes outside the dashboard, e.g. a metric a project file defines being deleted. nodes are names as in the dashboard YAML, or instance ids.

remove_component(instance_id)

Remove a placed component along with its edges and its tile.

remove_parameter(name)

Remove a parameter; the node keeps the value its field holds.

Returns whether it existed; a parameter the user may not see counts as missing.

rename_group(group_id, label)

Change the label a group's header shows, as one edit.

report_shows(instance_id)

Whether a block of the report shows node instance_id, itself or with its group.

run_node_action(instance_id, key)

Run the node action key on a node, checking again that it is offered to this session.

An admin_only action asks :attr:authorize_admin afresh first.

Raises:

Type Description
PermissionError

If the action is not offered for the node, e.g. outside its modes or an admin_only action for someone who is no admin (any more).

run_redacted(run_id)

Whether a request is shown to the person viewing without its content.

Their own requests are always shown in full. Anyone else's are redacted for people who may not edit the dashboard, and when the request created or changed a node whose component this person may not use.

save(title=None)

Persist the current canvas and return the saved model.

With no store configured the model is still built and returned, so the caller can persist it themselves.

The owner, sharing rules and (unless title is given) title are taken from the stored dashboard rather than from the copy loaded into the editor, so saving never reverts a rename or sharing change made from another session since the dashboard was opened. If the dashboard is no longer stored (deleted from another session, or loaded from elsewhere), saving creates it with this editor's :attr:user as the owner, so it is never recreated under the previous owner's name.

Raises:

Type Description
RuntimeError

If :attr:read_only is set, or :attr:authorize_dashboard no longer grants edit access to the stored dashboard (which also sets :attr:read_only).

AssetConflictError

If the store holds a newer revision of the dashboard than the one loaded into the editor, because another session saved it since. Nothing is written; reload the dashboard or use :meth:save_as.

save_as(title)

Persist the current canvas as a new dashboard titled title and switch to it.

The new dashboard is owned by this editor's :attr:user and not shared with anyone. With no store configured the model is still built and returned.

Raises:

Type Description
RuntimeError

If :attr:read_only is set.

set_ask_aside()

Close Ask in view mode for something taking its place, such as the host's assistant.

View mode still gets Ask back as edit mode ends, e.g. after the assistant's first edit, as it does after Ask is closed in edit mode.

set_default(instance_id, config)

Give the node instance_id config values its component chose as a starting point.

A component calls it for a node :func:placement_context reports as "new", from its __init__ or function body, or later, e.g. once an input arrives. The values are saved with the dashboard like any config, and are part of the edit that brought them about: the placement, or the connection that delivered the input, so one undo takes back both. Values set outside any edit, e.g. by an input that arrives on its own, are recorded right away as a config edit of their own, so undoing a later edit keeps them. Called from a thread other than the session's event loop, they are set and recorded on the loop, as an edit of their own, and before a save.

Only fields still at their declared default take a value, so a node that arrives configured, e.g. one the agent adds or a duplicate, keeps its config. Returns whether any field took one: False, changing nothing, also while a dashboard is loaded or a version restored, to viewers and in a preview, and for a node or a config field the node does not have.

set_edge_transform(source_id, source_port, target_id, target_port, transform)

Replace the transform applied along an edge.

Each step is a dict naming an op from :data:panel_flowdash.transforms.TRANSFORMS plus its arguments, for example [{"op": "column", "column": "capacity"}, {"op": "aggregate", "how": "sum"}]. Pass an empty list to remove the transform.

Returns:

Type Description
bool or str

True on success, or a message explaining the rejection. A rejected transform leaves the edge on its previous one.

set_filter_value(column, value)

Change what the global filter on column keeps for whoever is viewing, without an edit.

value is a list of values for a select filter, [start, end] for a range, or None to keep every row.

set_filters(filters, *, label=None)

Replace the dashboard's global filters, views they exclude by instance id, as one undoable edit.

Raises:

Type Description
ValueError

If filters are malformed or exclude a node the dashboard does not have.

set_input_value(instance_id, port, value)

Give an input of a placed node a literal value, used while nothing is connected to it.

A connection always wins over the literal, which applies again once the connection is removed. None removes the literal, and the input goes back to its default. The change is recorded in the edit history.

Raises:

Type Description
KeyError

If no component is placed under instance_id.

ValueError

If the component has no such input, the input cannot hold a literal, e.g. a DataFrame, or it refuses value.

set_input_values(instance_id, values)

Set or remove (with None) the literal values of several inputs, as one edit.

Every value is checked before any is set, so a refused one changes nothing; see :meth:set_input_value.

set_report(report, *, label=None, coalesce=True)

Replace the dashboard's report, nodes by instance id, as one undoable edit.

None removes it, so the dashboard reads as its derived report again. label describes the edit in the history and the turn's summary, "Changed the report" by default, or a list of labels for an edit making several changes. A pending turn the report no longer refers to goes with its block, as it was only ever asked in the report. With coalesce False the edit is a version of its own, never batched with the quick edits before or after it, as for a structural change such as moving a block.

When the agent makes the edit, each block it adds or changes gets its turn as origin, and the blocks it leaves as they were keep theirs, whatever report gives.

Raises:

Type Description
ValueError

If report is malformed or refers to a node, group or turn the dashboard does not have.

set_title(title)

Rename the open dashboard as an edit: undoable, and stored when the dashboard is saved.

Raises:

Type Description
PermissionError

If the dashboard is read-only or this session may not rename it.

show_ask()

Bring the Explore view's feed on screen: Ask docked in view mode, the Explore view otherwise.

show_how_made(instance_id, turn_id=None)

Show the agent request that created a node, or the later turn turn_id that changed it.

It shows the request's span (question, model calls, tool calls and published versions) while :attr:agent_state holds the run's steps, and what the turn records otherwise, followed by the turns that changed the node later. In edit mode it opens the sidecar's History tab for the node; in view mode it opens the side sheet. Requests are redacted as :meth:run_redacted decides, and when the node's component is one the person may not use.

show_in_report(instance_id, label=None)

Append a block showing node instance_id to the report, unless a block shows it.

This is how a standalone report shows what is added to it, as a dashboard places a tile. Returns whether a block was added.

title_renamed(title)

Note that the open dashboard was renamed to title in the store, e.g. by the Rename action.

Undo then keeps that name rather than bringing back the old one.

to_model(title=None)

Serialize the current canvas into an :class:AssetModel.

The returned model is detached from the editor, so this is the seam to use when persisting to something other than the configured store.

toggle_palette()

Fold the component palette beside the canvas, or open it and focus its search field.

toggle_split()

Show the canvas and the tile grid side by side, or return to the previous tab.

trigger_refresh()

Trigger refresh with every change it causes delivered as one propagation pass.

A node fed by two sources that both run again then runs once, with both new values, instead of once per source.

undo(*, whole_runs=True)

Undo the last edit to the dashboard and return whether anything was undone.

A person's edits are undone one at a time, a gesture such as a drag as one edit. The edits an agent made for one request are undone together, back to the dashboard as it was before the request, unless whole_runs is False. Undo reaches back into earlier sessions, as far as the store keeps the dashboard's history (see :attr:history_limit).

Undoing restores the dashboard's turns and node origins as they were, and never brings back a node whose component the user may not use or that this editor does not offer.

Raises:

Type Description
PermissionError

If undoing would bring back such a node; nothing changes.

ungroup(group_id)

Remove a group's frame, keeping its nodes where they are, as one edit.

Returns the instance ids of the nodes that were in it.

Heading dataclass

A heading, level 1 to 3 below the document's title.

level = 1 class-attribute instance-attribute

text instance-attribute

Image dataclass

An image, embedded as bytes of a mime type, or linked by an http(s) url.

alt = '' class-attribute instance-attribute

caption = '' class-attribute instance-attribute

data = None class-attribute instance-attribute

mime = 'image/png' class-attribute instance-attribute

node = None class-attribute instance-attribute

url = None class-attribute instance-attribute

KPI dataclass

A headline number: its label, the value as text and a muted line after it.

detail = '' class-attribute instance-attribute

label instance-attribute

node = None class-attribute instance-attribute

value instance-attribute

Placeholder dataclass

Something the export leaves out, and why: a restricted node or a question not answered yet.

node = None class-attribute instance-attribute

reason instance-attribute

title = '' class-attribute instance-attribute

Provenance dataclass

Where an export came from: the dashboard, when, and the values it was computed with.

Attributes:

Name Type Description
dashboard str

The dashboard's title.

generated_at datetime

When the export was built, in UTC.

generator str

The package and version that built it, e.g. panel-flowdash 0.1.0.

parameters list[tuple[str, str]]

(name, value) of the dashboard's parameters, values as text.

filters list[tuple[str, str]]

(label, value) of the controls and global filters applied, values as text.

dashboard instance-attribute

filters = field(default_factory=list) class-attribute instance-attribute

generated_at instance-attribute

generated_text property

The generation time as a reader sees it, e.g. 2026-11-22 10:30 UTC.

generator = '' class-attribute instance-attribute

parameters = field(default_factory=list) class-attribute instance-attribute

Section dataclass

A titled run of blocks: a heading of the report and what follows it, a group or a question.

blocks = field(default_factory=list) class-attribute instance-attribute

level = 1 class-attribute instance-attribute

page_break_before = False class-attribute instance-attribute

title instance-attribute

Table dataclass

The first rows of a table as text, and how many rows it has in all.

caption = '' class-attribute instance-attribute

columns instance-attribute

node = None class-attribute instance-attribute

rows instance-attribute

total_rows instance-attribute

Text dataclass

Prose as Markdown, raw HTML shown as text.

markdown instance-attribute

node = None class-attribute instance-attribute

build_document(editor, format=None, *, include_pending=False, max_rows=MAX_ROWS)

Return the report editor's dashboard reads as, as an :class:ExportDocument, as it is now.

Parameters:

Name Type Description Default
editor FlowDash

The editor whose dashboard is exported, with the rights of its user.

required
format str | None

The format the document is for, so charts are drawn only as the image type it needs; None draws both.

None
include_pending bool

Whether questions not answered yet are written, as "Not answered yet"; they are never run for an export.

False
max_rows int

How many rows of each table to include.

MAX_ROWS

cell_text(value, years=None)

Return a table cell as text: plain data formatted, any other object named by its type.

Numbers get thousands separators, except years: whole numbers from 1000 to 2999, or all numbers of a column years says holds years.

check_format(format)

Return the :class:ExportFormat called format, raising ValueError for an unknown one.

dashboard_yaml(editor)

Return the dashboard as its YAML file, as Download writes it, credentials in it masked.

None for someone who may only view the dashboard, who cannot download it either. The questions asked are left out when any of them is hidden from the user, see :meth:~panel_flowdash.FlowDash.run_redacted.

export_filename(title, format)

Return the file name an export of a report titled title is saved under.

export_report(editor, format='html', *, include_pending=False, max_rows=MAX_ROWS)

Export the report of editor's dashboard as it is now, with its user's rights.

Nodes the user may not use are left out, with a note in their place. Use :func:export_report_async in a server, which first waits for outputs that are still computing.

Parameters:

Name Type Description Default
editor FlowDash

The editor whose open dashboard is exported.

required
format str

One of :data:FORMATS: "html", "pdf", "docx", "md" or "ipynb".

'html'
include_pending bool

Whether questions not answered yet are written as "Not answered yet", rather than left out. They are never run.

False
max_rows int

How many rows of each table to include.

MAX_ROWS

Raises:

Type Description
ExportUnavailable

If the format needs a package that is not installed.

export_report_async(editor, format='html', *, include_pending=False, max_rows=MAX_ROWS, timeout=15.0) async

Wait up to timeout seconds for the outputs to settle, then :func:export_report.

The document is built on the event loop, which owns the session's objects; the file is written on a worker thread.

load_dashboard(text, **params)

Return a :class:~panel_flowdash.FlowDash holding the dashboard of a YAML or JSON file's text.

params are passed to FlowDash, e.g. components= naming the components the dashboard uses. An exported notebook starts with it.

render_chart(spec, format=None, title='', caption='')

Draw a Vega or Vega-Lite spec with vl-convert: as SVG for HTML and PDF, as PNG otherwise.

A spec loading data from a URL is not drawn, since an export fetches nothing.

show_node(editor, name)

Return the view of the node called name, as its tile shows it.

table_block(value, max_rows=MAX_ROWS, caption='')

Return a DataFrame's first max_rows rows as a :class:Table, or a Placeholder if it is none.

wait_for_outputs(editor, timeout=15.0, quiet=0.3) async

Wait until the outputs an export reads stop changing for quiet seconds, at most timeout.

Returns whether they settled. Outputs computed asynchronously, e.g. a query, arrive on the event loop, so this yields to it while waiting.

write(document, format, *, dashboard=None)

Write document as format; dashboard is the dashboard's YAML a notebook loads.

write_html(document)

Return document as one self-contained HTML page, with a print stylesheet.

write_markdown(document)

Return document as Markdown.

build

Building an :class:ExportDocument from the report a dashboard reads as.

The builder reads :func:~panel_flowdash.report.report_blocks, so a dashboard without a report of its own exports the one derived from its groups and tiles. Each node is asked for its blocks in this order:

  1. a node the user may not use becomes a :class:Placeholder, and nothing of it is read;
  2. a block shown as a table, and a data node, gives its first output as a :class:Table;
  3. the component's __export__(ctx) method, when it has one, returns a block, a list of blocks, or None to fall back to the next step;
  4. the panes of the node's view, as its tile shows them, are read by type: Vega and Vega-Lite charts become images through vl-convert, tables their first rows, Markdown, HTML and text their text, images their bytes; anything else becomes a :class:Placeholder.

Values are written out only as plain data (text, numbers, dates); any other object is named by its type, so a value holding a credential never shows it.

CHART_FONT = 'Arial, Helvetica, sans-serif' module-attribute

CHART_HEIGHT = 320 module-attribute

CHART_WIDTH = 640 module-attribute

EMPTY_TEXT = 'This output has nothing to show yet.' module-attribute

EXPORT_HOOK = '__export__' module-attribute

FAILED_TEXT = 'This output failed to compute, so it is not included.' module-attribute

INTERACTIVE_TEXT = '{kind}, interactive only, not included in this export.' module-attribute

LABEL_LIMIT = 160 module-attribute

MAX_CELL = 500 module-attribute

MAX_ROWS = 50 module-attribute

MISSING_TEXT = "This item's component is not available, so it is not included." module-attribute

NO_CHARTS_TEXT = "A chart is left out: rendering charts needs vl-convert-python (pip install 'panel-flowdash[export]')." module-attribute

NO_MATPLOTLIB_TEXT = 'A chart is left out: drawing a HoloViews chart for an export needs matplotlib (pip install matplotlib).' module-attribute

PENDING_TEXT = 'Not answered yet.' module-attribute

REMOTE_DATA_TEXT = 'A chart that loads data or images from a URL is left out: exports fetch no URLs.' module-attribute

RESTRICTED_TEXT = 'You do not have access to this item, so it is not included.' module-attribute

UNDRAWN_TEXT = 'This chart could not be drawn, so it is not included.' module-attribute

logger = logging.getLogger('panel_flowdash') module-attribute

ExportContext dataclass

What a component's __export__(ctx) is told about the export being built.

Attributes:

Name Type Description
format str | None

The format the document will be written as ("html", "pdf", "docx", "md", "ipynb"), or None when not known.

max_rows int

How many rows of a table to include.

node str | None

The name of the node being exported.

format = None class-attribute instance-attribute
max_rows = MAX_ROWS class-attribute instance-attribute
node = None class-attribute instance-attribute
warnings = field(default_factory=list) class-attribute instance-attribute
chart(spec, title='', caption='')

Return a Vega or Vega-Lite spec as a :class:Chart, or a Placeholder if it cannot be drawn.

table(frame, caption='')

Return the first :attr:max_rows rows of a DataFrame as a :class:Table.

ExportUnavailable

Bases: RuntimeError

An export format needs a package that is not installed; the message says which.

build_document(editor, format=None, *, include_pending=False, max_rows=MAX_ROWS)

Return the report editor's dashboard reads as, as an :class:ExportDocument, as it is now.

Parameters:

Name Type Description Default
editor FlowDash

The editor whose dashboard is exported, with the rights of its user.

required
format str | None

The format the document is for, so charts are drawn only as the image type it needs; None draws both.

None
include_pending bool

Whether questions not answered yet are written, as "Not answered yet"; they are never run for an export.

False
max_rows int

How many rows of each table to include.

MAX_ROWS

cell_text(value, years=None)

Return a table cell as text: plain data formatted, any other object named by its type.

Numbers get thousands separators, except years: whole numbers from 1000 to 2999, or all numbers of a column years says holds years.

clean_markdown(markdown)

Return Markdown the app escaped for its own panes as plain Markdown, a dollar sign escaped by a backslash.

data_url_image(url, alt='', node=None)

Return a base64 image data URL as an :class:Image, an http(s) URL as a linked one, else None.

markdown_text(text, line_start=True)

Escape plain text so Markdown shows it as written, without raw HTML.

line_start False leaves the start of a line as it is, for text that cannot start a block, such as a table cell.

render_chart(spec, format=None, title='', caption='')

Draw a Vega or Vega-Lite spec with vl-convert: as SVG for HTML and PDF, as PNG otherwise.

A spec loading data from a URL is not drawn, since an export fetches nothing.

strip_control(text)

Return text without the control characters a Word or XML file cannot hold.

table_block(value, max_rows=MAX_ROWS, caption='')

Return a DataFrame's first max_rows rows as a :class:Table, or a Placeholder if it is none.

wait_for_outputs(editor, timeout=15.0, quiet=0.3) async

Wait until the outputs an export reads stop changing for quiet seconds, at most timeout.

Returns whether they settled. Outputs computed asynchronously, e.g. a query, arrive on the event loop, so this yields to it while waiting.

document

The content of an export: plain data built once from a report and handed to every writer.

BLOCK_TYPES = (Heading, Text, KPI, Chart, Table, Image, Code, Placeholder, Section) module-attribute

Block = Heading | Text | KPI | Chart | Table | Image | Code | Placeholder | Section module-attribute

Chart dataclass

A chart as an image: SVG markup, PNG bytes or both.

caption = '' class-attribute instance-attribute
node = None class-attribute instance-attribute
png = None class-attribute instance-attribute
svg = None class-attribute instance-attribute
title = '' class-attribute instance-attribute

Code dataclass

Source code, e.g. a node's SQL, shown verbatim.

language = '' class-attribute instance-attribute
node = None class-attribute instance-attribute
source instance-attribute
title = '' class-attribute instance-attribute

ExportDocument dataclass

A report as plain data: its title, provenance and blocks, which every writer reads.

blocks = field(default_factory=list) class-attribute instance-attribute
provenance instance-attribute
title instance-attribute
to_dict()

Return the document as JSON-serializable data, bytes as base64 and each block with its type.

walk()

Yield every block, those in sections included, in document order.

Heading dataclass

A heading, level 1 to 3 below the document's title.

level = 1 class-attribute instance-attribute
text instance-attribute

Image dataclass

An image, embedded as bytes of a mime type, or linked by an http(s) url.

alt = '' class-attribute instance-attribute
caption = '' class-attribute instance-attribute
data = None class-attribute instance-attribute
mime = 'image/png' class-attribute instance-attribute
node = None class-attribute instance-attribute
url = None class-attribute instance-attribute

KPI dataclass

A headline number: its label, the value as text and a muted line after it.

detail = '' class-attribute instance-attribute
label instance-attribute
node = None class-attribute instance-attribute
value instance-attribute

Placeholder dataclass

Something the export leaves out, and why: a restricted node or a question not answered yet.

node = None class-attribute instance-attribute
reason instance-attribute
title = '' class-attribute instance-attribute

Provenance dataclass

Where an export came from: the dashboard, when, and the values it was computed with.

Attributes:

Name Type Description
dashboard str

The dashboard's title.

generated_at datetime

When the export was built, in UTC.

generator str

The package and version that built it, e.g. panel-flowdash 0.1.0.

parameters list[tuple[str, str]]

(name, value) of the dashboard's parameters, values as text.

filters list[tuple[str, str]]

(label, value) of the controls and global filters applied, values as text.

dashboard instance-attribute
filters = field(default_factory=list) class-attribute instance-attribute
generated_at instance-attribute
generated_text property

The generation time as a reader sees it, e.g. 2026-11-22 10:30 UTC.

generator = '' class-attribute instance-attribute
parameters = field(default_factory=list) class-attribute instance-attribute

Section dataclass

A titled run of blocks: a heading of the report and what follows it, a group or a question.

blocks = field(default_factory=list) class-attribute instance-attribute
level = 1 class-attribute instance-attribute
page_break_before = False class-attribute instance-attribute
title instance-attribute

Table dataclass

The first rows of a table as text, and how many rows it has in all.

caption = '' class-attribute instance-attribute
columns instance-attribute
node = None class-attribute instance-attribute
rows instance-attribute
total_rows instance-attribute

Text dataclass

Prose as Markdown, raw HTML shown as text.

markdown instance-attribute
node = None class-attribute instance-attribute

docx

The Word writer, on python-docx: headings and Markdown as paragraphs, native tables, charts as PNG.

CHART_WIDTH = 6 module-attribute

MAX_ROWS = 50 module-attribute

add_markdown(doc, text, level=1)

Add Markdown as paragraphs: headings, bulleted and numbered lists, quotes and inline styles.

add_picture(doc, data, caption='')

Add a PNG or JPEG image :data:CHART_WIDTH inches wide; False if Word cannot read it.

add_runs(paragraph, text)

Add Markdown text to a paragraph, as runs: **bold**, *italic*, code and link text.

add_table(doc, block, max_rows=MAX_ROWS)

Add a :class:Table as a native Word table, its header and at most max_rows rows.

write_docx(document, max_rows=MAX_ROWS)

Return document as a Word file.

html

The static HTML writer: one self-contained file with a print stylesheet, which the PDF writer prints.

STYLESHEET = '\n:root {\n color-scheme: light;\n --fd-text: #1f2328;\n --fd-muted: #5f6670;\n --fd-rule: #d8dce1;\n --fd-panel: #f6f8fa;\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n background: #fff;\n color: var(--fd-text);\n font: 15px/1.6 Roboto, "Helvetica Neue", Arial, sans-serif;\n}\nmain {\n max-width: 860px;\n margin: 0 auto;\n padding: 48px 32px 64px;\n}\nh1, h2, h3, h4 { font-weight: 500; line-height: 1.25; margin: 1.6em 0 0.5em; }\nh1.fd-title { font-size: 2rem; font-weight: 400; margin-top: 0; }\nh2 { font-size: 1.45rem; }\nh3 { font-size: 1.2rem; }\nh4 { font-size: 1.05rem; }\np { margin: 0.6em 0; }\na { color: #0b62c4; }\n.fd-provenance {\n color: var(--fd-muted);\n font-size: 0.85rem;\n border-bottom: 1px solid var(--fd-rule);\n padding-bottom: 12px;\n margin-bottom: 24px;\n}\n.fd-provenance dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0 0; }\n.fd-provenance dt { font-weight: 500; }\n.fd-provenance dd { margin: 0; }\n.fd-block { margin: 18px 0; break-inside: avoid; }\nfigure { margin: 18px 0; break-inside: avoid; }\nfigure img { max-width: 100%; height: auto; display: block; }\nfigcaption, .fd-caption { color: var(--fd-muted); font-size: 0.85rem; margin-top: 6px; }\n.fd-kpis { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }\n.fd-kpi {\n flex: 1 1 160px;\n border: 1px solid var(--fd-rule);\n border-radius: 8px;\n padding: 12px 16px;\n break-inside: avoid;\n}\n.fd-kpi-label { color: var(--fd-muted); font-size: 0.85rem; }\n.fd-kpi-value { font-size: 1.8rem; line-height: 1.2; }\n.fd-kpi-detail { color: var(--fd-muted); font-size: 0.85rem; }\ntable { border-collapse: collapse; width: 100%; font-size: 0.85rem; }\nth, td { text-align: left; padding: 4px 10px; border-bottom: 1px solid var(--fd-rule); vertical-align: top; }\nth { font-weight: 500; border-bottom-width: 2px; }\n.fd-table { overflow-x: auto; }\npre { background: var(--fd-panel); padding: 12px; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; }\n.fd-placeholder {\n border: 1px dashed var(--fd-rule);\n border-radius: 8px;\n padding: 12px 16px;\n color: var(--fd-muted);\n}\n.fd-placeholder strong { color: var(--fd-text); font-weight: 500; }\n.fd-page-break { break-before: page; }\n@page { size: A4; margin: 18mm 16mm; }\n@media print {\n body { font-size: 11pt; }\n main { max-width: none; padding: 0; }\n a { color: inherit; text-decoration: none; }\n .fd-table { overflow: visible; }\n h2, h3, h4 { break-after: avoid; }\n}\n' module-attribute

markdown_html(text)

Render Markdown as HTML, raw HTML shown as text and unsafe link targets dropped.

provenance_html(document)

Return the provenance line and list under the title.

safe_url(url)

Return url when it is an http(s) URL or a base64 image data URL, else None.

write_html(document)

Return document as one self-contained HTML page, with a print stylesheet.

markdown

The Markdown writer: one file, images as data URLs, tables as pipe tables.

provenance_markdown(document)

Return the provenance as a short paragraph and list.

safe_markdown(text)

Return Markdown re-rendered from its tokens, as the HTML writer reads it.

Raw HTML comes out as text, links whose target the HTML writer refuses (javascript: and the like) as their text only, and images only from http(s) or image data URLs, so a viewer that renders HTML in Markdown, such as Jupyter, runs nothing a report's text holds.

safe_url(url)

Return url when it is an http(s) URL or a base64 image data URL, else None.

write_markdown(document)

Return document as Markdown.

notebook

The notebook writer: Markdown cells for prose, and code cells that load the dashboard and show a node.

Each node's cell keeps the output it had when exported, so the notebook reads without running; running it computes the nodes again from the dashboard embedded in its first code cell.

preamble(dashboard_yaml)

Return the first code cell: imports, and the dashboard loaded from its embedded YAML.

write_notebook(document, dashboard_yaml=None)

Return document as a Jupyter notebook (nbformat 4).

With dashboard_yaml, the dashboard file, the notebook loads it and each node's cell shows that node; without it the cells only hold the exported outputs, as Markdown.

pdf

The PDF writer: the HTML writer's page printed by WeasyPrint, or by Chromium through Playwright.

ENGINES = ('weasyprint', 'chromium') module-attribute

UNAVAILABLE = "PDF export needs WeasyPrint (pip install 'panel-flowdash[pdf]') or Playwright with Chromium (pip install playwright, then playwright install chromium)." module-attribute

available_engine()

Return the PDF engine that can run here, WeasyPrint first, or None.

write_pdf(document, engine=None)

Return document as a PDF, printed from its HTML with engine, by default the first available.