2008-08-17

Wrote a tool to detect dead imports

Christian Heimes recently pointed out some imports that were extraneous or could be changed such that Python's startup could be faster. So, to take a break from working on my thesis proposal and b3 stuff, I wrote a script that analyzed the AST for some source code and tried to deduce which imports were dead.

Interesting thing was that it not only found dead imports (usually something minor like importing 'warnings' that is usually transient anyway), but also missing entries in __all__. Once again, nothing major.

Anyway, if anyone actually wants the code just let me know. Looks like it won't go into Tools since pretty much everyone has said that some other tool does the same thing (pyflakes, pychecker, or pylint, something in Zope).