[PATCH] better python plugins (well, better IMHO)

John Arbash Meinel john at arbash-meinel.com
Sun Jun 12 16:48:55 BST 2005


Lalo Martins wrote:

> This patch does plug-ins in a different way.
>
> I think it's a mistake to assume plug-ins are going to be used
> exclusively for adding commands.  We're doing things quite modularly, so
> I think it's reasonable to trust on plugins to implement branch storages
> (when/if we have them) and exporters (as per my previous patch), and
> other things in the future.  Otherwise we'll end up with a half dozen
> "BZR*PATH" variables and a lot of lookups; the added complexity is not
> really welcome.  One plugin system to rule them all and in the namespace
> bind them.
>
> So I decoupled plugins from commands.  Plugins are now loaded on bzrlib
> initialization, and they're free to register whatever components they
> like.  On the other hand they have to do so manually.  (Explicit is
> better than implicit).  John's code to register a command from a plugin
> was moved to an utility function.

Seems good to me. Actually, looking over your code, I think it is quite
a bit better than mine. I didn't remember the "imp" module.
I also agree that plugins should be loaded all the time, not just when a
command is requested.
But we probably also need a way to *disable* loading all plugins. The
idea was the "bzr builtin" command. I'm not sure that is the best
method. And I realize you can do "BZR_PLUGIN_PATH='' bzr status"
But that seems a little weird.

>
> A few issues:
>
> - John's code has a comment stating subdirectories from the plugin path
> will be searched one level down; but there was nothing on his code that
> implemented this.  I didn't add the feature; personally I think it's
> silly and will slow down startup.  If you want your plugins in revision
> control, either symlink them into somewhere in the plugin path, or put
> the source tree in the path - it's a path after all, not a single dir.

That was in the original version, but I took it out in hopes of getting
it merged. I just forgot to clean up the comments as well.

>
> - I renamed the environment variable from BZRPLUGINPATH to
> BZR_PLUGIN_PATH which seems to be more like the unix standards.  The
> (seemingly completely gratuitous) incompatibility is due to the fact
> that any plug-ins written for John's code won't work with this version -
> they will be loaded, but not register anything.  So I think it's worth
> breaking them, so that you have to move them manually and then fix them.
>   Feel free to undo this part :-) it's a single-line change.

I agree that BZR_PLUGIN_PATH is better, but that hasn't been the
tradition so far. There was BZRPATH and BZREMAIL. I would certainly
prefer with the underscores.

>
> best,
>                                                 Lalo Martins

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050612/8fbcd8f6/attachment.pgp 


More information about the bazaar mailing list