Automatically organize module imports

Andrew Durdin adurdin at gmail.com
Wed Oct 17 08:43:51 EDT 2007


On 10/15/07, Jean-Paul Calderone <exarkun at divmod.com> 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
deal.

Andrew.



More information about the Python-list mailing list