Skip to main content

pihanga-remote

Drive a Pihanga card UI from Python.

The package contains:

  • a prebuilt browser bundle: the lean runtime plus the @pihanga2/shadcn cards;
  • 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pihanga-remote 0.1.0
File Size Uploaded
pihanga_remote-0.1.0.tar.gz 541.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pihanga-remote 0.1.0
File Interpreter ABI Platform
pihanga_remote-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / pihanga_remote-0.1.0.tar.gz

Download URL pihanga_remote-0.1.0.tar.gz
Size 541.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8c9c6f08abdf0bb3702d49ad8c293c61be46519cd43fc94ed90a72fabc8cf278
BLAKE2b-256 checksum
How to use checksums
0c9e0f6320c4e4298050dc91351d1478fd3ac1af44e0d9ad22e432086f5eb05a
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.0-py3-none-any.whl

Download URL pihanga_remote-0.1.0-py3-none-any.whl
Size 553.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbfb98cd9e65f1519e0618baac05d0f11d98d6341a84bd9a8678e2adf784aa47
BLAKE2b-256 checksum
How to use checksums
de1c8320648c94d13edc386358c2fc1339a1df19cc91c2d3b820f16025f93811
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 history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page