Finding Module Dependancies

Larry Bates larry.bates at websafe.com
Fri Apr 21 19:52:44 EDT 2006


mwt wrote:
> When I'm rewriting code (cutting and pasting pieces from earlier
> modules), is there a quick way to determine if I have imported all the
> necessary modules? I am used to working in Java, where the compiler
> will tell you if you haven't imported everything, and also Eclipse,
> which has the handy "organize imports" feature. This is not the case in
> Python, since it's not compiled, of course, and also running it might
> not insure you've got all the imports, unless you go through every
> possible usage scenario -- which in some cases is quite a few, and
> could take a long time.
> 
> So what I'm looking for is a command, like "check dependencies" or
> something, which will list all the modules needed for a source module
> to run.
> 
If you are an accomplished Eclipse user (I'm not), you should look at
the Python plug-in for Eclipse.

Remember that Python is so dynamic that you can build dependencies
during program execution and import them on-the-fly.  So a dependency
checker would always be incomplete.  You always need to write unit
tests.

-Larry Bates



More information about the Python-list mailing list