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

Francois Pinard pinard at iro.umontreal.ca
Sun Apr 27 18:46:34 EDT 2003


[Christopher Armstrong]

> The default sys.path isn't there, but your `mktap' is located in
> /usr/bin, isn't it? :-)

It is.  Twisted was installed using `root', and with --prefix=/usr.

> > > And inventing a new environment variable is contrary to the stated goal,
> > > which is the lack of a registration process [...]

> > Stated where?  The book does not clearly indicate (or I did not read that
> > part yet) where `.tml' files are exactly looked for.

> The "Writing Twisted Plugins" section, IIRC.

I have "3.3 - Writing a New Plug-In for Twisted", and I presume this is what
you are referring to.  I read that section many times, and once more before
sending the above question, and once more now.
The documentation says that:

   Twisted finds its plug-ins by using pre-existing Python concepts;
   the load path, and packages.  Every top-level Python package[4]
   [...] can potentailly contain some number of plug-ins.  [...] The only
   difference between a package and a drop-in is the existence of a file
   named `plugins.tml' [...] that contains some special Python expression
   to identify the location of sub-packages or modules which can be loaded.

This is the most precise description I could find.  Maybe there is a
linguistic barrier (I'm not an English speaker), but to me, this is a
bit generic.  It is not said that plug-ins _are_ `plugins.tml' files, nor
that those TML files are necessarily at the same place the plug-ins are,
(like next to `__init__.py', say), only their existence is asserted.

It is not so clearly stated either that this is a goal that TML files shall
never be themselves registered.  Maybe you could use my naive reading
as a hint that the documentation could be more precise on these points,
as other readers might have the same interpretation difficulties than me.

> > [...] Being receptive to feedback is a good way to keep it coming,
> > you know.

> Trolls like this aren't necessary.

Hopefully, you'll come to know be better, and discover that I never troll.
I am a peaceful and joyful man, and try to speak in all honesty, always.
Oh, I may tease in a friendly way, but then, there are smileys not far.

> If you have a suggestion for improvement [...] then I'll gladly hear
> it out.

For now, being a Twisted newcomer that knows very little about it, my
contributions may be timid for a good while.  I'm just sharing the mere
existence of problems I see with my naive eyes, despite I know that in
the area of free software, patches and precise suggestions are usually
quite welcome.  I hope acquiring a bit of competence, and become a better
contributor with the time passing.  Let me apologise for all the false
notes I may sing in the meantime.

> If you don't believe me, modify your local Twisted installation to add a
> `print sys.path' to twisted.scripts.mktap.

I'm quite willing to believe you, you know! :-)

> [...] /usr/bin is in your sys.path because that's probably where your
> `mktap' is located.

Is Twisted modifying `sys.path' to include the first part of argv[0]?
Or is it standard Python behaviour?  I never noticed this yet in my own
scripts, but it might just have escaped my attention, and I might not know.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Twisted-Python mailing list