[Zope3-Users] Utility for removing unneeded import statements

Adam Groszer adamg at fw.hu
Tue Jun 5 06:59:32 EDT 2007


Hello Hermann,

Z3 has an importchecker:

"""Import checker

This utility finds unused imports in Python modules.  Its output is
grep-like and thus emacs-friendly.
...

Althought pyflakes works for me better.
http://www.divmod.org/projects/pyflakes

Tuesday, June 5, 2007, 12:50:40 PM, you wrote:

> Hi,
> During development and especially refactoring, I'm often confronted with
> cleaning up import statements.

> Missing imports are reported by Python, however, unneeded imports are not. I
> don't know if unneded imports are a performance issue, nevertheless it
> probably makes sense to clean them up from time to time.

> Therefore I wonder if there's some tool that can automatically check if an
> import is needed or not. Probably this is easy to write, but perhaps somebody
> has already done so?

> What would be nice, would also be a tool that crawls through a python package
> and also checks any missing imports and reports all of them at once. When I
> refactor code, I often have to restart zope3 over and over, only due to
> missing import statements.

> Best Regards,
> Hermann



-- 
Best regards,
 Adam                            mailto:adamg at fw.hu
--
Quote of the day:
Everything comes to him who waits, among other things, death.  -  Francis Bradley



More information about the Zope3-users mailing list