Skip to content

Zenaura Version 0.15.0 Release Notes

This release focuses on making Zenaura more beginner-friendly with targeted improvements, simplifying development and enhancing usability.


Key Improvements

AsyncDispatcher

  • Simplified Event Management: Developers can now dispatch asynchronous events without needing deep knowledge of asyncio or coroutines.
  • Event-Driven Architecture: Introduced dispatcher.bind for hooking component callbacks to events (e.g., document, window, or element by ID):
    dispatcher.bind("counter", "click", counter.increment)
    
    This enables cleaner, more intuitive event management.

Simplified App Routing

  • Added a facade for app initialization. Developers now only need:
    app = App()
    app.run()
    
    No need to manually import or configure asyncio.

Improved Mutator Handling

  • Introduced @mutator for asynchronous callbacks (e.g., API fetching) and @mutates for regular Python callbacks:
@mutator
async def coroutine():
    pass

@mutates
def callback():
    pass

Streamlined Initialization

  • Reduced the number of required files and dependencies for Zenaura initialization.
  • Enhanced HTML tag support for cleaner, modern code.
  • Now you can include only init.py in config.json, and import all needed zenaura logic in there to be used within the browser.
{
    "type": "app",
    "schema_version": 1,
    "runtimes": [],
    "interpreters": [
        {
            "src": "https://cdn.jsdelivr.net/pyodide/dev/full/",
            "name": "pyodide-0.22.1",
            "lang": "python"
        }
    ],
    "packages": [
        "zenaura==0.15.19"
    ],
    "fetch": [
        {
            "files": [
                "./public/__init__.py" // here
            ]
        }
    ],
    "plugins": [],
    "pyscript": {
        "version": "2022.12.1.dev",
        "time": "2024-12-21T13:13:08.980141Z"
    }
}

Updated Example Code

Here's how these improvements simplify app setup:

from zenaura.client.app import Route, App
from zenaura.client.page import Page
from zenaura.client.component import Component
from zenaura.ui import div, h1, h2, img

class ZenauraStarter(Component):
    def render(self):
        return div(
            div(
                img(src="./public/logo.png", width=255, height=255, alt="starterLogo"),
                h1("The Python Framework For"),
                h2("Building Modern Web User Interface"),
            ),
            class_="zenaura"
        )

starter = ZenauraStarter()

# App and routing
app = App()
home_page = Page([starter])

app.add_route(Route(
    title="Developer-Focused | Zenaura",
    path="/",
    page=home_page
))

app.run()

Bug Fixes & Enhancements

  • Improved error handling for mutators and event dispatching.
  • Fixed app router issues and refined dispatcher logic for better stability.
  • General performance and reliability improvements.