Monday, March 22, 2004

Two days of PyCon sprinting

Woo PyCon wooooooooooooooooooooooooooo!

Saturday and Sunday was spent hacking on several interesting things, including some cleanup of Twisted's treatment of addresses, a few minor boring error handling edge-case fixes, and most importantly IMAGINATION!

We finished porting the NewReality parser to Imagination's object relation system. We finished porting the NewReality action system to Imagination's object relation system. Sweet, sweet tests for both. Telnet wiring and imagination.tac code updated so a server can actually be started and logged into. radix, dash, glyph and I all worked on this to varying degrees. dash's plans are to start porting some of the old concepts to the new system. I think I am going to continue hacking on some tests and then try and get some movement actions working.

And we still have two full days of sprinting!

Friday, March 5, 2004

Twisted "chat server" in one expression

Tonight's messed up code:

(lambda r,p,b: (r.listenTCP(6665,(type('F',(p.Factory,object),{'protocol':(type('P',(b.LineReceiver,object),{'connectionMade':lambda s:s.factory.c.append(s),'lineReceived':lambda s,m:(s.factory.m(m),None)[1]})),'c':[],'m':lambda s,m:[c.sendLine(m)for c in s.c]}))()),*(lambda p,i:(i(p,'reactor'),i(p,'protocol'),i('twisted.protocols.','basic')))('twisted.internet.',lambda a,b:__import__(a+b,None,None,b)))

Wednesday, March 3, 2004

Good Night

Demonstration of success:

exarkun@boson:~$ telnet localhost 56197
Trying ::1...
Connected to localhost.
Escape character is '^]'.

Twisted 1.2.0
username: admin
password: *****
>>> import os
>>> os
<module 'os' from '/usr/lib/python2.3/os.pyc'>
>>> os.getpid()
>>> os
<module 'os' from '/usr/lib/python2.2/os.pyc'>
>>> os.getpid()
>>> Connection closed by foreign host.

Interpretation is left as an exercise for the reader. Suffice it to say that all the dirty hacks in the server melted away tonight, and the transition from supporting only listening ports to supporting connected protocol instances was almost effortless. The interpreter version change was a last minute afterthought that I was happily surprised to see actually work.