pihanga-remote
Drive a Pihanga card UI from Python.
The package contains:
- a prebuilt browser bundle: the lean runtime plus the
@pihanga2/shadcncards; - typed pydantic classes for every card (
pihanga_remote.cards.shadcn); - a FastAPI server that serves the bundle and keeps each browser tab in sync over a WebSocket, using JSON Patch.
You don't need any JavaScript tooling to use it.
from pihanga_remote import create_app
from pihanga_remote.cards.shadcn import SdFramework, Stack, Typography, Button
def build(s): # called once per browser tab
count = Typography(text="0", level="h2")
def inc(ev):
count.text = str(int(count.text) + 1) # mutate the card; the browser is patched
s.window(SdFramework(page=Stack(direction="column",
content=[count, Button(label="+", on_clicked=inc)])))
app = create_app(build) # python -m uvicorn mymodule:app
See the project README for the protocol, the design, and how to build an app.
Metadata
Release files for pihanga-remote 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pihanga_remote-0.1.1.tar.gz | 542.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pihanga_remote-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / pihanga_remote-0.1.1.tar.gz
| Download URL | pihanga_remote-0.1.1.tar.gz |
|---|---|
| Size | 542.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bf6290c187ce318abfe1fa28362af1f43e86b8cca9e808f4f1dc69f3db41334
|
|
BLAKE2b-256 checksum How to use checksums |
35129a13833b961da523de6e0d53261a4f30dab7e753dd306c798a1aea853156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/24.6.0
|
Release files / pihanga_remote-0.1.1-py3-none-any.whl
| Download URL | pihanga_remote-0.1.1-py3-none-any.whl |
|---|---|
| Size | 553.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8f275ff1a7d78930345c9ed0c132c82399cf3a3e7e215f292625a9125ea654e
|
|
BLAKE2b-256 checksum How to use checksums |
b2f0c5cf22e7086c461fa216545e4278024a5be2e00b1e6432a3f5bbcc92ef30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/24.6.0
|