This tries to implement some of the rule of import sorting as requested in #13 using custom logic, This was originally fixed in #263 using isort, but reverted and re-requested as of #287
Current this has the following limitations/bugs that will need to be sorted out, but might need fixes to Pyflyby master branch first.
This can be tried with the --experimental-sort-imports
[ ] A) I believe we want from __future__ import ..., to always be followed by a blank line, it is currently not the case if the next lexicographic import is a single import.
[ ] B) from __future__ import ... is not always inserted before the first blank lines in the file,
[x] C) blank lines are often inserted before comments
[ ] D) It also looks like the inserted from __future__ import... do not get the same treatment with respect to aligning with space, but it's unclear wether this is a bug (and it can be solved separately).
C, (and likely B), is I think a bug in Pyflyby parsing where new lines are part of the next statement (especially if it is a comment) instead of being part of the previous one – or being their own statement. It might affect strings literal as well (to check). See #328
From what I can tell this may change API, so I want to be careful fixing this.
This tries to implement some of the rule of import sorting as requested in #13 using custom logic, This was originally fixed in #263 using isort, but reverted and re-requested as of #287
Current this has the following limitations/bugs that will need to be sorted out, but might need fixes to Pyflyby master branch first.
This can be tried with the
--experimental-sort-imports
from __future__ import ...
, to always be followed by a blank line, it is currently not the case if the next lexicographic import is a single import.from __future__ import ...
is not always inserted before the first blank lines in the file,from __future__ import...
do not get the same treatment with respect to aligning with space, but it's unclear wether this is a bug (and it can be solved separately).C, (and likely B), is I think a bug in Pyflyby parsing where new lines are part of the next statement (especially if it is a comment) instead of being part of the previous one – or being their own statement. It might affect strings literal as well (to check). See #328
From what I can tell this may change API, so I want to be careful fixing this.