Frontage
A Python frontend framework for the browser.
Reactive components, an SPA router and two-way data binding, running on PyScript over WebAssembly. No JavaScript, no Node, no bundler. You write Python and the browser runs it.
from frontage import Application, Page, t
app = Application()
@app.page()
class Hello(Page):
def initial(self):
return dict(name="")
def populate(self):
with t.div(classes="container"):
t.h1("Welcome to Frontage")
if self.state["name"]:
t.p(f"Hello there, {self.state['name']}")
else:
t.p("Why don't you tell me your name?")
t.input(placeholder="Enter your name", bind="name")
app.mount("#app")
What you get
- ReactivityChange a component's state and the DOM updates. Redraws are diffed with morphdom.
- ComponentsProps, slots and events in the style of Vue. Each component is one Python class.
- RoutingA hash or history router for single-page apps, with navigation guards.
- Your runtimeFull CPython via Pyodide, or MicroPython when a small download matters more.
- No build stepServe the files. That is the whole deployment.
- Open sourceApache 2.0, maintained by Optersoft.
See it run
The tutorial examples run live on this site, straight from the same files the documentation walks through. Start with Hello, World and end with a full app.
Install
Frontage is a client-side library: installing it means telling PyScript where the wheel is. The documentation walks through a first project.
pip download frontage --no-deps --dest .