Python SDK for building Plexi apps via the PGAP v3 protocol
Project description
plexi-sdk
Python SDK v2 for building Plexi PGAP apps.
SDK v2 is the Python authoring API. PGAP v3 (pgap/3) is the host/app wire protocol the SDK speaks.
Full API reference: plexi_sdk/__init__.py and docs/sdk-v2.md.
Install For SDK Development
uv pip install -e ./sdk/python
Run from the repo root. uv creates .venv automatically if needed. Changes to sdk/python/plexi_sdk/ take effect immediately in that environment.
Apps running inside Plexi use the SDK copy injected by the host on PYTHONPATH; the editable install is for type checking, tests, and local development.
Verify the install:
source .venv/bin/activate
python3 -c "from plexi_sdk import App; print('ok')"
App Pattern
Normal apps implement view() and return a component tree:
from plexi_sdk import App
from plexi_sdk.ui import AppBar, Column, FooterKeys, Label, Spacer
class CounterApp(App):
def on_init(self) -> None:
self.count = self.state.get("count", 0)
def view(self):
return Column([
AppBar("Counter"),
Spacer(grow=True),
Label(str(self.count), bold=True),
Spacer(grow=True),
FooterKeys([("+", "increment"), ("-", "decrement")]),
])
def on_key(self, key: str, mods: dict) -> None:
if key in ("plus", "equals"):
self.count += 1
elif key == "minus":
self.count -= 1
self.state.save({"count": self.count})
self.emit.schedule_render()
CounterApp().run()
Use on_render(ctx) only for games, animations, realtime visualizations, or other pixel-control apps.
Keyboard Conventions
Keys arrive in on_key(self, 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" |
Use "return", not "Enter". Use "escape", not "Escape".
Common list bindings:
| Key | Action |
|---|---|
j / "down" |
Move selection down |
k / "up" |
Move selection up |
"return" |
Open selected item |
"escape" |
Exit list or go back |
State And Host I/O
self.state.get("key", default)
self.state.save({"key": value})
self.emit.schedule_render()
await self.emit.http_get(url)
await self.emit.secret_get("API_KEY")
await self.emit.ai_query("low", system, messages)
Declare capabilities in manifest.toml before using brokered host powers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plexi_sdk-0.1.5.tar.gz.
File metadata
- Download URL: plexi_sdk-0.1.5.tar.gz
- Upload date:
- Size: 98.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ddce5fe75a0e61ddc780669b6f6d252107500f0d09b9e08dfb369609f8474e
|
|
| MD5 |
03600e737972c76d4272be58c48174f1
|
|
| BLAKE2b-256 |
b6fcbe6a25d52d55c6251fc69e4d0c550c5222658cd6609dec0df42b0fedb1bf
|
File details
Details for the file plexi_sdk-0.1.5-py3-none-any.whl.
File metadata
- Download URL: plexi_sdk-0.1.5-py3-none-any.whl
- Upload date:
- Size: 108.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed87826e8165791551e8f0dfabe7e769517ccae1ed18986bc0bdb493a5f600ad
|
|
| MD5 |
109a39ff4419d33847f0aa781e65592f
|
|
| BLAKE2b-256 |
436ff4a810f50f7135c3927e03918a404f1851adef0ddc32302019e410ca1be7
|