473,287 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Event-driven framework (other than Twisted)?

Are there any python event driven frameworks other than twisted?
Oct 1 '08 #1
15 3730
On Wed, 01 Oct 2008 01:01:41 -0700, Phillip B Oldham wrote:
Are there any python event driven frameworks other than twisted?
Most GUI package use event-driven model (e.g. Tkinter).

Oct 1 '08 #2
On Oct 1, 9:25*am, Lie Ryan <lie.1...@gmail.comwrote:
Most GUI package use event-driven model (e.g. Tkinter).
I've noticed that. I'm thinking more for a web environment (instead of
MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm
looking for alternatives.
Oct 1 '08 #3
Phillip B Oldham schrieb:
On Oct 1, 9:25 am, Lie Ryan <lie.1...@gmail.comwrote:
>Most GUI package use event-driven model (e.g. Tkinter).

I've noticed that. I'm thinking more for a web environment (instead of
MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm
looking for alternatives.
Please explain what you want to do. Maybe the spread toolkit
can help you:

http://www.spread.org/index.html

HTH,
Thomas
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
Oct 1 '08 #4
On Oct 1, 4:12*pm, Thomas Guettler <h...@tbz-pariv.dewrote:
Please explain what you want to do.
I'm primarily looking for alternatives to MVC frameworks for web
development, particularly SAAS. I've looked around, and some
whitepapers suggest that event-based frameworks often perform better
than MVC. Since I'm looking at SAAS, having a "view" is pretty
pointless since I'll either be using Thrift, returning simple HTTP
headers, or returning some sort of JSON/YAML/XML content (possibly
based on accept headers).
Oct 1 '08 #5
Phillip B Oldham a écrit :
On Oct 1, 4:12 pm, Thomas Guettler <h...@tbz-pariv.dewrote:
>Please explain what you want to do.

I'm primarily looking for alternatives to MVC frameworks for web
development, particularly SAAS. I've looked around, and some
whitepapers suggest that event-based frameworks often perform better
than MVC. Since I'm looking at SAAS, having a "view" is pretty
pointless since I'll either be using Thrift, returning simple HTTP
headers, or returning some sort of JSON/YAML/XML content (possibly
based on accept headers).
"view" doesn't imply (x)html - any valid HTTP response is ok. The whole
point of decoupling controler from view (in web MVC) is to allow the
same controler to return different views.
Oct 1 '08 #6
On Wed, 01 Oct 2008 18:09:20 +0200, Bruno Desthuilliers wrote:
Phillip B Oldham a écrit :
>On Oct 1, 4:12 pm, Thomas Guettler <h...@tbz-pariv.dewrote:
>>Please explain what you want to do.

I'm primarily looking for alternatives to MVC frameworks for web
development, particularly SAAS. I've looked around, and some
whitepapers suggest that event-based frameworks often perform better
than MVC. Since I'm looking at SAAS, having a "view" is pretty
pointless since I'll either be using Thrift, returning simple HTTP
headers, or returning some sort of JSON/YAML/XML content (possibly
based on accept headers).

"view" doesn't imply (x)html - any valid HTTP response is ok. The whole
point of decoupling controler from view (in web MVC) is to allow the
same controler to return different views.
In fact, MVC and event-driven is two entirely different concept. You can
have both, or none. It is, in the end, your choice which one to use or
whether you want to use both or none.

Event-driven programming is a concept that your programs are entirely
composed of function definition and binding that function definition to
events. The rest is handled by a mainloop, which calls the appropriate
functions when it receives something.

MVC is a separation of concern. In MVC code you want that there is a
clear boundary between code that handles Model, View, and Controller, so
it'd be easier to manage the code.

Oct 1 '08 #7
You could take a look at this interesting looking server that popped up
on the mailing list a while back:

http://code.google.com/p/yield/

On Wed, 2008-10-01 at 01:01 -0700, Phillip B Oldham wrote:
Are there any python event driven frameworks other than twisted?
--
http://mail.python.org/mailman/listinfo/python-list
--
John Krukoff <jk******@ltgc.com>
Land Title Guarantee Company

Oct 1 '08 #8
On Oct 1, 6:53*pm, Lie Ryan <lie.1...@gmail.comwrote:
In fact, MVC and event-driven is two entirely different concept. You can
have both, or none. It is, in the end, your choice which one to use or
whether you want to use both or none.

Event-driven programming is a concept that your programs are entirely
composed of function definition and binding that function definition to
events. The rest is handled by a mainloop, which calls the appropriate
functions when it receives something.

MVC is a separation of concern. In MVC code you want that there is a
clear boundary between code that handles Model, View, and Controller, so
it'd be easier to manage the code.
So are there any other patterns that can be used in stead of MVC?
Oct 1 '08 #9
On Wed, Oct 1, 2008 at 6:01 PM, Phillip B Oldham
<ph************@gmail.comwrote:
Are there any python event driven frameworks other than twisted?
Phillip, I have been developing a rather unique
event-driven and component architecture library
for quite some time that is (not twisted). Actually
it's nothing like twisted, but based on 2 core
concepts:
* Everything is a Component
* Everything is an Event

It's currently called pymills.event
Let me know if you're interested, I probably
plan to re-package and re-branch this library
(the event library) at some point.

Here's a small snippet showing off some of
pymills.event's features:

<code>
#!/usr/bin/env python
# -*- coding: utf-8 -*- # vim: set sw=3 sts=3 ts=3

from pymills import event
from pymills.event import *

class TodoList(Component):

todos = {}

def add(self, name, description):
assert name not in self.todos, "To-do already in list"
self.todos[name] = description
self.push(Event(name, description), "added")

class TodoPrinter(Component):

@listener("added")
def onADDED(self, name, description):
print "TODO: %s" % name
print " %s" % description

def main():
event.manager += TodoPrinter()
todo = TodoList()
event.manager += todo

todo.add("Make coffee", "Really need to make some coffee")
todo.add("Bug triage", "Double-check that all known issues were addressed")

for value in manager:
print value

if __name__ == "__main__":
main()
</code>

This example is based on a similar example provided
by the Trac project (which was also to show of it's
Component architecture).

Thanks,

cheers
James

--
--
-- "Problems are solved by method"
Oct 2 '08 #10
On Wed, Oct 1, 2008 at 6:55 PM, Phillip B Oldham
<ph************@gmail.comwrote:
I've noticed that. I'm thinking more for a web environment (instead of
MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm
looking for alternatives.
Again with pymills, here's an alternative:

http://hg.shortcircuit.net.au/index....ellopymills.py

I have built 2 commercial web applications using my
pymills library and it's web server components (see
simple example above).

NB: I do not plan to write yet another framework :) but instead a set
of re-usable and flexible components.

cheers
James

--
--
-- "Problems are solved by method"
Oct 2 '08 #11
On Thu, Oct 2, 2008 at 2:09 AM, Bruno Desthuilliers
<br********************@websiteburo.invalidwrote :
"view" doesn't imply (x)html - any valid HTTP response is ok. The whole
point of decoupling controler from view (in web MVC) is to allow the same
controler to return different views.
There is an alternative to the MVC architecture, and that is to have a
set of Resources that are used by any User Interface, be on the Web,
Desktop or Console, as long as it understands HTTP (but it doesn't
have to restrict itself to the HTTP transport).

Normally the applications I build don't use your typical MVC model
or any MVC framework (as mentioned earlier, I've used pymills). I take
the CRUX/RESTful approach and build a set of resources for my
application and SaaS. Then I build a User Interface (normally I use ExtJS)j.

cheers
James

--
--
-- "Problems are solved by method"
Oct 2 '08 #12
On Oct 2, 1:32*am, "James Mills" <prolo...@shortcircuit.net.auwrote:
http://hg.shortcircuit.net.au/index....7498cd4c6a4/ex...
Thanks for the example, but its not loading.
Oct 2 '08 #13
On Oct 2, 1:28*am, "James Mills" <prolo...@shortcircuit.net.auwrote:
Phillip, I have been developing a rather unique
event-driven and component architecture library
for quite some time that is (not twisted). Actually
it's nothing like twisted, but based on 2 core
concepts:
** Everything is a Component
** Everything is an Event

It's currently called pymills.event
Let me know if you're interested, I probably
plan to re-package and re-branch this library
(the event library) at some point.
I'd be very interested in seeing this. Component-based programming is
something which interests me also.
Oct 2 '08 #14
On 10/2/08, Phillip B Oldham <ph************@gmail.comwrote:
On Oct 2, 1:28 am, "James Mills" <prolo...@shortcircuit.net.auwrote:
Phillip, I have been developing a rather unique
event-driven and component architecture library
for quite some time that is (not twisted). Actually
it's nothing like twisted, but based on 2 core
concepts:
* Everything is a Component
* Everything is an Event
>
It's currently called pymills.event
Let me know if you're interested, I probably
plan to re-package and re-branch this library
(the event library) at some point.


I'd be very interested in seeing this. Component-based programming is
something which interests me also.
Phillip, you can normally clone my library using
Mercurial by doing:

$ hg clone http://hg.shortcircuit.net.au/pymills/

If my VPS is still down, email me and I'll send you
a tar.bz2 (or something).

It may also interest you to know that I've ported
my library to py3k and so far all tests are working :)

Thanks,

cheers
James

--
--
-- "Problems are solved by method"
Oct 3 '08 #15
On 10/2/08, Phillip B Oldham <ph************@gmail.comwrote:
On Oct 2, 1:32 am, "James Mills" <prolo...@shortcircuit.net.auwrote:
http://hg.shortcircuit.net.au/index....7498cd4c6a4/ex...

Thanks for the example, but its not loading.
Sorry my VPS has been down for quite
some time today :/ Not happy!

Here is the sample:

<code>
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set sw=3 sts=3 ts=3

import optparse

from pymills import event
from pymills.event import manager
from pymills.net.sockets import TCPServer
from pymills.event.core import listener, Component
from pymills.net.http import HTTP, Response, Dispatcher
from pymills import __version__ as systemVersion

USAGE = "%prog [options] [path]"
VERSION = "%prog v" + systemVersion

###
### Functions
###

def parse_options():
"""parse_options() -opts, args

Parse any command-line options given returning both
the parsed options and arguments.
"""

parser = optparse.OptionParser(usage=USAGE, version=VERSION)

parser.add_option("-b", "--bind",
action="store", default="0.0.0.0:8000", dest="bind",
help="Bind to address:port")

opts, args = parser.parse_args()

return opts, args

###
### Components
###

class Test(Component):

channel = "/"

@listener("index")
def onINDEX(self, request, response):
self.send(Response(response), "response")

@listener("hello")
def onHello(self, request, response):

if request.cookie.get("seen", False):
response.body = "Seen you before!"
else:
response.body = "Hello World!"
response.cookie["seen"] = True

self.send(Response(response), "response")

@listener("test")
def onTEST(self, request, response):
response.body = "OK"
self.send(Response(response), "response")

class WebServer(TCPServer, HTTP): pass

###
### Main
###

def main():
opts, args = parse_options()

if ":" in opts.bind:
address, port = opts.bind.split(":")
port = int(port)
else:
address, port = opts.bind, 80

server = WebServer(port, address)
dispatcher = Dispatcher()

event.manager += server
event.manager += Test()
event.manager += dispatcher

while True:
try:
manager.flush()
server.poll()
except KeyboardInterrupt:
break

###
### Entry Point
###

if __name__ == "__main__":
main()
</code>

--
--
-- "Problems are solved by method"
Oct 3 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
3
by: Marcia Gulesian | last post by:
How can I capture the event when I click (focus) with the cursor anywhere in the page (that is, on a component or elsewhere). This event would occur in an I.E 5.5 or later browser.
6
by: rich_poppleton | last post by:
Help.... I've got a textarea where people type in a description. However for certain reasons we need to stop them typing !$*^ . I have a solution this which works fine in IE: function...
3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
5
by: Action | last post by:
does it works like ordinary virtual method?? coz I find that child class can't invoke the event of the parent class. class parent { public virtual event SomeDelegate SomeChanged; } class...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
15
by: prabhdeep | last post by:
Hi, Can somebody explain, why in following code, i get "event not defined" error funcTest(sMenu) { doument.getElementById('id1').addEventListener('mousedown', function(){ click(sMenu,...
7
by: Michael D. Ober | last post by:
Is there anyway to raise an event from a class and require that any program using that class (not just inheritance) have an event handler for specific events in the class? In my case, some events...
5
by: Richard Grant | last post by:
Hi, I need to "save" in a variable the event handler sub of a control's event, then perform some process, and finally "restore" the originally saved event handler. Example in pseudo-code: 1)...
0
by: Kamilche | last post by:
''' event.py An event manager using publish/subscribe, and weakrefs. Any function can publish any event without registering it first, and any object can register interest in any event, even...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.