request: make Organize Imports follow PEP 8
Brought to you by:
fabioz
It would be nice if Organize Imports split them into
groups like the PEP 8 ones:
system
3rd party site-packages
found on PYTHONPATH
src package
src current package
with bonus points for converting absolute imports to
relative imports.
Double bonus points for splitting import a,b into two
lines.
-- Chad
Logged In: YES
user_id=1582584
Just saw a presentation by Guido regarding the future of
Python. Relative imports are problematic and are going away
so you should really be converting relative imports to
absolute imports, not vice-versa.
Logged In: YES
user_id=617340
I agree... there should be an option to convert relative
imports to absolute imports automatically.
Logged In: YES
user_id=995731
Originator: NO
I was going to add a feature request for something similar (following suggestion from bug http://sourceforge.net/tracker/index.php?func=detail&aid=1683348&group_id=85796&atid=577329, but this is basically what I'm talking about (except for changing absolute imports to relative ones and vice versa (though I can see how some might find it useful)).
If it's hard to follow the PEP to the letter, maybe you can do it in this order:
(1) use the libraries found in "the builtins" section of the Python Interpreter preference pane as a proxy for "the system" imports
(2) Everything else is a 3rd party lib
(3) Follow up with all the src files that are imported from w/in the files specified in *the project's* PYTHON path (typically the python src folder).
And bonus points if you can separate each category above with a blank line for good measure ;-)
I have this working, also removal of unused imports - I expect to submit a patch this week or next