January 19, 2009 – 12:56 am
I was playing these days with greenlets and I finally managed to find some time to make and coroutine implementation for cogen that uses the seamless stack switching of greenlets instead of the usual generator yield-based switching.
The best part about this is that cogen could support any sort of old code that uses the usual [...]
November 29, 2008 – 1:45 am
I’ve finally mannaged to pull off a set of wrappers for using the raw windows iocp api using ctypes, namely wrappers for GetQueuedCompletionStatus, WSARecv, WSASend, AcceptEx, ConnectEx, TransmitFile and the whatever structs and utility calls they need.
Writing the wrappers wasn’t that hard – but if you aren’t careful with ctypes you are in a world [...]
September 15, 2008 – 8:03 am
The major refactor of the socket stuff is finally in the trunk. The Socket is more in line with the standard socket module in python (there’s a makefile and a _fileobject for readline just like the standard library). And it looks like performance is still pretty good.
The only things I can think of right now [...]
Well, not exactly a rewrite, merely a major internal refactor.
The thought of cleaning up the socket and reactor internals really nags me. I would move the platform dependant code from the sockets module in the reactors – so, say, the reactors would have the platform specific code for recv, send, connect, accept instead of each [...]
There is something very cool about wsgi: asynchronicity at it’s core ! The spec was made with this in mind – I absolutely love wsgi.
I’ve been playing recently with pylons and i’ve made a example chat app – just a proof-of-concept comet application with long pooling in a pylons app using a custom wsgi server [...]
April 20, 2008 – 11:06 am
I’ve implemented a reactor to integrate the cogen loop in the qt main loop.
You whould use it like this:
from PyQt4 import QtGui
app = QtGui.QApplication([])
hello = QtGui.QPushButton( "Hello world!" )
hello.resize(100, 30)
hello.show()
from cogen.core import reactors, schedulers
m = schedulers.Scheduler(reactor=reactors.QtReactor)
def lorem_ipsum_app(environ, start_response):
start_response(‘200 OK’, [('Content-type','text/plain'), ('Content-Length','19')])
return ['Lorem ipsum dolor..']
server = wsgi.WSGIServer(
[...]
Just so you know, cogen is a coroutine framework (based on the bidirectional generators from python 2.5) that has a wsgi server with some async extensions.
Straight to the point, i’m going to show the basics by building the backend of a web based (with comet-style ajax) irc client. This is a proof of concept and [...]
March 27, 2008 – 12:53 pm
Ok, introductory stuff: before python 2.5 generators were just a unidirectional computation structure. That means one could get values out of the generator. In python 2.5 we have the enhancements from PEP 342: Coroutines via Enhanced Generators – generators have 3 extra methods: sent, throw and close and the yield statement is a expression now. [...]