Skip to main content

Python SDK for building Plexi apps via the PGAP v3 protocol

Reason this release was yanked:

Version number changing

Project description

plexi-sdk

Python SDK for building Plexi apps via the PGAP v3 protocol.

Full API reference: plexi_sdk/__init__.py docstring.


Keyboard Conventions

Apps should follow these standard navigation bindings so users get consistent behavior across all Plexi apps.

Key name strings

Keys arrive in on_key(ctx, key, mods) as lowercase canonical strings:

Physical key key string
Enter / Return "return"
Escape "escape"
Backspace "backspace"
Tab "tab"
Space "space"
Arrow keys "up" / "down" / "left" / "right"

The SDK normalizes egui's internal key names automatically. Always match against the lowercase canonical strings — key == "return", not key == "Enter".

Focus / modal conventions

Action Key
Open item / confirm / select "return"
Exit focused view / go back "escape"
Exit focused view (fallback) "backspace" (optional second binding)

Any view that opens a focused sub-view (detail panel, modal, inline editor) must let the user exit with "escape". No view should be a dead end.

TextInput exception: "return" fires on_text_submitted, so the TextInput widget owns that key while focused. "escape" should still dismiss the surrounding view or cancel the input mode.

def on_key(self, ctx, key, mods):
    if self.detail_open:
        if key in ("escape", "backspace"):
            self.detail_open = False
            return
        if key == "return":
            self._confirm()
            return
    # list navigation below

List navigation

Standard bindings for any scrollable list:

Key Action
j / "down" Move selection down
k / "up" Move selection up
"return" Open selected item
"escape" Exit list / go back

List + Detail Views

For any app with a list-and-detail pattern, prefer SelectList from plexi_sdk.ui over managing selection state manually. It handles j/k/arrow navigation, scroll-to-keep-selected-visible, and click hit-testing.

from plexi_sdk import App
from plexi_sdk.ui import SelectList, Column

class MyApp(App):
    async def on_init(self, ctx):
        self.items = [{"name": "Alpha"}, {"name": "Beta"}, {"name": "Gamma"}]
        self.list = SelectList(self.items)  # stateful — create once, not per frame
        self.detail_open = False

    def on_key(self, ctx, key, mods):
        if self.detail_open:
            if key in ("escape", "backspace"):
                self.detail_open = False
            return
        if key == "return":
            self.detail_open = True
            return
        self.list.handle_key(key)  # handles j/k/up/down

    def on_render(self, ctx):
        if self.detail_open:
            ctx.text(20, 40, self.items[self.list.selected_idx]["name"])
        else:
            ctx.draw(Column([self.list.render(self.items)]))

SelectList is stateful — create it in on_init, not on_render.

For the lower-level ctx.list_view() primitive (draw only, no state) see the ListItem shape in the API reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plexi_sdk-0.4.0.tar.gz (84.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plexi_sdk-0.4.0-py3-none-any.whl (94.3 kB view details)

Uploaded Python 3

File details

Details for the file plexi_sdk-0.4.0.tar.gz.

File metadata

  • Download URL: plexi_sdk-0.4.0.tar.gz
  • Upload date:
  • Size: 84.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for plexi_sdk-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9bc4ba19798e200b5304d9e7c54bd66f0efa6044b2a918be9468d5c39242fdab
MD5 3c883c5db3027e375ca50260cc3cc76e
BLAKE2b-256 9ed2653709a2d421fcee9b2a72c8df42394f51327434ab81b2b1341e291f0973

See more details on using hashes here.

File details

Details for the file plexi_sdk-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: plexi_sdk-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 94.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for plexi_sdk-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 342463b8988a3d71b7fb3219a9155afd22d2fddbf89ecbd3b75e2eddbb794aa4
MD5 bab06ec77184872036d9400501bef4e7
BLAKE2b-256 9d7a0a31037f8db7dd5b1b5d75c470a03f99fabc73eea3e1bdacc981a3f3c9a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page