[Twisted-Python] manhole

Chris Armstrong carmstro at twistedmatrix.com
Thu Aug 9 17:34:35 MDT 2001


Glyph and I have talked about editing code from within manhole before.
I'm not sure if he agrees with the following ideas, but they're related.

I think it'd be really cool if we somehow kept a source representation of
*all* of Twisted for dynamic editing at runtime (sounds cool, eh?).. Of
course, this is probably far off, but here's a list of things that need to
be done to accomplish this ridiculous goal.

* At startup, read all of the source code from the .py files into an
internal datastructure somewhere

* whenever someone hacks new code from within manhole (or the telnet server
(blech)), we save this too. (I actually had this idea in another context,
when I wished for a special python interactive interpreter which would
remember what I typed to save the code to modules later).

* when we shut down the process, we must save all of this source code into
the pickle as well.

* offer a "source" functionality like reality's 'source' command to write
out all changes to the source we've made.

Yeah, I know, this seems really disgusting and memory-hogging, but it
shouldn't be that bad. Actually, now that I think of it, this could be
optimized some. Like, only actually retrieving source code when it's called
for (that's probably the biggest optimization we can do). 

Now, this whole source code editing thing brings up more issues, like what
do we edit source code with. Manhole is ok for some hacks, but it is of this
hacker's opinion that we just call up external editors from the twisted
process and pass it a temp file with a chunk of code in it. (glyph: "eggs"?)

Another issue this brings up is the "stability of modifying a running
process". I'd imagine only real twisted hackers would be screwing with the
deep internals at runtime, but for regular "end-users" (hah), they'll
probably stay close to the "edges" (very high level code). 

Now, this whole idea can really lead on into some crazy stuff.. Like, say,
version controlling these "eggs" from *within* Twisted itself.. 

Thank you for listening to my crazy ramblings,
-- 
Chris Armstrong                        carmstro at twistedmatrix.com
http://twistedmatrix.com/~carmstro     carmstro at dynup.net





More information about the Twisted-Python mailing list