Metadata-Version: 2.4
Name: glimpse-applet-sdk
Version: 0.1.0
Summary: Typed async framework for Glimpse exec applets
Keywords: glimpse,applet,panel,desktop,sdk
Author: Alex Oleshkevich
Author-email: Alex Oleshkevich <alex.oleshkevich@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Desktop Environment
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.14
Project-URL: Homepage, https://alex-oleshkevich.github.io/glimpse/
Project-URL: Documentation, https://alex-oleshkevich.github.io/glimpse/applets/exec-sdk
Project-URL: Repository, https://github.com/alex-oleshkevich/glimpse
Project-URL: Issues, https://github.com/alex-oleshkevich/glimpse/issues
Description-Content-Type: text/markdown

# Glimpse Applet Python SDK

Small async framework for building Glimpse `exec` applets without touching stdio or raw JSON.

## Goals

- typed protocol models
- typed widget builders
- async runtime
- decorator-based callbacks
- state-driven rendering via `await self.set_state(...)`

## Example

```python
from dataclasses import dataclass, field

from glimpse_sdk import (
    Applet,
    AppletState,
    Box,
    Button,
    Hero,
    Icon,
    InputEvent,
    Label,
    RenderResult,
    StatusItem,
    click,
    input,
)


@dataclass
class DeployState(AppletState):
    version: str = "2026.04.07"
    status: str = "Ready"


class DeployApplet(Applet[DeployState]):
    def initial_state(self) -> DeployState:
        return DeployState()

    async def render(self) -> RenderResult:
        return RenderResult(
            status=[
                StatusItem(
                    id="deploy",
                    icon=Icon.name("software-update-available-symbolic"),
                    label=self.state.status,
                )
            ],
            hero=Hero(
                icon=Icon.name("software-update-available-symbolic"),
                title="Deploy",
                subtitle=self.state.version,
            ),
            tree=Box.vertical(
                [
                    Label("Version"),
                    Button(id="deploy_now", label="Deploy now"),
                ]
            ),
        )

    @click("deploy_now")
    async def on_deploy(self, _event) -> None:
        await self.set_state(status="Deploying")


if __name__ == "__main__":
    DeployApplet().run()
```
