|
From: Abraham S. <ab...@cn...> - 2004-08-22 04:11:49
|
Fernando Perez wrote:
>
>
> 1. I think plugin support is a fantastic idea, but I hope it can be
> made user-extensible in local paths. I recently modified mayavi
> (available in current CVS) precisely in this manner, and I think it's
> a very useful thing. In lab settings where users are not allowed to
> write to system directories, it becomes very important that they can
> add their own plugins in local paths. This also allows you to keep
> your personal extensions alive as matplotlib versions are upgraded,
> since your directories are untouched.
>
> What I did for mayavi was to add a search-path option to mayavi, made
> of colon-separated dirs with ~user/$VAR support. Any such dir gets
> added to mayavi's search path for user-defined filters and modules
> (the equivalent of plugins), and you can load a user module just like
> you can load a builtin:
>
> load_module('Glyphs') -> loads mayavi's Glyphs module
> load_module('User.Glyphs') -> loads a user-defined Glyphs module from
> the search path.
>
> I think it's important that it's a _path_ and not a single directory,
> because this allows a research group to maintain shared extensions
> suited for their purposes, and individual users to add personal
> modifications which don't fit group projects.
I completely agree. I recently changed the code to allow a path to be
specified (':' deliminated). I hadn't thought of allowing '$VAR' syntax
.. something to think about. However, if people have a .matplotlibrc
file in their home directory, it should make it so people aren't mucking
up things with the plugins.. I'll have to check the behavior of
find_module to see what it does with '~' and such.
I like the idea of 'load_module'. Currently all the plugins in the
directories are loaded automatically. There is a certain nicety, though,
to automatically having it load all the plugins found in a particular
directory. Less cumbersome for most users.
Abe
|