Application tools¶
build
¶
Deterministic static app bundles and a production preview server.
Functions:
| Name | Description |
|---|---|
init_app |
Create a reviewable starter project without overwriting existing files. |
build_app |
Build source archives, explicit lazy chunks, and a pinned browser bootstrap. |
preview |
Serve a built app with its base path, client-route fallback, and cache policy. |
init_app
¶
init_app(directory: Path) -> None
Create a reviewable starter project without overwriting existing files.
build_app
¶
build_app(directory: Path, *, output: Path | None = None, base: str | None = None) -> dict[str, Any]
Build source archives, explicit lazy chunks, and a pinned browser bootstrap.
The output is replaced only after all inputs validate and a complete build succeeds. Existing output must contain Wybthon's build marker.
assets
¶
Explicit lazy application chunks produced by wyb build.
Functions:
| Name | Description |
|---|---|
load_chunk |
Fetch and mount a named production chunk, sharing concurrent requests. |
virtual
¶
Fixed-height list virtualization built on owned virtual DOM list regions.
Classes:
| Name | Description |
|---|---|
Virtualizer |
Reactive visible bounds and layout dimensions, all in CSS pixels. |
Functions:
| Name | Description |
|---|---|
create_virtualizer |
Calculate a fixed-size visible range without visiting collection items. |
VirtualFor |
Render only visible fixed-height rows inside a scrolling container. |
Virtualizer
dataclass
¶
Virtualizer(start: Accessor[int], stop: Accessor[int], offset: Accessor[float], total: Accessor[float])
Reactive visible bounds and layout dimensions, all in CSS pixels.
create_virtualizer
¶
create_virtualizer(count: Any, *, item_size: float, viewport_size: Any, scroll_offset: Any, overscan: int = 3) -> Virtualizer
Calculate a fixed-size visible range without visiting collection items.
VirtualFor
¶
VirtualFor(each: Any, children: Any, *, height: float, row_height: float, overscan: int = 3, keyed: Any = True, **props: Any) -> VNode
Render only visible fixed-height rows inside a scrolling container.
Offscreen rows are disposed. Keep durable item state in the source store. Callback index accessors refer to the full collection, not the window.
scheduling
¶
Cooperative CPU work that gives the browser opportunities to paint.
Functions:
| Name | Description |
|---|---|
yield_to_browser |
Yield through a timer task, allowing input and rendering between chunks. |
map_cooperative |
Map CPU work in bounded time slices; cancellation interrupts between slices. |
yield_to_browser
async
¶
Yield through a timer task, allowing input and rendering between chunks.
map_cooperative
async
¶
Map CPU work in bounded time slices; cancellation interrupts between slices.
A single callback must itself be short. The budget limits time between callbacks, and can't preempt a long Python function.
testing
¶
Small testing helpers that exercise the real scheduler and renderer.
Use an installed Python backend for native tests or the browser backend for Pyodide tests. The helpers never replace reactive primitives with mocks.
Functions:
| Name | Description |
|---|---|
reactive_scope |
Own test computations and dispose them deterministically at scope exit. |
render_test |
Render a fixture and release its tree, listeners, and temporary container. |
tick |
Drain ready asyncio continuations and flush reactive work. |
wait_for |
Wait for an observable condition, raising TimeoutError on failure. |
diagnostics
¶
Opt-in runtime counters and JSON-ready ownership graph inspection.
Profiling is disabled by default. Capture counters around a specific operation and compare work counts as well as elapsed time; these are application metrics, not cross-framework benchmark rankings.
Classes:
| Name | Description |
|---|---|
Profile |
Counters and elapsed seconds for a measured operation. |
Functions:
| Name | Description |
|---|---|
profile |
Capture work performed in this scope, including explicit flush calls. |
inspect_graph |
Inspect ownership and dependencies without evaluating or retaining values. |
runtime_stats |
Return live scheduler and backend registry counts. |