circuits

Lightweight Event driven and Asynchronous Application Framework

circuits is a Lightweight Event driven and Asynchronous Application Framework for the Python Programming Language with a strong Component Architecture.

circuits also includes a lightweight, high performance and scalable HTTP/WSGI compliant web server and framework (circuits.web) as well as various I/O and Networking components.

To take full advantage of circuits and its architecture, circuits encourages you to design your application in terms of loosely coupled components. Circuits has a very powerful message passing system that enables components to interact with each other via events. Applications written this way tend to be more maintainable, easier to develop and scale to complex systems.

circuits' Loosely Coupled Component Architecture allows for a high level of Reuse and Scalability. Simpler components can be combined together to form Complex Components and provide higher level functionality and abstraction. Much of the circuits component library is designed and built this way.

$ pip install circuits

circuits is licensed under the MIT License

Please Donate to the project if you can!


Echo Server

Echo Server

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/usr/bin/env python

from circuits.net.sockets import TCPServer

class EchoServer(TCPServer):
def read(self, sock, data): return data
EchoServer(8000).run()
Web Server

Web Server

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/usr/bin/env python

from circuits.web import Server, Controller, Logger

class Root(Controller):
def index(self): return "Hello World!"
(Server(("0.0.0.0", 8000)) + Root() + Logger()).run()