Reference
Every public symbol in Weaverlet 0.3.1. Pages are organized by module; signatures are extracted from the actual source so they're guaranteed accurate.
Importing
The entire public API is re-exported from the top-level weaverlet package:
from weaverlet import (
# Core
WeaverletComponent, WeaverletApp, Identifier,
# Routing
SimpleRouterComponent, AuthRouterComponent, RedirectComponent,
# Signals
SignalComponent, DivSignalComponent, StoreComponent, StoreComponentOp,
SignalInput, SignalOutput, SignalTrigger, SignalState, SignalGroup,
ServersideSignalOutput, Serverside,
# Utilities
EmptyLayoutComponent, RouterComponent,
ComponentsDict, ComponentsList, ComponentsOrderedDict,
DetachedComponentRef,
# Exceptions
WeaverletException,
)
The legacy submodule paths (weaverlet.base, weaverlet.components) still work; the names below are also importable from them.
__version__: str # = "0.3.1"
By topic
Core
WeaverletComponent. The abstract base class for every UI block.WeaverletApp. The orchestrator that walks the DAG and produces a Dash app.Identifier. Descriptor that yields unique Dash IDs per instance.
Routing
SimpleRouterComponent. Basic path-based routing with optionalkeep_mounted.AuthRouterComponent. Session-protected routing.RedirectComponent. Client-side navigation primitive.
Signals
SignalComponent. The typed event bus.DivSignalComponent.SignalComponentvariant backed by anhtml.Div.StoreComponent. Shared mutable state with explicit STORE/MERGE/CLEAN ops.- Signal adapters.
SignalInput,SignalOutput,SignalTrigger,SignalState,SignalGroup,ServersideSignalOutput,Serverside.
Utilities
EmptyLayoutComponent. Minimal layout placeholder.DetachedComponentRef. Cycle-breaking reference wrapper.RouterComponent. Marker base class for routers.- Component collection ABCs.
ComponentsDict,ComponentsList,ComponentsOrderedDict.
Exceptions
WeaverletException. Base exception for all Weaverlet-raised errors.
Marker classes and ABCs
RouterComponent
class RouterComponent(WeaverletComponent):
"""Marker base class — subclasses are routers."""
def __init__(self, name: str = "unnamed") -> None: ...
Used by Weaverlet internally for isinstance checks. Subclass it when you build a custom router (so other code can identify routers regardless of which subclass they are). Both SimpleRouterComponent and AuthRouterComponent extend it.
Component collection ABCs
When your component owns a collection of children (a dict of pages, a list of widgets), wrap them in one of the three collection ABCs so the DAG walker can find them via get_components():
class ComponentsDict(dict, ABC):
@abstractmethod
def get_components(self): ...
class ComponentsList(list, ABC):
@abstractmethod
def get_components(self): ...
class ComponentsOrderedDict(OrderedDict, ABC):
@abstractmethod
def get_components(self): ...
Each subclass must implement get_components() returning an iterable of WeaverletComponent instances. Both SimpleRouterComponent and AuthRouterComponent internally use ComponentsDict subclasses (SimpleRoutes and AuthRoutes) for their routes dicts.
Example. A list of tab pages exposed to the DAG walker:
from weaverlet import WeaverletComponent, ComponentsList
class TabsList(ComponentsList):
def get_components(self):
return list(self)
class TabsBar(WeaverletComponent):
def __init__(self):
super().__init__()
self.tabs = TabsList([HomeTab(), AboutTab(), SettingsTab()])
def get_layout(self):
return html.Div([tab() for tab in self.tabs])
Constants
DEFAULT_COMPONENT_NAME: str = "unnamed": the default value of thename=kwarg on every component.
Source
Reading the actual source is sometimes the fastest way to understand a corner case. The relevant files live at:
weaverlet/__init__.py. Re-export surface, version.weaverlet/base.py.WeaverletComponent,WeaverletApp,Identifier, signal adapters.weaverlet/components/. Routers, signals, store, redirect, empty layout.