Automatically organize module imports

Andrew Durdin adurdin at
Wed Oct 17 14:43:51 CEST 2007

On 10/15/07, Jean-Paul Calderone <exarkun at> wrote:
> Pyflakes will tell you which imports aren't being used (among other
> things).  I don't know if an existing tool which will automatically
> rewrite your source, though.

I'll second that recommendation of Pyflakes -- as the interpreter only
lets you know about undefined names when the code is executed, I find
Pyflakes really useful at finding missing imports (or other undefined
names) as soon as possible.

As I'm doing a lot of work with Django at the moment, which requires
some configuration of the environment to run, the fact that Pyflakes
reads the source without trying to execute any of it helps a great


More information about the Python-list mailing list