Pyweber Framework

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.

Key Features

Reactive Templates

Create dynamic interfaces that automatically update when data changes, without the need for complex JavaScript.

Component-Based Architecture

Build reusable components for consistent interfaces and simplified code maintenance.

Integrated Hot Reload

See changes instantly during development without manually reloading the page.

Intuitive DOM Manipulation

Query and modify elements with familiar selectors, all using pure Python.

Event-Driven Programming

Handle user interactions with Python event handlers in a simple and efficient way.

WebSocket Integration

Real-time communication between client and server with native WebSocket support.

Simple and Powerful

With pyweber, you can create reactive web applications using only Python. No need for complex JavaScript or complicated configurations.

  • Familiar Python syntax
  • Integrated HTML templates
  • Asynchronous events
  • Automatic routing
                        
                            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()
                        
                    

Quick Installation

Start using pyweber in seconds:

pip install pyweber