[Twisted-Python] RPython and Twisted

Andrew Francis andrewfr_ice at yahoo.com
Wed Nov 5 09:11:41 EST 2008

Hi J.P:

AF>I wish to start experimenting by re-writing an example (the programme I AF>posted in RPtyhon and converting it to C.

Oops. I meant Stackless Python not RPython.

>Since the RPython/PyPy toolchain currently has better support for >generating standalone executables than for doing much else, I'd suggest >taking that approach.  Compile your RPython to a standalone executable, >run it from a Twisted-based process and do some simple RPC over stdio.
> It's a bit heavy handed, but I think it's the most straightforward >approach given the state of RPython. 

It is a good approach. Bear with me, I am still reading up but let me run this one by you: compile a RPython programme to C. Embed a Python interpreter running Twisted. Still heavy handed but I think that brings us closer to understanding integration issues (and getting something to work).

>There's probably nothing special about using RPython with Twisted -

Again, I am not sure - if the Twisted parts could not be converted, I believe the programme would run as a regular Python programme.

Then is the question of how difficult would it be to write Twisted in RPython? Would it be worth it? I suspect that the I/O would still be bottleneck.

>from the RPython perspective, Twisted is just another pile of Python >code that you need to figure out an integration strategy for. 

I don't know about this. I am reading the FAQ:

Can I use PyPy and RPython to compile smaller parts of my Python program?

No. That would be possible, and we played with early attempts in that direction, but there are many delicate issues: for example, how the compiled and the non-compiled parts exchange data. Supporting this in a nice way would be a lot of work.

J.P thanks for the suggestion. I guess it is time to write some tests :-)



More information about the Twisted-Python mailing list