[Distutils] setuptools: Plugins

Phillip J. Eby pje at telecommunity.com
Mon Aug 22 20:48:53 CEST 2005


At 01:29 PM 8/22/2005 -0500, Ian Bicking wrote:
>I'm looking for some advice on using setuptools/eggs/entry_points for
>plugins.  Specifically, how do I find distributions tht provide the
>entry points I'm interested in?  For instance, can I find all the
>distributions that provide "paste.script_command" entry points?  Or does
>there need to be some way for these distributions to tell my package
>they exist?

def distributions_with_commands(ws=pkg_resources.working_set):
     for dist in ws:
         if dist.get_entry_map('paste.script_command'):
             yield dist


Distribution.get_entry_map() returns a dictionary mapping entry point names 
to EntryPoint objects, so this code yields the distributions on sys.path 
(by default) that contain any entry points in the 'paste.script_command' group.

Complete documentation on the entry point API can be found at:

http://peak.telecommunity.com/DevCenter/PkgResources#entry-points



More information about the Distutils-SIG mailing list