A lightweight and reactive Python framework for creating dynamic web applications with a simple and intuitive API. Combine Python's simplicity with the reactivity of modern frontend frameworks.
Create dynamic interfaces that automatically update when data changes, without the need for complex JavaScript.
Build reusable components for consistent interfaces and simplified code maintenance.
See changes instantly during development without manually reloading the page.
Query and modify elements with familiar selectors, all using pure Python.
Handle user interactions with Python event handlers in a simple and efficient way.
Real-time communication between client and server with native WebSocket support.
With pyweber, you can create reactive web applications using only Python. No need for complex JavaScript or complicated configurations.
import pyweber as pw
app = pw.Pyweber()
class Home(pw.Template):
def __init__(self):
super().__init__(template='', title='Starting App')
self.body = self.queryselector('body')
self.body.childs = [
pw.Element(
tag='button',
content='+',
events=pw.TemplateEvents(onclick=self.add)
),
pw.Element(
tag='p',
content=0,
style={'width': 'fit-content'}
),
pw.Element(
tag='button',
content='-',
events=pw.TemplateEvents(onclick=self.remove)
)
]
self.body.style = {
'display': 'flex',
'justify-content': 'center',
'align-items': 'center',
'column-gap': '4px'
}
def add(self, e: pw.EventHandler):
e.parent.childs[1].content = int(e.parent.childs[1].content) + 1
e.update()
def remove(self, e: pw.EventHandler):
e.parent.childs[1].content = int(e.parent.childs[1].content) - 1
e.update()
@app.route('/')
def home():
return Home()
if __name__ == '__main__':
pw.run()
Start using pyweber in seconds: