Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isort incorrectly moves __future__ imports above #! #545

Closed
rouge8 opened this issue Jun 1, 2017 · 1 comment
Closed

isort incorrectly moves __future__ imports above #! #545

rouge8 opened this issue Jun 1, 2017 · 1 comment
Labels
bug Something isn't working

Comments

@rouge8
Copy link
Contributor

rouge8 commented Jun 1, 2017

Given foo.py with incorrectly sorted imports:

#!/usr/bin/env python
from __future__ import print_function
import logging

print('hello')

The latest isort moves the __future__ import above the shebang

$ isort --version && isort --diff foo.py

/#######################################################################\

     `sMMy`
     .yyyy-                                                      `
    ##soos##                                                    ./o.
          `     ``..-..`         ``...`.``         `   ```` ``-ssso```
     .s:-y-   .+osssssso/.     ./ossss+:so+:`    :+o-`/osso:+sssssssso/
     .s::y-   osss+.``.``     -ssss+-.`-ossso`   ssssso/::..::+ssss:::.
     .s::y-   /ssss+//:-.`   `ssss+     `ssss+   sssso`       :ssss`
     .s::y-   `-/+oossssso/  `ssss/      sssso   ssss/        :ssss`
     .y-/y-       ````:ssss`  ossso.    :ssss:   ssss/        :ssss.
     `/so:`    `-//::/osss+   `+ssss+-/ossso:    /sso-        `osssso/.
       \/      `-/oooo++/-      .:/++:/++/-`      ..           `://++/.


         isort your Python imports for you so you don't have to

                            VERSION 4.2.9

\########################################################################/

--- /Users/andy/.virtualenvs/tmp-147c493166eebf46/foo.py:before	2017-06-01 08:34:24
+++ /Users/andy/.virtualenvs/tmp-147c493166eebf46/foo.py:after	2017-06-01 08:35:56.407646
@@ -1,5 +1,7 @@
+
+from __future__ import print_function
+
 #!/usr/bin/env python
-from __future__ import print_function
 import logging

 print('hello')
timothycrosley added a commit that referenced this issue Jun 1, 2017
@timothycrosley timothycrosley added the bug Something isn't working label Jun 1, 2017
@timothycrosley
Copy link
Member

Thanks for reporting this major issue!

I have pushed out a hotfix release: 4.2.11 that resolves it.

Thanks!

~Timothy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants