[Distutils] Finding modules in an egg / distribution

PJ Eby pje at telecommunity.com
Tue Jul 2 17:08:13 CEST 2013


On Tue, Jul 2, 2013 at 6:59 AM, Iwan Vosloo <iwan at reahl.org> wrote:
> Hi there,
>
> We have been struggling to find a nice way to list all the modules (or
> packages) that are part of a particular Distribution (or egg). Nice should
> also mean that it works when the egg is installed. We have a need to do some
> introspection on the code shipped as an egg.
>
> Any ideas?

If you are targeting at least Python 2.5, see:

http://docs.python.org/2/library/pkgutil.html#pkgutil.walk_packages


More information about the Distutils-SIG mailing list