[Distutils] pkg_resources get Distribution by module name
techtonik at gmail.com
Mon Jan 4 15:03:34 CET 2010
On Sun, Jan 3, 2010 at 10:28 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
>> If there any way to get Distribution information given the module name
>> like 'trac.admin.web_ui' in setuptools?
>> There is a problem to extract information about exact distribution
>> name and version when module is already imported in application (Trac
> I am not sure exactly what you are trying to do, but :
> If your trac plugin was done using entry points (as it says at
> http://trac.edgewall.org/wiki/TracDev/PluginDevelopment), this means
> that you can
> use the iter_entry_points API from pkg_resources: You will get a
> EntryPoint object that contains a dist attribute, pointing to the
> distribution infos.
Thanks. Already followed this way. Entrypoints is only one way to
discover plugins - they will work also if imported directly (there is
"plugins" folder in every user site setup). When plugin is imported,
everything we have is a name of its class, its module name and path to
I need to figure out if given module belongs to any setuptools
Distribution to know if it possible to extract any useful information
from it to display to user in administration panel.
More information about the Distutils-SIG