[Twisted-Python] Re: Twisted 1.0.4 - Heavy search for `plugins.tml'

Christopher Armstrong radix at twistedmatrix.com
Sun Apr 27 13:14:35 EDT 2003

On 2003.04.27 12:50, Francois Pinard wrote:
> It still looks like Twisted is going overboard with this.  If `plugins.tml'
> files were being collected from the top-level directories along `sys.path'
> and maybe no more than one-level below, and maybe also for test purposes
> (despite the security weakness), into the current directory and one
> level of directories below, it would probably make a lot of sense at a
> reasonable cost.

That's exactly what it's documented to do. If it's not doing that, it's a bug.
(btw, the current directory gets no special treatment. If it's searching
the current directory, it's because the current directory is somehow in 

> But trying every single executable along the shell load path as if the
> executable were a directory (yet I understand it would be slower to first
> check if it is a directory) is heavy and unlikely to be any fruitful -- at
> least in my naive eyes.  It might be worth some revisiting, who knows...
> If you really want full generality, it might be more sane and useful to
> invent some TWISTED_SEARCH_PATH environment variable, than to go berzerk
> and frantically search everything in the wild. :-)

It's not using the shell load path. /usr/bin just happens to be in your
sys.path. And, I'm guessing that explicitly checking 1) whether or not
each item is a directory and 2) whether or not that directory has an 
__init__.py is, as you said, more expensive (and checking for __init__.py
is actually trickier than it seems at first, because you also need to
check for .pyc, .pyo, .pyd, .so....).

And inventing a new environment variable is contrary to the stated goal,
which is the lack of a registration process (apart from what you need to do
to have your package work with Python).

Now, are you actually having a *problem* with the performance of mktap?

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

More information about the Twisted-Python mailing list