Python plugins, third round

Aaron Bentley aaron.bentley at utoronto.ca
Wed Jun 15 19:13:03 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lalo Martins wrote:
> So we both worry that this mad plugin loading may slow down bzr too
> much.  He wants to limit that by loading them on-demand, which would
> require a very strict naming convention or something like that.  I was
> more prone to simplifying the plugins so that they could load fast.

Actually, I'm not sure 'very strict naming convention' is a good
summary.  One of the alternatives I suggested was for plugins to declare
which modules they affected.

As for making plugins load fast, I'm not sure that's possible.  Plugins
must import any bzr modules they affect, so if you unconditionally
import a plugin that affects bzrlib.remote_branch (a popular example),
then you are unconditionally importing bzrlib.remote_branch.  And such a
module would probably also want to import bzrlib.branch, in order to
override bzrlib.branch.find_branch.

So one thing that causes plugins to load slowly is the fact that they
import other modules that might not otherwise be imported.

> 
> The idea
> ---------
> 
> Well, after years of working with Zope, I developed a deep appreciation
> for "explicit is better than implicit" and a strong distaste for
> software that depends on naming conventions to work right.  (Just in
> case someone plans to misunderstand me - these two are not related,
> they're two separate things that lead me to this idea.)
> 
> So I was thinking.  Why do we need to automagically search plugins at
> all?  I'd prefer the user to be personally aware of any and all plugins
> he is loaded.

I don't understand this argument.  How would plugins get in the user's
BZR_PLUGIN_PATH if the user didn't put them there?  If there's a config
file, I'd hope there's a command to add an entry for the plugin, and
another to remove it.  But what is the advantage of requiring an extra
command to install or remove a plugin?

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCsG+v0F+nu1YWqI0RAvOnAJ91ka3QJ58/8CUzozaL/i0l1fqZvACeKnyC
ruEtjhXgyB60QThSpA1Y64I=
=qClw
-----END PGP SIGNATURE-----




More information about the bazaar mailing list