You are not logged in Log in Join
You are here: Home » Members » Martijn Faassen's Page » importchecker » README.txt » View Document

Log in
Name

Password

 

README.txt

What is it?
===========

importchecker is a script/module that can determine unused imports in
a Python source tree or package. If run as a script, it will return a
sorted list of paths to modules that have unused imports. At the end
of each line is a list of the names that are imported but not used.

How to use it?
==============

python importchecker.py /path/to/check

where /path/to/check contains python modules. If this is contains many modules,
be prepared to wait a while as importchecker churns through all of them.

importchecker requires python2.2 and up, as it needs the compiler package.

Details
=======

importchecker is smart enough to detect the following case:

module a: defines foo
module b: from a import foo, foo is not used
module c: from b import foo, foo is used

In this case, while foo is not directly used by module b, it is imported by
module c. This detection of course only works if module c is actually
scanned by importchecker.