Server side rendered, reactive web applications in python.
Project description
rxxxt (R-3-X-T)
Server side rendered, reactive web applications in python.
1 dependency (pydantic).
Documentation
- App - the app
- Elements - creating html elements
- Component - defining components
- State - how state works
Installation
pip install rxxxt
If you want to run the application, you will have to install an ASGI web server like uvicorn as well:
pip install rxxxt uvicorn
Usage
from rxxxt import Component, event_handler, El, Element, App, local_state
import uvicorn
class Counter(Component):
count = local_state(int)
@event_handler()
def on_click(self): self.count += 1
def render(self) -> Element:
return El.div(onclick=self.on_click, content=[f"Count: {self.count}"])
app = App(Counter)
uvicorn.run(app)
Usage with FastAPI
from fastapi import FastAPI, Response
import uvicorn
from rxxxt import local_state, Component, event_handler, El, Element, App, PageBuilder, VEl
class Counter(Component):
count = local_state(int)
@event_handler()
def on_click(self): self.count += 1
def render(self) -> Element:
return El.div(onclick=self.on_click, content=[f"Count: {self.count}"])
server = FastAPI()
@server.get("/main.css")
def get_css(): return Response("body { margin: 0; font-family: sans-serif; }", media_type="text/css")
page_builder = PageBuilder()
page_builder.add_header(VEl.link(rel="stylesheet", href="/main.css"))
app = App(Counter, page_factory=page_builder)
server.mount("/", app)
uvicorn.run(server)
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
rxxxt-0.2.4.tar.gz
(25.9 kB
view details)
File details
Details for the file rxxxt-0.2.4.tar.gz
.
File metadata
- Download URL: rxxxt-0.2.4.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1ba7ac0a7c8bf07d0c734dd2fd297a5c449eb5a1a3fefd4c3e71413d6e11c1a8
|
|
MD5 |
0809270823c485bce5d04c0c13923795
|
|
BLAKE2b-256 |
2d79dc948318d9956670cb49d5040106c0e5ef68a5bcc0b49bf35d411a0a184d
|
Provenance
The following attestation bundles were made for rxxxt-0.2.4.tar.gz
:
Publisher:
release.yml
on leopf/rxxxt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
rxxxt-0.2.4.tar.gz
-
Subject digest:
1ba7ac0a7c8bf07d0c734dd2fd297a5c449eb5a1a3fefd4c3e71413d6e11c1a8
- Sigstore transparency entry: 189505683
- Sigstore integration time:
-
Permalink:
leopf/rxxxt@2e3dbe402a621015bfcfa214d77053efb69877ce
-
Branch / Tag:
refs/heads/master
- Owner: https://github.com/leopf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yml@2e3dbe402a621015bfcfa214d77053efb69877ce
-
Trigger Event:
workflow_dispatch
-
Statement type: