API Reference¶
panel_flowdash
¶
panel-flowdash: Dataflow and draggable grid based dashboard editor for Panel.
__all__ = ['AuthConfig', 'BaseDashboardStore', 'ComponentSpec', 'ConfigField', 'DashboardEdge', 'DashboardItem', 'DashboardModel', 'DashboardStore', 'DataflowGraph', 'FlowDash', 'Identity', 'InputPort', 'MemoryDashboardStore', 'OutputPort', 'PanelAppMetadata', 'Permission', 'RegistryEntry', '__version__', 'build_component_spec', 'build_component_specs', 'build_node_state_class', 'build_session_state_class', 'can_administer', 'check_requirements', 'is_authorized', 'normalize_components', 'panel_app', 'register', 'resolve_identity']
module-attribute
¶
__version__ = importlib.metadata.version(__name__)
module-attribute
¶
panel_app = register
module-attribute
¶
AuthConfig
dataclass
¶
Project-level authorization configuration.
Loaded from the project's __init__.py by the serve command. All fields
are optional; the defaults reproduce the pre-auth behavior (allow by
default, groups read from the standard claim keys, no admin groups).
admin_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
default_allow = True
class-attribute
instance-attribute
¶
group_claims = DEFAULT_GROUP_CLAIMS
class-attribute
instance-attribute
¶
resolve_groups = None
class-attribute
instance-attribute
¶
user_groups = field(default_factory=dict)
class-attribute
instance-attribute
¶
from_module(module)
classmethod
¶
Build an :class:AuthConfig from names on a project __init__.
Reads group_claims, user_groups, resolve_groups,
admin_groups and default_allow if present, falling back to the
defaults otherwise. Missing module or names yield a default config.
BaseDashboardStore
¶
Bases: ABC
The persistence interface the editor and app shell depend on.
Subclasses implement the six storage primitives below; the access-control and lookup helpers are backend-independent and inherited. Implement this to back dashboards with something other than SQLite.
can_administer(identity, dashboard_id, admin_groups=frozenset())
¶
Whether identity may administer (edit/delete/share) the dashboard.
create_dashboard(user_id, title)
¶
Create, persist and return a new empty dashboard.
delete_dashboard(user_id, dashboard_id)
abstractmethod
¶
Delete a dashboard owned by user_id. Returns whether one was removed.
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
get_owner(dashboard_id)
¶
Return the owner (user_id) of a dashboard, or None if missing.
list_accessible(identity, *, default_allow=True)
¶
List dashboards the identity owns or has been granted access to.
Owned dashboards sort first (both groups by recency), so a user's own dashboards stay visually grouped ahead of ones shared with them.
list_dashboards(user_id)
¶
Dashboards owned by user_id, most recently updated first.
load_dashboard(user_id, dashboard_id)
¶
Load a dashboard, but only if user_id owns it.
load_for_access(identity, dashboard_id, *, default_allow=True)
¶
Load a dashboard if identity is authorized, else None.
Returns None both when the dashboard does not exist and when access
is denied, so callers render a single "not found / denied" view.
rename_dashboard(user_id, dashboard_id, new_title)
abstractmethod
¶
Retitle a dashboard owned by user_id. Returns whether one was updated.
save_dashboard(dashboard)
abstractmethod
¶
Insert or update a dashboard.
set_permission(dashboard_id, permission)
abstractmethod
¶
Persist a new permission set on a dashboard. Returns success.
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
ComponentSpec
dataclass
¶
Full specification of a component's ports and metadata.
component_id
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_state_class = None
class-attribute
instance-attribute
¶
default_size
instance-attribute
¶
description
instance-attribute
¶
icon
instance-attribute
¶
inputs
instance-attribute
¶
outputs
instance-attribute
¶
tags
instance-attribute
¶
title
instance-attribute
¶
ConfigField
dataclass
¶
DashboardEdge
dataclass
¶
DashboardItem
dataclass
¶
A component instance on the dashboard.
x, y store the ReactFlow node canvas position. Grid layout (widths, heights, visibility) lives in DashboardModel.tile_layout.
DashboardModel
dataclass
¶
A persisted dashboard: nodes + edges + tile layout.
breakpoints = field(default_factory=list)
class-attribute
instance-attribute
¶
dashboard_id
instance-attribute
¶
edges = field(default_factory=list)
class-attribute
instance-attribute
¶
items = field(default_factory=list)
class-attribute
instance-attribute
¶
owner
property
¶
The immutable owner principal (the creating user).
permission = field(default_factory=Permission)
class-attribute
instance-attribute
¶
responsive_layouts = field(default_factory=dict)
class-attribute
instance-attribute
¶
tile_layout = field(default_factory=list)
class-attribute
instance-attribute
¶
title
instance-attribute
¶
user_id
instance-attribute
¶
version = 3
class-attribute
instance-attribute
¶
from_dict(data)
classmethod
¶
to_dict()
¶
DashboardStore
¶
Bases: BaseDashboardStore
SQLite-backed store for dashboard models.
delete_dashboard(user_id, dashboard_id)
¶
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
list_dashboards(user_id)
¶
load_dashboard(user_id, dashboard_id)
¶
rename_dashboard(user_id, dashboard_id, new_title)
¶
save_dashboard(dashboard)
¶
set_permission(dashboard_id, permission)
¶
Persist a new permission set on a dashboard. Returns success.
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
DataflowGraph
¶
Manages node state instances and wires edges with runtime validation.
edges
property
¶
All current edges.
node_ids
property
¶
All current node instance IDs.
add_edge(source_id, source_port, target_id, target_port)
¶
Wire an edge between two ports.
Returns True on success, or an error message string on failure.
add_node(instance_id, component_id)
¶
Create a new node state instance.
get_config_state(instance_id)
¶
Get the config state instance for a node, if it has config.
get_state(instance_id)
¶
Get the state instance for a node.
register_specs(specs)
¶
Add component specs to the graph, keeping existing nodes intact.
Components are imported on demand, so specs arrive after the graph is constructed. Registering them incrementally avoids rebuilding the graph and losing the nodes and edges already placed on it.
remove_edge(source_id, source_port, target_id, target_port)
¶
Remove an edge, unsubscribe the watcher, and reset target to default.
remove_node(instance_id)
¶
Remove a node and any edges connected to it.
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 |
None
|
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
breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.')
class-attribute
instance-attribute
¶
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
¶
dashboard = param.ClassSelector(class_=DashboardModel, 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 DashboardModel 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
¶
editable = param.Boolean(default=True, doc='\n Whether the dashboard can be edited. When False the toolbar is hidden\n and the tile grid is shown locked, giving a pure view of the dashboard.')
class-attribute
instance-attribute
¶
graph
property
¶
The live dataflow graph wiring the placed components together.
layout
property
¶
The current tile layout, whether or not the grid is on screen.
mode = param.Selector(default='wiring', objects=['wiring', 'dashboard'], doc="\n Which workspace is shown: 'wiring' for the ReactFlow canvas, 'dashboard'\n for the tile grid.")
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
¶
preview = param.Boolean(default=False, doc="\n Preview the dashboard as an end user sees it without leaving edit mode.\n Only meaningful while `editable` and in 'dashboard' mode.")
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
¶
saved = param.Event(doc='Triggered after a dashboard is successfully saved.')
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_=BaseDashboardStore, 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
¶
toolbar = param.Boolean(default=True, doc='Whether to render the editor toolbar above the workspace.')
class-attribute
instance-attribute
¶
toolbar_extra = Children(default=[], doc='Additional items appended to the right of the toolbar.')
class-attribute
instance-attribute
¶
user = param.String(default='local', doc='Principal recorded as the owner of dashboards created here.')
class-attribute
instance-attribute
¶
add_component(component_id, config=None, position=None)
¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The new instance's id, for use with |
Raises:
| Type | Description |
|---|---|
KeyError
|
If component_id is not a registered component. |
clear()
¶
Remove every component and edge from the canvas.
connect(source_id, source_port, target_id, target_port)
¶
Wire an output port to an input port.
Returns:
| Type | Description |
|---|---|
bool or str
|
|
disconnect(source_id, source_port, target_id, target_port)
¶
Remove the edge between two ports.
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.
load(dashboard_id)
¶
Load a dashboard from the configured store, by id or title.
load_model(model)
¶
Hydrate the canvas from a :class:DashboardModel.
Components the model references but this editor does not offer are skipped with a warning rather than aborting the load.
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.
new_dashboard(title)
¶
Start a new empty dashboard, persisting it if a store is configured.
remove_component(instance_id)
¶
Remove a placed component along with its edges and its tile.
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.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :attr: |
to_model(title=None)
¶
Serialize the current canvas into a :class:DashboardModel.
The returned model is detached from the editor, so this is the seam to use when persisting to something other than the configured store.
Identity
dataclass
¶
The resolved principal for a session.
groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
oauth_user = None
class-attribute
instance-attribute
¶
system_user = None
class-attribute
instance-attribute
¶
user
instance-attribute
¶
user_info = field(default_factory=dict)
class-attribute
instance-attribute
¶
user_names
property
¶
All names this identity may be referenced by in a rule.
in_groups(groups)
¶
Whether the identity belongs to any of groups.
is_user(users)
¶
Whether the identity matches any of users (OAuth or system name).
InputPort
dataclass
¶
Describes a single input port on a component node.
MemoryDashboardStore
¶
Bases: BaseDashboardStore
Dict-backed store for notebooks, scripts and tests.
Dashboards live for as long as the store does and are never written to disk. Models are deep-copied in and out so a caller mutating a dashboard it saved (or loaded) cannot retroactively change what is stored, matching how the SQLite store behaves.
OutputPort
dataclass
¶
PanelAppMetadata
dataclass
¶
Metadata attached to a component or page by the @register decorator.
allow_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=list)
class-attribute
instance-attribute
¶
authorize = None
class-attribute
instance-attribute
¶
component = False
class-attribute
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_schema = None
class-attribute
instance-attribute
¶
default_size = None
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=list)
class-attribute
instance-attribute
¶
description = None
class-attribute
instance-attribute
¶
icon = None
class-attribute
instance-attribute
¶
max_size = None
class-attribute
instance-attribute
¶
min_size = None
class-attribute
instance-attribute
¶
page = True
class-attribute
instance-attribute
¶
permission
property
¶
Build a :class:~panel_flowdash.auth.Permission from the declared rules.
provides = field(default_factory=list)
class-attribute
instance-attribute
¶
requires = field(default_factory=list)
class-attribute
instance-attribute
¶
sidebar = False
class-attribute
instance-attribute
¶
singleton = False
class-attribute
instance-attribute
¶
tags = field(default_factory=list)
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
from_app(app)
classmethod
¶
Extract metadata from an app object.
Permission
dataclass
¶
An allow/deny rule set evaluated against an :class:Identity.
All four fields match either the resolved user (OAuth login or system
user) or one of the identity's groups. An empty Permission declares
no constraints and defers entirely to the caller's default policy.
allow_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
is_empty
property
¶
Whether the permission declares no allow or deny rules.
from_dict(data)
classmethod
¶
Deserialize from a (possibly None or partial) mapping.
from_spec(*, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None)
classmethod
¶
Build a :class:Permission from loosely-typed iterables.
to_dict()
¶
Serialize to sorted lists for JSON persistence.
RegistryEntry
dataclass
¶
A registered component/page with its metadata.
app = None
class-attribute
instance-attribute
¶
app_id
instance-attribute
¶
metadata
instance-attribute
¶
module_name
instance-attribute
¶
module_path = None
class-attribute
instance-attribute
¶
name
instance-attribute
¶
page_path
instance-attribute
¶
section
instance-attribute
¶
spec = field(default=None, repr=False, compare=False)
class-attribute
instance-attribute
¶
title
property
¶
Human-readable title.
from_app(app, *, app_id=None, section=None, name=None)
classmethod
¶
Build an entry from an already-imported app object.
Unlike :func:build_registry, which discovers modules on disk and defers
importing them, this wraps a live object so load() is a no-op. Used
by the programmatic API where components are passed in directly.
Objects without @register metadata are treated as components, since
a bare Viewer subclass handed to the editor is only ever meant to be
one.
load()
¶
Import the module and return the app object.
Caches the result on self.app. Raises on import failure.
build_component_spec(entry)
¶
Build a ComponentSpec from a registry entry, caching it on the entry.
A spec is derived purely from the component's class/metadata, so it does not vary between sessions. Registry entries are shared across sessions, which makes the cache process-wide.
build_component_specs(registry, component_ids=None)
¶
Build specs for component-enabled entries in a registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
dict[str, RegistryEntry]
|
Registry entries keyed by component id. |
required |
component_ids
|
Iterable[str] | None
|
Restrict spec building to these ids. Entries outside the set are skipped without being introspected, so an unloaded component costs nothing. |
None
|
build_node_state_class(spec)
¶
Create a Parameterized subclass with one param per port (inputs + outputs).
build_session_state_class(registry)
¶
Build a Parameterized subclass with one param per declared state key.
Scans the registry for all provides and requires keys and creates
a dynamic class whose parameters represent shared session state.
can_administer(identity, owner, admin_groups)
¶
Whether identity may administer a resource owned by owner.
When no admin_groups are configured administration is unrestricted: the running user (however resolved) may administer any resource. This keeps the default, auth-less deployment fully editable. Once admin_groups are set, only the owner and members of those groups may administer a resource.
check_requirements(state, requires)
¶
Check which required keys are unsatisfied on the given state instance.
Returns a list of dicts describing each unsatisfied requirement. An empty list means all requirements are met.
is_authorized(permission, identity, *, default_allow=True, owner=None)
¶
Evaluate permission against identity.
Order of precedence:
- A matching
deny_users/deny_groupsrule denies access (deny always wins, even for the owner). - The owner, if given and matching, is allowed.
- Any
allow_*rule present: allowed iff the identity matches at least one of them. - No allow/deny rules at all: fall back to default_allow.
normalize_components(components)
¶
Build a registry from any supported component declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
Any
|
One of, or a list mixing any of:
|
required |
Returns:
| Type | Description |
|---|---|
dict
|
Registry entries keyed by component id. |
register(*, page=True, component=False, sidebar=False, title=None, icon=None, description=None, tags=None, default_size=None, min_size=None, max_size=None, singleton=False, provides=None, requires=None, config_schema=None, config=None, config_editor=None, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None, authorize=None)
¶
Metadata-only decorator for app exports.
Annotates an app object/callable without altering runtime behavior.
The config_schema, config and config_editor arguments declare
design-time configuration options that appear in the node editor. Use
config_schema (a param.Parameterized subclass, a Pydantic model, or
a JSON Schema dict) to define config explicitly, or config to name which
of a Viewer's own params are configuration rather than input ports. Pass
config_editor to supply a custom editor callable instead of the
auto-generated form.
The allow_users, allow_groups, deny_users and deny_groups
arguments declare page-level authorization rules. Users are matched against
either the OAuth login or the system user; groups against the identity's
resolved group membership. Deny rules always win; when only allow rules are
present the identity must match at least one; with no rules the project's
default policy applies. Pass authorize for a custom callable taking the
resolved Identity and returning a bool (resolved on import).
resolve_identity(auth_config=None)
¶
Resolve the current session's :class:Identity.
Prefers the OAuth login (pn.state.user) when a real provider populated
it; otherwise falls back to the system user, then to "anonymous".
Groups are the union of claim-derived groups, the static user_groups
mapping and any dynamic resolve_groups callback.
__main__
¶
Allow running as python -m panel_flowdash serve.
app
¶
Application builder: scans a project directory and constructs the Panel app.
COMPONENTS_ROUTE = '/components'
module-attribute
¶
DASH_ROUTE_PREFIX = '/dash/'
module-attribute
¶
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
FlowDashApp
¶
Bases: Viewer
FlowDash application: scans a project directory and serves its pages and components.
auth_config = param.ClassSelector(class_=AuthConfig, doc='\n Project-level authorization configuration controlling group discovery,\n the admin groups and the default access policy.')
class-attribute
instance-attribute
¶
breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.')
class-attribute
instance-attribute
¶
configure_layout = param.Callable(default=None, doc='\n Optional callback invoked on every navigation with\n (app, content, route). Use it to set `app.sidebar` and\n `app.contextbar` for the page currently being served.')
class-attribute
instance-attribute
¶
contextbar = Children(default=[], doc='Items prepended to the contextbar.')
class-attribute
instance-attribute
¶
contextbar_open = param.Boolean(default=False, doc='Whether the contextbar is open.')
class-attribute
instance-attribute
¶
home_dashboard = param.String(default=None, doc="\n Dashboard shown on the homepage ('/'). Accepts a dashboard id or\n title. When unset, the homepage shows the dashboard grid launcher.")
class-attribute
instance-attribute
¶
nav_variant = param.Selector(default='right', objects=['left', 'right', 'menubar'], doc="\n Where the navigation menu is rendered. 'left' and 'right' dock a\n MenuList in a drawer on that side of the page; 'menubar' places a\n MenuBar in the page header with quick-action icons alongside it.")
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
¶
page_options = param.Dict(default={}, doc="\n Extra keyword arguments passed through to the underlying\n `panel_material_ui.Page`, overriding the app's own defaults.")
class-attribute
instance-attribute
¶
project_dir = param.Path(doc='Path to the project directory.')
class-attribute
instance-attribute
¶
sidebar = Children(default=[], doc='Items prepended to the sidebar.')
class-attribute
instance-attribute
¶
store = param.ClassSelector(class_=DashboardStore, doc='DashboardStore instance for persistence.')
class-attribute
instance-attribute
¶
title = param.String(default='FlowDash', doc='Application title shown in the browser tab.')
class-attribute
instance-attribute
¶
build_routes(project_dir, registry=None, **params)
classmethod
¶
Generate route mapping for pn.serve.
auth
¶
Per-page and per-dashboard authorization.
The module defines a small, self-contained authorization model shared by both
code-authored pages (permissions declared on the @register decorator) and
runtime-created dashboards (permissions persisted in the store):
- :class:
Identity— the resolved principal for a session (OAuth user, system user, resolveduserand the set ofgroupsit belongs to). - :class:
Permission— an allow/deny rule set keyed on users and groups. - :class:
AuthConfig— project-level configuration controlling how groups are discovered and which groups may administer any dashboard. - :func:
resolve_identity— builds an :class:Identityfrom the live Panel session plus theAuthConfig. - :func:
is_authorized— evaluates a :class:Permissionagainst an :class:Identity.
The same :func:is_authorized evaluator serves pages, dashboards and (in the
future) components, so the semantics only ever live in one place.
ANONYMOUS_USER = 'anonymous'
module-attribute
¶
DEFAULT_GROUP_CLAIMS = ('groups', 'roles')
module-attribute
¶
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
AuthConfig
dataclass
¶
Project-level authorization configuration.
Loaded from the project's __init__.py by the serve command. All fields
are optional; the defaults reproduce the pre-auth behavior (allow by
default, groups read from the standard claim keys, no admin groups).
admin_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
default_allow = True
class-attribute
instance-attribute
¶
group_claims = DEFAULT_GROUP_CLAIMS
class-attribute
instance-attribute
¶
resolve_groups = None
class-attribute
instance-attribute
¶
user_groups = field(default_factory=dict)
class-attribute
instance-attribute
¶
from_module(module)
classmethod
¶
Build an :class:AuthConfig from names on a project __init__.
Reads group_claims, user_groups, resolve_groups,
admin_groups and default_allow if present, falling back to the
defaults otherwise. Missing module or names yield a default config.
Identity
dataclass
¶
The resolved principal for a session.
groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
oauth_user = None
class-attribute
instance-attribute
¶
system_user = None
class-attribute
instance-attribute
¶
user
instance-attribute
¶
user_info = field(default_factory=dict)
class-attribute
instance-attribute
¶
user_names
property
¶
All names this identity may be referenced by in a rule.
in_groups(groups)
¶
Whether the identity belongs to any of groups.
is_user(users)
¶
Whether the identity matches any of users (OAuth or system name).
Permission
dataclass
¶
An allow/deny rule set evaluated against an :class:Identity.
All four fields match either the resolved user (OAuth login or system
user) or one of the identity's groups. An empty Permission declares
no constraints and defers entirely to the caller's default policy.
allow_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
is_empty
property
¶
Whether the permission declares no allow or deny rules.
from_dict(data)
classmethod
¶
Deserialize from a (possibly None or partial) mapping.
from_spec(*, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None)
classmethod
¶
Build a :class:Permission from loosely-typed iterables.
to_dict()
¶
Serialize to sorted lists for JSON persistence.
can_administer(identity, owner, admin_groups)
¶
Whether identity may administer a resource owned by owner.
When no admin_groups are configured administration is unrestricted: the running user (however resolved) may administer any resource. This keeps the default, auth-less deployment fully editable. Once admin_groups are set, only the owner and members of those groups may administer a resource.
is_authorized(permission, identity, *, default_allow=True, owner=None)
¶
Evaluate permission against identity.
Order of precedence:
- A matching
deny_users/deny_groupsrule denies access (deny always wins, even for the owner). - The owner, if given and matching, is allowed.
- Any
allow_*rule present: allowed iff the identity matches at least one of them. - No allow/deny rules at all: fall back to default_allow.
make_authorize_callback(registry, auth_config, *, url_prefix='')
¶
Build a Panel config.authorize_callback gating page routes.
The returned callback authorizes direct HTTP access to code-authored page
URLs against the resolved identity. Non-page routes (/components,
/dash/... and unknown paths) always pass here and are gated in-app,
where per-dashboard permissions and richer denied views live.
url_prefix strips a server route prefix from the request path before
matching against registry page paths.
path_permission_lookup(registry)
¶
Map each page's URL path to its declared :class:Permission.
Used by the HTTP-boundary authorize callback to gate direct URL access to code-authored pages. Only page entries are included; component and SPA-only routes are gated in-app.
resolve_identity(auth_config=None)
¶
Resolve the current session's :class:Identity.
Prefers the OAuth login (pn.state.user) when a real provider populated
it; otherwise falls back to the system user, then to "anonymous".
Groups are the union of claim-derived groups, the static user_groups
mapping and any dynamic resolve_groups callback.
command
¶
Command-line interface for panel-flowdash.
main(args=None)
¶
Entry point for the panel-flowdash CLI.
serve
¶
The flowdash serve subcommand.
log = logging.getLogger(__name__)
module-attribute
¶
Serve
¶
Bases: Serve
Serve a flowdash dashboard application from a project directory.
args = (('directory', Argument(metavar='DIRECTORY', help='Path to the project directory containing page/component modules.')), ('--db-path', Argument(action='store', type=str, default=None, help='Path to the SQLite database file. Defaults to <directory>/dashboards.db.')), ('--title', Argument(action='store', type=str, default='FlowDash', help='Application title shown in the browser tab.')), ('--home-dashboard', Argument(action='store', type=str, default=None, help='Dashboard (id or title) to show on the homepage. When unset, the homepage shows the dashboard grid.')), ('--nav-variant', Argument(action='store', type=str, default='right', choices=('left', 'right', 'menubar'), help="Where to render the navigation menu: 'left' or 'right' (docked drawer on that side) or 'menubar' (in the page header).")), *((name, arg) for name, arg in _PanelServe.args if name not in _EXCLUDED_ARGS))
class-attribute
instance-attribute
¶
help = 'Launch the FlowDash dashboard server from a project directory.'
class-attribute
instance-attribute
¶
name = 'serve'
class-attribute
instance-attribute
¶
customize_applications(args, applications)
¶
customize_kwargs(args, server_kwargs)
¶
invoke(args)
¶
component_library
¶
Normalize heterogeneous component declarations into a registry.
The project-directory workflow discovers components by scanning the filesystem
(:func:~panel_flowdash.registry.build_registry). The programmatic workflow
hands them over directly: decorated functions, Viewer subclasses, a mapping
of explicit ids, a directory, or any mix of those. Both funnel into the same
dict[str, RegistryEntry] that the spec builder and the editor consume.
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
normalize_components(components)
¶
Build a registry from any supported component declaration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
Any
|
One of, or a list mixing any of:
|
required |
Returns:
| Type | Description |
|---|---|
dict
|
Registry entries keyed by component id. |
component_spec
¶
Component specification with typed ports for the dataflow editor.
ComponentSpec
dataclass
¶
Full specification of a component's ports and metadata.
component_id
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_state_class = None
class-attribute
instance-attribute
¶
default_size
instance-attribute
¶
description
instance-attribute
¶
icon
instance-attribute
¶
inputs
instance-attribute
¶
outputs
instance-attribute
¶
tags
instance-attribute
¶
title
instance-attribute
¶
ConfigField
dataclass
¶
InputPort
dataclass
¶
Describes a single input port on a component node.
OutputPort
dataclass
¶
build_component_spec(entry)
¶
Build a ComponentSpec from a registry entry, caching it on the entry.
A spec is derived purely from the component's class/metadata, so it does not vary between sessions. Registry entries are shared across sessions, which makes the cache process-wide.
build_component_specs(registry, component_ids=None)
¶
Build specs for component-enabled entries in a registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
dict[str, RegistryEntry]
|
Registry entries keyed by component id. |
required |
component_ids
|
Iterable[str] | None
|
Restrict spec building to these ids. Entries outside the set are skipped without being introspected, so an unloaded component costs nothing. |
None
|
dashboard_store
¶
Persistence for dashboard graphs, backed by SQLite or an in-memory dict.
BaseDashboardStore
¶
Bases: ABC
The persistence interface the editor and app shell depend on.
Subclasses implement the six storage primitives below; the access-control and lookup helpers are backend-independent and inherited. Implement this to back dashboards with something other than SQLite.
can_administer(identity, dashboard_id, admin_groups=frozenset())
¶
Whether identity may administer (edit/delete/share) the dashboard.
create_dashboard(user_id, title)
¶
Create, persist and return a new empty dashboard.
delete_dashboard(user_id, dashboard_id)
abstractmethod
¶
Delete a dashboard owned by user_id. Returns whether one was removed.
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
get_owner(dashboard_id)
¶
Return the owner (user_id) of a dashboard, or None if missing.
list_accessible(identity, *, default_allow=True)
¶
List dashboards the identity owns or has been granted access to.
Owned dashboards sort first (both groups by recency), so a user's own dashboards stay visually grouped ahead of ones shared with them.
list_dashboards(user_id)
¶
Dashboards owned by user_id, most recently updated first.
load_dashboard(user_id, dashboard_id)
¶
Load a dashboard, but only if user_id owns it.
load_for_access(identity, dashboard_id, *, default_allow=True)
¶
Load a dashboard if identity is authorized, else None.
Returns None both when the dashboard does not exist and when access
is denied, so callers render a single "not found / denied" view.
rename_dashboard(user_id, dashboard_id, new_title)
abstractmethod
¶
Retitle a dashboard owned by user_id. Returns whether one was updated.
save_dashboard(dashboard)
abstractmethod
¶
Insert or update a dashboard.
set_permission(dashboard_id, permission)
abstractmethod
¶
Persist a new permission set on a dashboard. Returns success.
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
DashboardEdge
dataclass
¶
DashboardItem
dataclass
¶
A component instance on the dashboard.
x, y store the ReactFlow node canvas position. Grid layout (widths, heights, visibility) lives in DashboardModel.tile_layout.
DashboardModel
dataclass
¶
A persisted dashboard: nodes + edges + tile layout.
breakpoints = field(default_factory=list)
class-attribute
instance-attribute
¶
dashboard_id
instance-attribute
¶
edges = field(default_factory=list)
class-attribute
instance-attribute
¶
items = field(default_factory=list)
class-attribute
instance-attribute
¶
owner
property
¶
The immutable owner principal (the creating user).
permission = field(default_factory=Permission)
class-attribute
instance-attribute
¶
responsive_layouts = field(default_factory=dict)
class-attribute
instance-attribute
¶
tile_layout = field(default_factory=list)
class-attribute
instance-attribute
¶
title
instance-attribute
¶
user_id
instance-attribute
¶
version = 3
class-attribute
instance-attribute
¶
from_dict(data)
classmethod
¶
to_dict()
¶
DashboardStore
¶
Bases: BaseDashboardStore
SQLite-backed store for dashboard models.
delete_dashboard(user_id, dashboard_id)
¶
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
list_dashboards(user_id)
¶
load_dashboard(user_id, dashboard_id)
¶
rename_dashboard(user_id, dashboard_id, new_title)
¶
save_dashboard(dashboard)
¶
set_permission(dashboard_id, permission)
¶
Persist a new permission set on a dashboard. Returns success.
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
MemoryDashboardStore
¶
Bases: BaseDashboardStore
Dict-backed store for notebooks, scripts and tests.
Dashboards live for as long as the store does and are never written to disk. Models are deep-copied in and out so a caller mutating a dashboard it saved (or loaded) cannot retroactively change what is stored, matching how the SQLite store behaves.
dataflow_engine
¶
Dataflow wiring engine with runtime validation.
Each node in the graph gets a NodeState (a dynamic Parameterized subclass) whose parameters correspond to the node's declared input and output ports. Edges are wired via param.watch: when a source port changes, the value is assigned to the target port inside a try/except so that runtime type errors (e.g. param validation failures) are caught and reported via an error callback.
DataflowGraph
¶
Manages node state instances and wires edges with runtime validation.
edges
property
¶
All current edges.
node_ids
property
¶
All current node instance IDs.
add_edge(source_id, source_port, target_id, target_port)
¶
Wire an edge between two ports.
Returns True on success, or an error message string on failure.
add_node(instance_id, component_id)
¶
Create a new node state instance.
get_config_state(instance_id)
¶
Get the config state instance for a node, if it has config.
get_state(instance_id)
¶
Get the state instance for a node.
register_specs(specs)
¶
Add component specs to the graph, keeping existing nodes intact.
Components are imported on demand, so specs arrive after the graph is constructed. Registering them incrementally avoids rebuilding the graph and losing the nodes and edges already placed on it.
remove_edge(source_id, source_port, target_id, target_port)
¶
Remove an edge, unsubscribe the watcher, and reset target to default.
remove_node(instance_id)
¶
Remove a node and any edges connected to it.
build_node_state_class(spec)
¶
Create a Parameterized subclass with one param per port (inputs + outputs).
editor
¶
The embeddable dataflow editor.
:class:FlowDash is the reusable half of the framework: a ReactFlow wiring
canvas plus a tile-grid layout editor over a set of components. It knows nothing
about routing, pages, navigation or identity, so it can be dropped into any Panel
app, notebook or template. :class:~panel_flowdash.app.FlowDashApp builds the
full multi-page application on top of it.
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
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 |
None
|
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
breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.')
class-attribute
instance-attribute
¶
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
¶
dashboard = param.ClassSelector(class_=DashboardModel, 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 DashboardModel 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
¶
editable = param.Boolean(default=True, doc='\n Whether the dashboard can be edited. When False the toolbar is hidden\n and the tile grid is shown locked, giving a pure view of the dashboard.')
class-attribute
instance-attribute
¶
graph
property
¶
The live dataflow graph wiring the placed components together.
layout
property
¶
The current tile layout, whether or not the grid is on screen.
mode = param.Selector(default='wiring', objects=['wiring', 'dashboard'], doc="\n Which workspace is shown: 'wiring' for the ReactFlow canvas, 'dashboard'\n for the tile grid.")
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
¶
preview = param.Boolean(default=False, doc="\n Preview the dashboard as an end user sees it without leaving edit mode.\n Only meaningful while `editable` and in 'dashboard' mode.")
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
¶
saved = param.Event(doc='Triggered after a dashboard is successfully saved.')
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_=BaseDashboardStore, 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
¶
toolbar = param.Boolean(default=True, doc='Whether to render the editor toolbar above the workspace.')
class-attribute
instance-attribute
¶
toolbar_extra = Children(default=[], doc='Additional items appended to the right of the toolbar.')
class-attribute
instance-attribute
¶
user = param.String(default='local', doc='Principal recorded as the owner of dashboards created here.')
class-attribute
instance-attribute
¶
add_component(component_id, config=None, position=None)
¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The new instance's id, for use with |
Raises:
| Type | Description |
|---|---|
KeyError
|
If component_id is not a registered component. |
clear()
¶
Remove every component and edge from the canvas.
connect(source_id, source_port, target_id, target_port)
¶
Wire an output port to an input port.
Returns:
| Type | Description |
|---|---|
bool or str
|
|
disconnect(source_id, source_port, target_id, target_port)
¶
Remove the edge between two ports.
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.
load(dashboard_id)
¶
Load a dashboard from the configured store, by id or title.
load_model(model)
¶
Hydrate the canvas from a :class:DashboardModel.
Components the model references but this editor does not offer are skipped with a warning rather than aborting the load.
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.
new_dashboard(title)
¶
Start a new empty dashboard, persisting it if a store is configured.
remove_component(instance_id)
¶
Remove a placed component along with its edges and its tile.
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.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :attr: |
to_model(title=None)
¶
Serialize the current canvas into a :class:DashboardModel.
The returned model is detached from the editor, so this is the seam to use when persisting to something other than the configured store.
registry
¶
Component registry: the register decorator and metadata model.
panel_app = register
module-attribute
¶
PanelAppMetadata
dataclass
¶
Metadata attached to a component or page by the @register decorator.
allow_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=list)
class-attribute
instance-attribute
¶
authorize = None
class-attribute
instance-attribute
¶
component = False
class-attribute
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_schema = None
class-attribute
instance-attribute
¶
default_size = None
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=list)
class-attribute
instance-attribute
¶
description = None
class-attribute
instance-attribute
¶
icon = None
class-attribute
instance-attribute
¶
max_size = None
class-attribute
instance-attribute
¶
min_size = None
class-attribute
instance-attribute
¶
page = True
class-attribute
instance-attribute
¶
permission
property
¶
Build a :class:~panel_flowdash.auth.Permission from the declared rules.
provides = field(default_factory=list)
class-attribute
instance-attribute
¶
requires = field(default_factory=list)
class-attribute
instance-attribute
¶
sidebar = False
class-attribute
instance-attribute
¶
singleton = False
class-attribute
instance-attribute
¶
tags = field(default_factory=list)
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
from_app(app)
classmethod
¶
Extract metadata from an app object.
RegistryEntry
dataclass
¶
A registered component/page with its metadata.
app = None
class-attribute
instance-attribute
¶
app_id
instance-attribute
¶
metadata
instance-attribute
¶
module_name
instance-attribute
¶
module_path = None
class-attribute
instance-attribute
¶
name
instance-attribute
¶
page_path
instance-attribute
¶
section
instance-attribute
¶
spec = field(default=None, repr=False, compare=False)
class-attribute
instance-attribute
¶
title
property
¶
Human-readable title.
from_app(app, *, app_id=None, section=None, name=None)
classmethod
¶
Build an entry from an already-imported app object.
Unlike :func:build_registry, which discovers modules on disk and defers
importing them, this wraps a live object so load() is a no-op. Used
by the programmatic API where components are passed in directly.
Objects without @register metadata are treated as components, since
a bare Viewer subclass handed to the editor is only ever meant to be
one.
load()
¶
Import the module and return the app object.
Caches the result on self.app. Raises on import failure.
build_registry(project_dir)
¶
Scan project_dir for page/component modules without importing them.
Reads each .py file with the AST to extract @register metadata.
Modules are not imported at this stage; each RegistryEntry.app is
None until RegistryEntry.load() is called.
register(*, page=True, component=False, sidebar=False, title=None, icon=None, description=None, tags=None, default_size=None, min_size=None, max_size=None, singleton=False, provides=None, requires=None, config_schema=None, config=None, config_editor=None, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None, authorize=None)
¶
Metadata-only decorator for app exports.
Annotates an app object/callable without altering runtime behavior.
The config_schema, config and config_editor arguments declare
design-time configuration options that appear in the node editor. Use
config_schema (a param.Parameterized subclass, a Pydantic model, or
a JSON Schema dict) to define config explicitly, or config to name which
of a Viewer's own params are configuration rather than input ports. Pass
config_editor to supply a custom editor callable instead of the
auto-generated form.
The allow_users, allow_groups, deny_users and deny_groups
arguments declare page-level authorization rules. Users are matched against
either the OAuth login or the system user; groups against the identity's
resolved group membership. Deny rules always win; when only allow rules are
present the identity must match at least one; with no rules the project's
default policy applies. Pass authorize for a custom callable taking the
resolved Identity and returning a bool (resolved on import).
session_state
¶
Per-session shared state built from registry provides/requires declarations.
build_session_state_class(registry)
¶
Build a Parameterized subclass with one param per declared state key.
Scans the registry for all provides and requires keys and creates
a dynamic class whose parameters represent shared session state.
check_requirements(state, requires)
¶
Check which required keys are unsatisfied on the given state instance.
Returns a list of dicts describing each unsatisfied requirement. An empty list means all requirements are met.
util
¶
Shared helpers for the app shell and the embeddable editor.
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
is_async(obj)
¶
Whether obj is a coroutine or async generator function.
is_async_gen(obj)
¶
Whether obj is an async generator function, seen through decorators.
param.output and functools.wraps return sync wrappers around async
functions, which the plain :mod:inspect predicates report as sync, so
unwrap before asking.
is_coroutine(obj)
¶
Whether obj is a coroutine function, seen through decorators.
notify(severity, message, *, duration=3000, enabled=True)
¶
Emit a Panel notification, falling back to the logger.
pn.state.notifications is None outside a served session (a plain
script, a test, or a notebook without the notifications extension), so
calling it unguarded raises. Embedders can also opt out entirely by passing
enabled=False.
panel_call(app, /, **kwargs)
¶
Call a component callable and return a renderable view of the result.
Sync callables are called immediately. Async ones must not be: calling them
here would only produce an un-awaited coroutine, which pn.panel wraps as
a string. Instead they are deferred to a zero-argument closure that Panel's
ParamFunction awaits (or iterates, for async generators) on the event
loop when the view is rendered.
panel_viewer(instance)
¶
Return a renderable view of a Viewer, awaiting an async __panel__.
pn.panel calls __panel__ synchronously, so an async def __panel__
would be wrapped un-awaited. ParamMethod handles both, and additionally
re-renders when the method declares param.depends.
Modules¶
Registry¶
panel_flowdash.registry
¶
Component registry: the register decorator and metadata model.
_APP_METADATA_BY_ID = {}
module-attribute
¶
_DEFAULT_SECTION = 'Components'
module-attribute
¶
_LITERAL_KEYS = {'page', 'component', 'sidebar', 'title', 'icon', 'description', 'singleton', 'provides', 'requires', 'config', 'tags', 'default_size', 'min_size', 'max_size', 'allow_users', 'allow_groups', 'deny_users', 'deny_groups'}
module-attribute
¶
_REGISTER_NAMES = {'register', 'panel_app'}
module-attribute
¶
_UNINFORMATIVE_MODULES = {'main', 'builtins', 'abc'}
module-attribute
¶
panel_app = register
module-attribute
¶
PanelAppMetadata
dataclass
¶
Metadata attached to a component or page by the @register decorator.
Source code in src/panel_flowdash/registry.py
allow_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=list)
class-attribute
instance-attribute
¶
authorize = None
class-attribute
instance-attribute
¶
component = False
class-attribute
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_schema = None
class-attribute
instance-attribute
¶
default_size = None
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=list)
class-attribute
instance-attribute
¶
description = None
class-attribute
instance-attribute
¶
icon = None
class-attribute
instance-attribute
¶
max_size = None
class-attribute
instance-attribute
¶
min_size = None
class-attribute
instance-attribute
¶
page = True
class-attribute
instance-attribute
¶
permission
property
¶
Build a :class:~panel_flowdash.auth.Permission from the declared rules.
provides = field(default_factory=list)
class-attribute
instance-attribute
¶
requires = field(default_factory=list)
class-attribute
instance-attribute
¶
sidebar = False
class-attribute
instance-attribute
¶
singleton = False
class-attribute
instance-attribute
¶
tags = field(default_factory=list)
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
from_app(app)
classmethod
¶
Extract metadata from an app object.
Source code in src/panel_flowdash/registry.py
Permission
dataclass
¶
An allow/deny rule set evaluated against an :class:Identity.
All four fields match either the resolved user (OAuth login or system
user) or one of the identity's groups. An empty Permission declares
no constraints and defers entirely to the caller's default policy.
Source code in src/panel_flowdash/auth.py
allow_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
is_empty
property
¶
Whether the permission declares no allow or deny rules.
from_dict(data)
classmethod
¶
Deserialize from a (possibly None or partial) mapping.
Source code in src/panel_flowdash/auth.py
from_spec(*, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None)
classmethod
¶
Build a :class:Permission from loosely-typed iterables.
Source code in src/panel_flowdash/auth.py
to_dict()
¶
Serialize to sorted lists for JSON persistence.
Source code in src/panel_flowdash/auth.py
RegistryEntry
dataclass
¶
A registered component/page with its metadata.
Source code in src/panel_flowdash/registry.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
app = None
class-attribute
instance-attribute
¶
app_id
instance-attribute
¶
metadata
instance-attribute
¶
module_name
instance-attribute
¶
module_path = None
class-attribute
instance-attribute
¶
name
instance-attribute
¶
page_path
instance-attribute
¶
section
instance-attribute
¶
spec = field(default=None, repr=False, compare=False)
class-attribute
instance-attribute
¶
title
property
¶
Human-readable title.
from_app(app, *, app_id=None, section=None, name=None)
classmethod
¶
Build an entry from an already-imported app object.
Unlike :func:build_registry, which discovers modules on disk and defers
importing them, this wraps a live object so load() is a no-op. Used
by the programmatic API where components are passed in directly.
Objects without @register metadata are treated as components, since
a bare Viewer subclass handed to the editor is only ever meant to be
one.
Source code in src/panel_flowdash/registry.py
load()
¶
Import the module and return the app object.
Caches the result on self.app. Raises on import failure.
Source code in src/panel_flowdash/registry.py
_app_name(app)
¶
Derive a component name from a live app object.
Modules following the project-directory convention export their component as
app, which makes a useless id, so in that case the module stem names the
component instead (matching how :func:build_registry ids it).
Source code in src/panel_flowdash/registry.py
_app_section(app)
¶
Derive a section from an app object's defining module.
A component defined in myproject.analytics lands in an "analytics"
section. When the module stem already names the component (the app
convention), the parent package supplies the section instead.
Source code in src/panel_flowdash/registry.py
_eval_literal(node)
¶
Safely evaluate an AST literal node; return None on failure.
_extract_register_kwargs(source)
¶
Parse source and return the kwargs of the first @register/@panel_app call.
Only literal-evaluable arguments are captured; runtime expressions (e.g.
config_schema=MyParamClass) are silently skipped — they are picked up
later when the module is actually imported.
Returns None if no @register call is found.
Source code in src/panel_flowdash/registry.py
_module_parts(app)
¶
Meaningful dotted parts of an app's defining module, outermost first.
Source code in src/panel_flowdash/registry.py
build_registry(project_dir)
¶
Scan project_dir for page/component modules without importing them.
Reads each .py file with the AST to extract @register metadata.
Modules are not imported at this stage; each RegistryEntry.app is
None until RegistryEntry.load() is called.
Source code in src/panel_flowdash/registry.py
register(*, page=True, component=False, sidebar=False, title=None, icon=None, description=None, tags=None, default_size=None, min_size=None, max_size=None, singleton=False, provides=None, requires=None, config_schema=None, config=None, config_editor=None, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None, authorize=None)
¶
Metadata-only decorator for app exports.
Annotates an app object/callable without altering runtime behavior.
The config_schema, config and config_editor arguments declare
design-time configuration options that appear in the node editor. Use
config_schema (a param.Parameterized subclass, a Pydantic model, or
a JSON Schema dict) to define config explicitly, or config to name which
of a Viewer's own params are configuration rather than input ports. Pass
config_editor to supply a custom editor callable instead of the
auto-generated form.
The allow_users, allow_groups, deny_users and deny_groups
arguments declare page-level authorization rules. Users are matched against
either the OAuth login or the system user; groups against the identity's
resolved group membership. Deny rules always win; when only allow rules are
present the identity must match at least one; with no rules the project's
default policy applies. Pass authorize for a custom callable taking the
resolved Identity and returning a bool (resolved on import).
Source code in src/panel_flowdash/registry.py
Component Spec¶
panel_flowdash.component_spec
¶
Component specification with typed ports for the dataflow editor.
_BASE_PARAMS = set(param.Parameterized.param)
module-attribute
¶
ComponentSpec
dataclass
¶
Full specification of a component's ports and metadata.
Source code in src/panel_flowdash/component_spec.py
component_id
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_state_class = None
class-attribute
instance-attribute
¶
default_size
instance-attribute
¶
description
instance-attribute
¶
icon
instance-attribute
¶
inputs
instance-attribute
¶
outputs
instance-attribute
¶
tags
instance-attribute
¶
title
instance-attribute
¶
ConfigField
dataclass
¶
Describes a single design-time configuration option on a component.
Source code in src/panel_flowdash/component_spec.py
InputPort
dataclass
¶
Describes a single input port on a component node.
Source code in src/panel_flowdash/component_spec.py
OutputPort
dataclass
¶
Describes a single output port on a component node.
Source code in src/panel_flowdash/component_spec.py
PanelAppMetadata
dataclass
¶
Metadata attached to a component or page by the @register decorator.
Source code in src/panel_flowdash/registry.py
allow_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=list)
class-attribute
instance-attribute
¶
authorize = None
class-attribute
instance-attribute
¶
component = False
class-attribute
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_schema = None
class-attribute
instance-attribute
¶
default_size = None
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=list)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=list)
class-attribute
instance-attribute
¶
description = None
class-attribute
instance-attribute
¶
icon = None
class-attribute
instance-attribute
¶
max_size = None
class-attribute
instance-attribute
¶
min_size = None
class-attribute
instance-attribute
¶
page = True
class-attribute
instance-attribute
¶
permission
property
¶
Build a :class:~panel_flowdash.auth.Permission from the declared rules.
provides = field(default_factory=list)
class-attribute
instance-attribute
¶
requires = field(default_factory=list)
class-attribute
instance-attribute
¶
sidebar = False
class-attribute
instance-attribute
¶
singleton = False
class-attribute
instance-attribute
¶
tags = field(default_factory=list)
class-attribute
instance-attribute
¶
title = None
class-attribute
instance-attribute
¶
from_app(app)
classmethod
¶
Extract metadata from an app object.
Source code in src/panel_flowdash/registry.py
RegistryEntry
dataclass
¶
A registered component/page with its metadata.
Source code in src/panel_flowdash/registry.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
app = None
class-attribute
instance-attribute
¶
app_id
instance-attribute
¶
metadata
instance-attribute
¶
module_name
instance-attribute
¶
module_path = None
class-attribute
instance-attribute
¶
name
instance-attribute
¶
page_path
instance-attribute
¶
section
instance-attribute
¶
spec = field(default=None, repr=False, compare=False)
class-attribute
instance-attribute
¶
title
property
¶
Human-readable title.
from_app(app, *, app_id=None, section=None, name=None)
classmethod
¶
Build an entry from an already-imported app object.
Unlike :func:build_registry, which discovers modules on disk and defers
importing them, this wraps a live object so load() is a no-op. Used
by the programmatic API where components are passed in directly.
Objects without @register metadata are treated as components, since
a bare Viewer subclass handed to the editor is only ever meant to be
one.
Source code in src/panel_flowdash/registry.py
load()
¶
Import the module and return the app object.
Caches the result on self.app. Raises on import failure.
Source code in src/panel_flowdash/registry.py
_config_from_mapping(schema)
¶
Build a config state class from a JSON-Schema-like properties dict.
Source code in src/panel_flowdash/component_spec.py
_config_from_metadata(metadata, viewer_cls=None)
¶
Resolve config into a state class and field list from component metadata.
Source code in src/panel_flowdash/component_spec.py
_config_from_param_class(cls, names=None)
¶
Build a config state class and field list from a Parameterized subclass.
When names is given, only those params are treated as config; otherwise
every non-base param on the class is used.
Source code in src/panel_flowdash/component_spec.py
_is_pydantic_model(cls)
¶
_param_type_name(p)
¶
_ports_from_metadata(metadata)
¶
Source code in src/panel_flowdash/component_spec.py
_ports_from_viewer_class(viewer_cls, exclude=None)
¶
Source code in src/panel_flowdash/component_spec.py
_pydantic_to_properties(cls)
¶
Source code in src/panel_flowdash/component_spec.py
build_component_spec(entry)
¶
Build a ComponentSpec from a registry entry, caching it on the entry.
A spec is derived purely from the component's class/metadata, so it does not vary between sessions. Registry entries are shared across sessions, which makes the cache process-wide.
Source code in src/panel_flowdash/component_spec.py
build_component_specs(registry, component_ids=None)
¶
Build specs for component-enabled entries in a registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
dict[str, RegistryEntry]
|
Registry entries keyed by component id. |
required |
component_ids
|
Iterable[str] | None
|
Restrict spec building to these ids. Entries outside the set are skipped without being introspected, so an unloaded component costs nothing. |
None
|
Source code in src/panel_flowdash/component_spec.py
Dataflow Engine¶
panel_flowdash.dataflow_engine
¶
Dataflow wiring engine with runtime validation.
Each node in the graph gets a NodeState (a dynamic Parameterized subclass) whose parameters correspond to the node's declared input and output ports. Edges are wired via param.watch: when a source port changes, the value is assigned to the target port inside a try/except so that runtime type errors (e.g. param validation failures) are caught and reported via an error callback.
_RESERVED_PARAMS = set(param.Parameterized.param)
module-attribute
¶
ComponentSpec
dataclass
¶
Full specification of a component's ports and metadata.
Source code in src/panel_flowdash/component_spec.py
component_id
instance-attribute
¶
config = field(default_factory=list)
class-attribute
instance-attribute
¶
config_editor = None
class-attribute
instance-attribute
¶
config_state_class = None
class-attribute
instance-attribute
¶
default_size
instance-attribute
¶
description
instance-attribute
¶
icon
instance-attribute
¶
inputs
instance-attribute
¶
outputs
instance-attribute
¶
tags
instance-attribute
¶
title
instance-attribute
¶
DataflowGraph
¶
Manages node state instances and wires edges with runtime validation.
Source code in src/panel_flowdash/dataflow_engine.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
edges
property
¶
All current edges.
node_ids
property
¶
All current node instance IDs.
add_edge(source_id, source_port, target_id, target_port)
¶
Wire an edge between two ports.
Returns True on success, or an error message string on failure.
Source code in src/panel_flowdash/dataflow_engine.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
add_node(instance_id, component_id)
¶
Create a new node state instance.
Source code in src/panel_flowdash/dataflow_engine.py
get_config_state(instance_id)
¶
Get the config state instance for a node, if it has config.
get_state(instance_id)
¶
register_specs(specs)
¶
Add component specs to the graph, keeping existing nodes intact.
Components are imported on demand, so specs arrive after the graph is constructed. Registering them incrementally avoids rebuilding the graph and losing the nodes and edges already placed on it.
Source code in src/panel_flowdash/dataflow_engine.py
remove_edge(source_id, source_port, target_id, target_port)
¶
Remove an edge, unsubscribe the watcher, and reset target to default.
Source code in src/panel_flowdash/dataflow_engine.py
remove_node(instance_id)
¶
Remove a node and any edges connected to it.
Source code in src/panel_flowdash/dataflow_engine.py
_is_list_port(port)
¶
Return True if a port's declared type indicates a list/multi-connection input.
build_node_state_class(spec)
¶
Create a Parameterized subclass with one param per port (inputs + outputs).
Source code in src/panel_flowdash/dataflow_engine.py
Dashboard Store¶
panel_flowdash.dashboard_store
¶
Persistence for dashboard graphs, backed by SQLite or an in-memory dict.
BaseDashboardStore
¶
Bases: ABC
The persistence interface the editor and app shell depend on.
Subclasses implement the six storage primitives below; the access-control and lookup helpers are backend-independent and inherited. Implement this to back dashboards with something other than SQLite.
Source code in src/panel_flowdash/dashboard_store.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |
can_administer(identity, dashboard_id, admin_groups=frozenset())
¶
Whether identity may administer (edit/delete/share) the dashboard.
Source code in src/panel_flowdash/dashboard_store.py
create_dashboard(user_id, title)
¶
Create, persist and return a new empty dashboard.
Source code in src/panel_flowdash/dashboard_store.py
delete_dashboard(user_id, dashboard_id)
abstractmethod
¶
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
Source code in src/panel_flowdash/dashboard_store.py
get_owner(dashboard_id)
¶
Return the owner (user_id) of a dashboard, or None if missing.
list_accessible(identity, *, default_allow=True)
¶
List dashboards the identity owns or has been granted access to.
Owned dashboards sort first (both groups by recency), so a user's own dashboards stay visually grouped ahead of ones shared with them.
Source code in src/panel_flowdash/dashboard_store.py
list_dashboards(user_id)
¶
Dashboards owned by user_id, most recently updated first.
load_dashboard(user_id, dashboard_id)
¶
Load a dashboard, but only if user_id owns it.
Source code in src/panel_flowdash/dashboard_store.py
load_for_access(identity, dashboard_id, *, default_allow=True)
¶
Load a dashboard if identity is authorized, else None.
Returns None both when the dashboard does not exist and when access
is denied, so callers render a single "not found / denied" view.
Source code in src/panel_flowdash/dashboard_store.py
rename_dashboard(user_id, dashboard_id, new_title)
abstractmethod
¶
Retitle a dashboard owned by user_id. Returns whether one was updated.
save_dashboard(dashboard)
abstractmethod
¶
set_permission(dashboard_id, permission)
abstractmethod
¶
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
Source code in src/panel_flowdash/dashboard_store.py
DashboardEdge
dataclass
¶
A connection between two component ports.
Source code in src/panel_flowdash/dashboard_store.py
DashboardItem
dataclass
¶
A component instance on the dashboard.
x, y store the ReactFlow node canvas position. Grid layout (widths, heights, visibility) lives in DashboardModel.tile_layout.
Source code in src/panel_flowdash/dashboard_store.py
component_id
instance-attribute
¶
config = field(default_factory=dict)
class-attribute
instance-attribute
¶
instance_id
instance-attribute
¶
x = 0
class-attribute
instance-attribute
¶
y = 0
class-attribute
instance-attribute
¶
from_dict(data)
classmethod
¶
Source code in src/panel_flowdash/dashboard_store.py
DashboardModel
dataclass
¶
A persisted dashboard: nodes + edges + tile layout.
Source code in src/panel_flowdash/dashboard_store.py
breakpoints = field(default_factory=list)
class-attribute
instance-attribute
¶
dashboard_id
instance-attribute
¶
edges = field(default_factory=list)
class-attribute
instance-attribute
¶
items = field(default_factory=list)
class-attribute
instance-attribute
¶
owner
property
¶
The immutable owner principal (the creating user).
permission = field(default_factory=Permission)
class-attribute
instance-attribute
¶
responsive_layouts = field(default_factory=dict)
class-attribute
instance-attribute
¶
tile_layout = field(default_factory=list)
class-attribute
instance-attribute
¶
title
instance-attribute
¶
user_id
instance-attribute
¶
version = 3
class-attribute
instance-attribute
¶
from_dict(data)
classmethod
¶
Source code in src/panel_flowdash/dashboard_store.py
to_dict()
¶
Source code in src/panel_flowdash/dashboard_store.py
DashboardStore
¶
Bases: BaseDashboardStore
SQLite-backed store for dashboard models.
Source code in src/panel_flowdash/dashboard_store.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
delete_dashboard(user_id, dashboard_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
Source code in src/panel_flowdash/dashboard_store.py
list_dashboards(user_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
load_dashboard(user_id, dashboard_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
rename_dashboard(user_id, dashboard_id, new_title)
¶
Source code in src/panel_flowdash/dashboard_store.py
save_dashboard(dashboard)
¶
Source code in src/panel_flowdash/dashboard_store.py
set_permission(dashboard_id, permission)
¶
Persist a new permission set on a dashboard. Returns success.
Source code in src/panel_flowdash/dashboard_store.py
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
Source code in src/panel_flowdash/dashboard_store.py
Identity
dataclass
¶
The resolved principal for a session.
Source code in src/panel_flowdash/auth.py
groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
oauth_user = None
class-attribute
instance-attribute
¶
system_user = None
class-attribute
instance-attribute
¶
user
instance-attribute
¶
user_info = field(default_factory=dict)
class-attribute
instance-attribute
¶
user_names
property
¶
All names this identity may be referenced by in a rule.
in_groups(groups)
¶
is_user(users)
¶
MemoryDashboardStore
¶
Bases: BaseDashboardStore
Dict-backed store for notebooks, scripts and tests.
Dashboards live for as long as the store does and are never written to disk. Models are deep-copied in and out so a caller mutating a dashboard it saved (or loaded) cannot retroactively change what is stored, matching how the SQLite store behaves.
Source code in src/panel_flowdash/dashboard_store.py
delete_dashboard(user_id, dashboard_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
rename_dashboard(user_id, dashboard_id, new_title)
¶
save_dashboard(dashboard)
¶
Source code in src/panel_flowdash/dashboard_store.py
set_permission(dashboard_id, permission)
¶
Permission
dataclass
¶
An allow/deny rule set evaluated against an :class:Identity.
All four fields match either the resolved user (OAuth login or system
user) or one of the identity's groups. An empty Permission declares
no constraints and defers entirely to the caller's default policy.
Source code in src/panel_flowdash/auth.py
allow_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
is_empty
property
¶
Whether the permission declares no allow or deny rules.
from_dict(data)
classmethod
¶
Deserialize from a (possibly None or partial) mapping.
Source code in src/panel_flowdash/auth.py
from_spec(*, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None)
classmethod
¶
Build a :class:Permission from loosely-typed iterables.
Source code in src/panel_flowdash/auth.py
to_dict()
¶
Serialize to sorted lists for JSON persistence.
Source code in src/panel_flowdash/auth.py
can_administer(identity, owner, admin_groups)
¶
Whether identity may administer a resource owned by owner.
When no admin_groups are configured administration is unrestricted: the running user (however resolved) may administer any resource. This keeps the default, auth-less deployment fully editable. Once admin_groups are set, only the owner and members of those groups may administer a resource.
Source code in src/panel_flowdash/auth.py
is_authorized(permission, identity, *, default_allow=True, owner=None)
¶
Evaluate permission against identity.
Order of precedence:
- A matching
deny_users/deny_groupsrule denies access (deny always wins, even for the owner). - The owner, if given and matching, is allowed.
- Any
allow_*rule present: allowed iff the identity matches at least one of them. - No allow/deny rules at all: fall back to default_allow.
Source code in src/panel_flowdash/auth.py
App Builder¶
panel_flowdash.app
¶
Application builder: scans a project directory and constructs the Panel app.
COMPONENTS_ROUTE = '/components'
module-attribute
¶
DASH_ROUTE_PREFIX = '/dash/'
module-attribute
¶
_COMPONENT_PALETTE_CARD_CSS = '\n:host {\n cursor: pointer;\n border-radius: 6px;\n transition: background-color 0.15s;\n}\n:host(:hover) {\n background-color: rgba(0, 114, 181, 0.08);\n}\n'
module-attribute
¶
_LAUNCHER_CARD_CSS = '\n:host {\n cursor: pointer;\n transition: box-shadow 0.2s;\n}\n:host(:hover) {\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n}\n:host .MuiCardContent-root {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n}\n'
module-attribute
¶
_LAUNCHER_DASH_CARD_CSS = '\n:host {\n cursor: pointer;\n transition: box-shadow 0.2s;\n overflow: visible;\n}\n:host(:hover) {\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n}\n:host .MuiCardContent-root {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n}\n'
module-attribute
¶
_LAUNCHER_NEW_CARD_CSS = '\n:host {\n cursor: pointer;\n transition: box-shadow 0.2s, border-color 0.2s;\n}\n:host .MuiPaper-root {\n border: 1px dashed var(--mui-palette-divider, rgba(0,0,0,0.23));\n box-shadow: none;\n background: transparent;\n}\n:host(:hover) .MuiPaper-root {\n border-color: var(--mui-palette-primary-main, #0072b5);\n}\n:host .MuiCardContent-root {\n display: flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n}\n'
module-attribute
¶
_LAUNCHER_SPEED_DIAL_CSS = '\n:host {\n position: absolute;\n top: 12px;\n right: 0px;\n z-index: 100;\n}\n:host .MuiSpeedDial-fab {\n width: 28px;\n height: 28px;\n min-height: unset;\n box-shadow: none;\n}\n'
module-attribute
¶
logger = logging.getLogger('panel_flowdash')
module-attribute
¶
AuthConfig
dataclass
¶
Project-level authorization configuration.
Loaded from the project's __init__.py by the serve command. All fields
are optional; the defaults reproduce the pre-auth behavior (allow by
default, groups read from the standard claim keys, no admin groups).
Source code in src/panel_flowdash/auth.py
admin_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
default_allow = True
class-attribute
instance-attribute
¶
group_claims = DEFAULT_GROUP_CLAIMS
class-attribute
instance-attribute
¶
resolve_groups = None
class-attribute
instance-attribute
¶
user_groups = field(default_factory=dict)
class-attribute
instance-attribute
¶
from_module(module)
classmethod
¶
Build an :class:AuthConfig from names on a project __init__.
Reads group_claims, user_groups, resolve_groups,
admin_groups and default_allow if present, falling back to the
defaults otherwise. Missing module or names yield a default config.
Source code in src/panel_flowdash/auth.py
DashboardModel
dataclass
¶
A persisted dashboard: nodes + edges + tile layout.
Source code in src/panel_flowdash/dashboard_store.py
breakpoints = field(default_factory=list)
class-attribute
instance-attribute
¶
dashboard_id
instance-attribute
¶
edges = field(default_factory=list)
class-attribute
instance-attribute
¶
items = field(default_factory=list)
class-attribute
instance-attribute
¶
owner
property
¶
The immutable owner principal (the creating user).
permission = field(default_factory=Permission)
class-attribute
instance-attribute
¶
responsive_layouts = field(default_factory=dict)
class-attribute
instance-attribute
¶
tile_layout = field(default_factory=list)
class-attribute
instance-attribute
¶
title
instance-attribute
¶
user_id
instance-attribute
¶
version = 3
class-attribute
instance-attribute
¶
from_dict(data)
classmethod
¶
Source code in src/panel_flowdash/dashboard_store.py
to_dict()
¶
Source code in src/panel_flowdash/dashboard_store.py
DashboardStore
¶
Bases: BaseDashboardStore
SQLite-backed store for dashboard models.
Source code in src/panel_flowdash/dashboard_store.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
delete_dashboard(user_id, dashboard_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
find_by_id_or_title(ref)
¶
Resolve a dashboard by its id first, then by title.
Titles are only unique per user, so a title match returns the most recently updated dashboard. Used to resolve the operator-configured home dashboard, which may be given as either an id or a title.
Source code in src/panel_flowdash/dashboard_store.py
list_dashboards(user_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
load_dashboard(user_id, dashboard_id)
¶
Source code in src/panel_flowdash/dashboard_store.py
rename_dashboard(user_id, dashboard_id, new_title)
¶
Source code in src/panel_flowdash/dashboard_store.py
save_dashboard(dashboard)
¶
Source code in src/panel_flowdash/dashboard_store.py
set_permission(dashboard_id, permission)
¶
Persist a new permission set on a dashboard. Returns success.
Source code in src/panel_flowdash/dashboard_store.py
title_exists(user_id, title, exclude_id=None)
¶
Check if a dashboard with the given title already exists for this user.
Source code in src/panel_flowdash/dashboard_store.py
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 |
None
|
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
Source code in src/panel_flowdash/editor.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | |
breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.')
class-attribute
instance-attribute
¶
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
¶
dashboard = param.ClassSelector(class_=DashboardModel, 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 DashboardModel 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
¶
editable = param.Boolean(default=True, doc='\n Whether the dashboard can be edited. When False the toolbar is hidden\n and the tile grid is shown locked, giving a pure view of the dashboard.')
class-attribute
instance-attribute
¶
graph
property
¶
The live dataflow graph wiring the placed components together.
layout
property
¶
The current tile layout, whether or not the grid is on screen.
mode = param.Selector(default='wiring', objects=['wiring', 'dashboard'], doc="\n Which workspace is shown: 'wiring' for the ReactFlow canvas, 'dashboard'\n for the tile grid.")
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
¶
preview = param.Boolean(default=False, doc="\n Preview the dashboard as an end user sees it without leaving edit mode.\n Only meaningful while `editable` and in 'dashboard' mode.")
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
¶
saved = param.Event(doc='Triggered after a dashboard is successfully saved.')
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_=BaseDashboardStore, 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
¶
toolbar = param.Boolean(default=True, doc='Whether to render the editor toolbar above the workspace.')
class-attribute
instance-attribute
¶
toolbar_extra = Children(default=[], doc='Additional items appended to the right of the toolbar.')
class-attribute
instance-attribute
¶
user = param.String(default='local', doc='Principal recorded as the owner of dashboards created here.')
class-attribute
instance-attribute
¶
add_component(component_id, config=None, position=None)
¶
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 |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The new instance's id, for use with |
Raises:
| Type | Description |
|---|---|
KeyError
|
If component_id is not a registered component. |
Source code in src/panel_flowdash/editor.py
clear()
¶
Remove every component and edge from the canvas.
Source code in src/panel_flowdash/editor.py
connect(source_id, source_port, target_id, target_port)
¶
Wire an output port to an input port.
Returns:
| Type | Description |
|---|---|
bool or str
|
|
Source code in src/panel_flowdash/editor.py
disconnect(source_id, source_port, target_id, target_port)
¶
Remove the edge between two ports.
Source code in src/panel_flowdash/editor.py
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
|
Source code in src/panel_flowdash/editor.py
ensure_components_loaded_async(component_ids=None)
async
¶
Async :meth:ensure_components_loaded, importing off the event loop.
Source code in src/panel_flowdash/editor.py
load(dashboard_id)
¶
Load a dashboard from the configured store, by id or title.
Source code in src/panel_flowdash/editor.py
load_model(model)
¶
Hydrate the canvas from a :class:DashboardModel.
Components the model references but this editor does not offer are skipped with a warning rather than aborting the load.
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.
Source code in src/panel_flowdash/editor.py
load_model_async(model)
async
¶
Async :meth:load_model, importing the model's components off the event loop.
Source code in src/panel_flowdash/editor.py
new_dashboard(title)
¶
Start a new empty dashboard, persisting it if a store is configured.
Source code in src/panel_flowdash/editor.py
remove_component(instance_id)
¶
Remove a placed component along with its edges and its tile.
Source code in src/panel_flowdash/editor.py
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.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :attr: |
Source code in src/panel_flowdash/editor.py
to_model(title=None)
¶
Serialize the current canvas into a :class:DashboardModel.
The returned model is detached from the editor, so this is the seam to use when persisting to something other than the configured store.
Source code in src/panel_flowdash/editor.py
FlowDashApp
¶
Bases: Viewer
FlowDash application: scans a project directory and serves its pages and components.
Source code in src/panel_flowdash/app.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 | |
auth_config = param.ClassSelector(class_=AuthConfig, doc='\n Project-level authorization configuration controlling group discovery,\n the admin groups and the default access policy.')
class-attribute
instance-attribute
¶
breakpoints = param.List(default=[768, 1200], doc='Responsive breakpoints for the tile grid.')
class-attribute
instance-attribute
¶
configure_layout = param.Callable(default=None, doc='\n Optional callback invoked on every navigation with\n (app, content, route). Use it to set `app.sidebar` and\n `app.contextbar` for the page currently being served.')
class-attribute
instance-attribute
¶
contextbar = Children(default=[], doc='Items prepended to the contextbar.')
class-attribute
instance-attribute
¶
contextbar_open = param.Boolean(default=False, doc='Whether the contextbar is open.')
class-attribute
instance-attribute
¶
home_dashboard = param.String(default=None, doc="\n Dashboard shown on the homepage ('/'). Accepts a dashboard id or\n title. When unset, the homepage shows the dashboard grid launcher.")
class-attribute
instance-attribute
¶
nav_variant = param.Selector(default='right', objects=['left', 'right', 'menubar'], doc="\n Where the navigation menu is rendered. 'left' and 'right' dock a\n MenuList in a drawer on that side of the page; 'menubar' places a\n MenuBar in the page header with quick-action icons alongside it.")
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
¶
page_options = param.Dict(default={}, doc="\n Extra keyword arguments passed through to the underlying\n `panel_material_ui.Page`, overriding the app's own defaults.")
class-attribute
instance-attribute
¶
project_dir = param.Path(doc='Path to the project directory.')
class-attribute
instance-attribute
¶
sidebar = Children(default=[], doc='Items prepended to the sidebar.')
class-attribute
instance-attribute
¶
store = param.ClassSelector(class_=DashboardStore, doc='DashboardStore instance for persistence.')
class-attribute
instance-attribute
¶
title = param.String(default='FlowDash', doc='Application title shown in the browser tab.')
class-attribute
instance-attribute
¶
build_routes(project_dir, registry=None, **params)
classmethod
¶
Generate route mapping for pn.serve.
Source code in src/panel_flowdash/app.py
Permission
dataclass
¶
An allow/deny rule set evaluated against an :class:Identity.
All four fields match either the resolved user (OAuth login or system
user) or one of the identity's groups. An empty Permission declares
no constraints and defers entirely to the caller's default policy.
Source code in src/panel_flowdash/auth.py
allow_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
allow_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_groups = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
deny_users = field(default_factory=frozenset)
class-attribute
instance-attribute
¶
is_empty
property
¶
Whether the permission declares no allow or deny rules.
from_dict(data)
classmethod
¶
Deserialize from a (possibly None or partial) mapping.
Source code in src/panel_flowdash/auth.py
from_spec(*, allow_users=None, allow_groups=None, deny_users=None, deny_groups=None)
classmethod
¶
Build a :class:Permission from loosely-typed iterables.
Source code in src/panel_flowdash/auth.py
to_dict()
¶
Serialize to sorted lists for JSON persistence.
Source code in src/panel_flowdash/auth.py
RegistryEntry
dataclass
¶
A registered component/page with its metadata.
Source code in src/panel_flowdash/registry.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
app = None
class-attribute
instance-attribute
¶
app_id
instance-attribute
¶
metadata
instance-attribute
¶
module_name
instance-attribute
¶
module_path = None
class-attribute
instance-attribute
¶
name
instance-attribute
¶
page_path
instance-attribute
¶
section
instance-attribute
¶
spec = field(default=None, repr=False, compare=False)
class-attribute
instance-attribute
¶
title
property
¶
Human-readable title.
from_app(app, *, app_id=None, section=None, name=None)
classmethod
¶
Build an entry from an already-imported app object.
Unlike :func:build_registry, which discovers modules on disk and defers
importing them, this wraps a live object so load() is a no-op. Used
by the programmatic API where components are passed in directly.
Objects without @register metadata are treated as components, since
a bare Viewer subclass handed to the editor is only ever meant to be
one.
Source code in src/panel_flowdash/registry.py
load()
¶
Import the module and return the app object.
Caches the result on self.app. Raises on import failure.
Source code in src/panel_flowdash/registry.py
_DASHBOARD_ACTION_TYPE
¶
build_registry(project_dir)
¶
Scan project_dir for page/component modules without importing them.
Reads each .py file with the AST to extract @register metadata.
Modules are not imported at this stage; each RegistryEntry.app is
None until RegistryEntry.load() is called.
Source code in src/panel_flowdash/registry.py
build_session_state_class(registry)
¶
Build a Parameterized subclass with one param per declared state key.
Scans the registry for all provides and requires keys and creates
a dynamic class whose parameters represent shared session state.
Source code in src/panel_flowdash/session_state.py
check_requirements(state, requires)
¶
Check which required keys are unsatisfied on the given state instance.
Returns a list of dicts describing each unsatisfied requirement. An empty list means all requirements are met.
Source code in src/panel_flowdash/session_state.py
is_authorized(permission, identity, *, default_allow=True, owner=None)
¶
Evaluate permission against identity.
Order of precedence:
- A matching
deny_users/deny_groupsrule denies access (deny always wins, even for the owner). - The owner, if given and matching, is allowed.
- Any
allow_*rule present: allowed iff the identity matches at least one of them. - No allow/deny rules at all: fall back to default_allow.
Source code in src/panel_flowdash/auth.py
notify(severity, message, *, duration=3000, enabled=True)
¶
Emit a Panel notification, falling back to the logger.
pn.state.notifications is None outside a served session (a plain
script, a test, or a notebook without the notifications extension), so
calling it unguarded raises. Embedders can also opt out entirely by passing
enabled=False.
Source code in src/panel_flowdash/util.py
panel_call(app, /, **kwargs)
¶
Call a component callable and return a renderable view of the result.
Sync callables are called immediately. Async ones must not be: calling them
here would only produce an un-awaited coroutine, which pn.panel wraps as
a string. Instead they are deferred to a zero-argument closure that Panel's
ParamFunction awaits (or iterates, for async generators) on the event
loop when the view is rendered.
Source code in src/panel_flowdash/util.py
panel_viewer(instance)
¶
Return a renderable view of a Viewer, awaiting an async __panel__.
pn.panel calls __panel__ synchronously, so an async def __panel__
would be wrapped un-awaited. ParamMethod handles both, and additionally
re-renders when the method declares param.depends.
Source code in src/panel_flowdash/util.py
resolve_identity(auth_config=None)
¶
Resolve the current session's :class:Identity.
Prefers the OAuth login (pn.state.user) when a real provider populated
it; otherwise falls back to the system user, then to "anonymous".
Groups are the union of claim-derived groups, the static user_groups
mapping and any dynamic resolve_groups callback.