Questions tagged [circuits-framework]

Python circuits Application Framework with an Event-driven and Component Architecture.

Asynchronous Component based Event 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 as well as various I/O and Networking components.

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.

Echo Server

#!/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

#!/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()

See PyPi Page, Website and Github Repo

12 questions
3
votes
1 answer

Python circuits joining channels

I have a scenario where I am using the python circuits framework to dynamically create new components which have their own channel. I would like to be notified when ALL of the created channels have fired a particular event. I have tried using the…
H0R5E
  • 65
  • 6
2
votes
2 answers

How should I fetch other URLs from within the circuits framework?

How should I fetch multiple URLs from within a method in a Circuits framework Controller in Python 3? Here's a trivial example of what I want except with urllib3. It would be preferable to request both URLs at the beginning and when they both are…
2
votes
0 answers

How to store persistent data when using TCP socket connection?

I am developing a network application using circuits-framework and Python 2.7. I make my own TCP server based on TCPServer class. And I'd like to know how to store some persistent info such as user login data when using TCP socket connection? class…
ZHAO Peng
  • 31
  • 4
2
votes
1 answer

How to use threads with python circuits

I've recently discovered the Circuits framework to build asynchronous apps in python. I am building an event driven application and this framework seems a good fit for my needs. The framework is based on the idea of Components which react when an…
1
vote
0 answers

Is defining singleton possible in the python circuits component

is it defining a singleton in the circuits is simple like this? I dont know the potential impact, are there any risks implement the singleton in this way? class Singleton(Component): __instance = None def __new__(cls): if cls.__instance is…
1
vote
1 answer

how python circuits components loading process works

python circuits is a great framework, I am not familiar with its component loading machanism apart from loads from the /site-data folder for installed python modules through pip, I guess thats where the PYTHONPATH is set is it loads from else…
Junchen Liu
  • 5,435
  • 10
  • 51
  • 62
1
vote
1 answer

How do I get POST data in circuits (Python)?

I instantiate and register WebManager as part of my app. I'm running a workflow and web app together. Everything works find, except for getting POST data. class WebSite(Controller): def index(self): return "Hello World!" def…
Joe
  • 2,407
  • 18
  • 20
1
vote
0 answers

How can I make a worker reentrant?

How can I call a worker from a worker? This seems to be a simple representation of the puzzle I'm trying to solve: import time from circuits import BaseComponent, Worker, Debugger, task, handler class App(BaseComponent): def factorial(self,…
1
vote
1 answer

How do I use the generate_events event?

The following python3 code is what I might have expected to generate a few calls to the doit event, followed by a call to the terminate event, which would stop the app, but only the first event fires. What am I doing wrong? from circuits import…
1
vote
1 answer

Add/Change channel for handler at runtime

In circuits 3.1.0, is there a way to set at runtime the channel for a handler? An useful alternative would be to add a handler at runtime and specify the channel. I've checked the Manager.addHandler implementation but couldn't make it work. I…
Matias SM
  • 364
  • 3
  • 7
1
vote
1 answer

Delay/Suspend+Resume event (handling) in Python Circuits framework

In my project I use a Worker to do some event related file processing and avoid blocking the handling of other events. What I need is to be able to put the event (that requires the file processing) in stand by (no further handling by other…
Matias SM
  • 364
  • 3
  • 7
0
votes
0 answers

Circuits v3.2 Manager.py **events.effects** Issue

Has anyone noticed errors or event.effect errors when using Version 3.2 of Circuits? I've received the message: Apr 15 03:48:05 **** resilient-circuits[11462]: event.effects -= 1 Apr 15 03:48:05 **** resilient-circuits[11462]: *AttributeError:…
arollie
  • 9
  • 1