+3  A: 

Snakefood

sfood -fuq package.py | sfood-target-files 

will list the dependencies.

`-f` tells sfood to follow dependencies recursively
`-u` tells sfood to ignore unused imports
`-q` tells sfood to be quiet about debugging information

To filter out modules from the standard library, you could use

sfood -fuq package.py | sfood-filter-stdlib | sfood-target-files 

As you've already noted, if there are other directories you'd like ignored, you can also use the sfood -I flag.

unutbu
looks reasonable, +1. sfoodxx -I /Library/...python2.6 (mac) doesn't filter out standard imports sys, os.path etc. ?
Denis
@Denis: Use `sfood-filter-stdlib` to remove entries from the Python standard library. I'll edit my answer to include this...
unutbu
sfood-filter-stdlib has '/usr/lib/python' hardwired in,and doesn't work for sfood-imports.Am asking the author ...Bytheway Kevin Teague, "I want a pony" http://groups.google.com/group/django-developers/msg/5407cdb400157259is an outstanding overview of packaging methods in 2008.)
Denis
@Denis: Thanks; that's a great link.
unutbu
+2  A: 

modulefinder from the standard lib

New in version 2.3.

This module provides a ModuleFinder class that can be used to determine the set of modules imported by a script. modulefinder.py can also be run as a script, giving the filename of a Python script as its argument, after which a report of the imported modules will be printed.

I am not sure if it complies with your requierement about not loading the modules. From here:

modulefinder use bytecode inspection to find dependencies, and therefore is free from any side-effects that may be caused by importing the modules being studied.

Other hints about the use of pylint or Gui2exe here

joaquin