[Distutils] API for finding plugins

Ian Bicking ianb at colorstudy.com
Wed Feb 8 04:40:13 CET 2006


Phillip J. Eby wrote:
> At 12:43 PM 2/7/2006 -0600, Ian Bicking wrote:
> 
>> I guess the problem is that for Paste Script, the startup overhead and 
>> the runtime overhead are the same thing.  Like, 8 seconds to complete 
>> "paster help" (which gives a listing of all available commands).  
>> After the first run it warms up and is much faster (disk caching?), 
>> but that still doesn't feel good to me.  Now that it's warmed up I 
>> can't tell how slow a normal command would be -- possible faster, 
>> since "help" necessarily looks at all packages.
> 
> 
> I'm assuming here that the problem is needing to import each command to 
> get its description and display it?

Oh, yes, that too ;)  That probably is the bigger problem, and 
inevitable.  That doesn't happen except with help.  So maybe I am 
worried about nothing.


>>>> I also want content plugins, like the internationalization plugins 
>>>> (but it might be Javascript or templates or whatever).  And 
>>>> certainly that applies to TG as well.  I've been doing this at work, 
>>>> but using entry points, where the entry points points to an object 
>>>> that is a string that points to a resource that is then fetched with 
>>>> pkg_resources.  Something more direct would be appreciated ;)
>>>
>>>
>>> Um, you do realize that this is *exactly* what I was campaigning for 
>>> on the Web-SIG when I said, "we need a resource deployment standard", 
>>> don't you?  :)
>>
>>
>> Yes, and I completely agreed with you!
> 
> 
> Um, suuuure you did, Mr. "Objections only on the Spec and not the 
> Scope".  ;-)

Yes, and now we can start a separate spec.  Mmm... yummy specs.  OK, 
that's not actually my reaction at all to discussing specs, but I still 
think it is easier in smaller chunks.

> I'm not aware of any existing standards, either, but I'm thinking that 
> what's needed is more of an API for resource retrieval keyed on some set 
> of simple values or wildcards, with some way to aggregate search results 
> from multiple sources (so that e.g. databases, eggs, and directory 
> trees) can all "offer" resources on demand.
> 
> I'm thinking that you would call this API (at the low level) via 
> something like:
> 
>      my_page_source = resource_set.find_resource(
>          resource=['my_page'], for_project=['MyProject'],
>          locale=['en','de'], layer=['some_layer', 'other_layer'],
>      ).as_string()

Are the arguments arbitrary?  I.e., can I add my own?  Like 
domain=['blog.ianbicking.org', 'ianbicking.org'], or user=['ianb', None]?

Are resources typed in any way?  Similar to entry point groups...?

> Of course, this would in most cases be wrapped by some higher-level API 
> that eliminates most of the parameters from needing to be specified 
> (e.g. by a framework that knows what locales and skin layers are in 
> effect and what project the requesting code is calling from).  For 
> performance, you could extract subset resource sets and use them instead 
> of querying a top-level resource set.

I often find myself wanting to just override one little bit.  Subset 
resources would potentially break that, unless they are a subset that is 
resolved all at once instead of a subset that has to provide all the 
necessary resources.  At least if you are describing what I think you 
are describing.



-- 
Ian Bicking  |  ianb at colorstudy.com  |  http://blog.ianbicking.org


More information about the Distutils-SIG mailing list