Skip to main content

Dazzler

Build Documentation Status Version License

Dazzler is a hybrid UI framework for Python to create Desktop or Web Applications.

Built with Aiohttp, React and Electron.

Install

Install with pip: $ pip install dazzler

Features

  • Fast WebSocket based communication, deliver updates in realtime to thousands of connected clients at once.
  • Build desktop applications with Electron.
  • Support for third party integrations via middlewares.
  • Session & authentication systems.
  • Tie & Transform API to perform updates on the client side.

Quickstart

Quickstart with a GitHub template

Example

Create a page with a layout and assign bindings to save & load a visitor name with the session system. The button to save the visitor name is disabled if no input value via tie & transform.

from dazzler import Dazzler
from dazzler.system import Page, BindingContext, CallContext, transforms as t
from dazzler.components import core

app = Dazzler(__name__)
page = Page(
    __name__,
    core.Container([
        core.Html('H2', 'My dazzler page'),
        core.Container('Please enter a name', identity='visitor-name'),
        core.Input(value='', identity='input'),
        core.Button('Save name', identity='save-btn', disabled=True),
    ], identity='layout', id='layout'),
    title='My Page',
    url='/'
)

# UI updates via tie & transforms
page.tie('value@input', 'disabled@save-btn').transform(
    t.Length().t(t.Lesser(1))
)


# Bindings executes on the server via websockets.
@page.bind('clicks@save-btn')
async def on_click(context: BindingContext):
    # Save the visitor name via session system
    name = await context.get_aspect('input', 'value')
    await context.session.set('visitor', name)
    await context.set_aspect(
        'visitor-name', children=f'Saved {name}'
    )


# Aspects defined on the layout trigger on initial render and
# allows to insert initial data.
# `call` executes via regular requests.
@page.call('id@layout')
async def on_layout(context: CallContext):
    visitor = await context.session.get('visitor')
    if visitor:
        await context.set_aspect(
            'visitor-name', children=f'Welcome back {visitor}!'
        )


app.add_page(page)

if __name__ == '__main__':
    app.start()

Documentation

Full documentation hosted on readthedocs.

Get help for the command line tools: $ dazzler --help

Metadata

Release files for dazzler 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for dazzler 0.10.0
File Interpreter ABI Platform
dazzler-0.10.0-py3-none-any.whl Python 3 none any Details

Release files / dazzler-0.10.0-py3-none-any.whl

Download URL dazzler-0.10.0-py3-none-any.whl
Size 10.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
198549c7fde994cecae782781bf997a60ae163eb0d2448e2c2bef439599595f9
BLAKE2b-256 checksum
How to use checksums
36cbf5eeeec63560fec39b90961ec819a37c12ac5fcb7154e523c6dddc630539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page