How can I check for unused import in many Python files?

Posted by Thierry Lam on Stack Overflow See other posts from Stack Overflow or by Thierry Lam
Published on 2010-03-29T18:12:06Z Indexed on 2010/03/29 18:13 UTC
Read the original article Hit count: 158

Filed under:

I remember when I was developing in C++ or Java, the compiler usually complains for unused methods, functions or imports. In my Django project, I have a bunch of Python files which have gone through a number of iterations. Some of those files have a few lines of import statement at the top of the page and some of those imports are not used anymore. Is there a way to locate those unused imports besides eyeballing each one of them in each file?

All my imports are explicit, I don't usually write from blah import *

© Stack Overflow or respective owner

Related posts about python