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

Updated to *isort 5.9.3* #2

Closed
wants to merge 7 commits into from
Closed

Conversation

stevenxxiu
Copy link

@stevenxxiu stevenxxiu commented Sep 28, 2021

This updates to the latest isort 5.9.3. There are many changes in isort that make this worthwhile.

I updated the API as well.

isort's own internal imports conflict with the name of this package. I don't really see ways around this.

I think you will need to rename this package, perhaps to Sublime Isort.

… compatible with older versions of *Sublime Text* that have *Python 3.3*
@narendramukherjee
Copy link

@stevenxxiu Have you gotten any response from the current repo managers on this PR? Very useful improvement indeed, I am hoping this could be merged!
In the meantime, if one wanted to use your updated version, would you suggest using the version on your fork?

@stevenxxiu
Copy link
Author

Thanks. I haven't got any response yet, as you can see here.

Yes I've been using this for some time and it works fine for me. You can report back any issues here.

Note that as stated in a commit, this requires Sublime Text 4, as isort 5.9.3 isn't compatible with Sublime Text's Python 3.3.

@narendramukherjee
Copy link

Thanks @stevenxxiu - I am wondering how exactly I should go about swapping the old isort with your new sublime-isort version? Here's what I have done (on my Ubuntu system), but was unsuccessful in getting it to work (I'm sure I am missing something stupid on my side):

  1. Updated to ST4.
  2. Located the old isort in sublime's packages - in Linux, this sits in .config/sublime-text/packages/isort
  3. Replaced the contents of .config/sublime-text/packages/isort with the contents of your fork of the repo.

I have been using the following settings with the old isort in .sublime-project till now:

    "settings":
    {
        "isort.sort_on_save": true,
        "isort":
        {
            "multi_line_output": 3,
            "include_trailing_comma": true,
            "force_grid_wrap": 0,
            "use_parentheses": true,
            "ensure_newline_before_comments": true,
            "line_length": 120,
            "lines_between_types": 1,
        },
    },

Let me know your thoughts on this, and thanks in advance for your help!

@stevenxxiu
Copy link
Author

stevenxxiu commented Oct 27, 2021

Try to change the name of the package folder first, as I mentioned in this PR.

That's important in order to avoid an import conflict.

Rename the folder to say SublimeIsort.

@narendramukherjee
Copy link

I see, but calling it in .sublime-project should remain the same? As in still use the same settings that I pasted in my comment? Or should the new name be reflected there as well?

@stevenxxiu
Copy link
Author

Well that should be fine. Test it out and see if your options work.

@narendramukherjee
Copy link

Hmm, that doesn't seem to work unfortunately :( If it is ok with you, will you be able to share the way you use isort in your sublime project with me? Then I can probably extrapolate to see what works in my situation.

Also, the settings to be used with isort in the old version were defined here: https://github.com/asfaltboy/sublime-text-isort-plugin/blob/master/isort/main.py#L175 . Is there something equivalent in the new code (if yes, could you point me to it) or does the new code just follow the command line arguments for isort 5.9.3?

@stevenxxiu
Copy link
Author

I have in my project folder an .editorconfig file:

root = true

[*.py]
# *isort*
multi_line_output = 5
order_by_type = true

You need to restart Sublime Text upon updating this.

Copy link
Owner

@asfaltboy asfaltboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for replying late, I have missed it in my GitHub notifications (I have just seen it now because @nk9 emailed me).

Thanks for contributing a PR, I've got a few questions about it:

  • Version 5.9.3 on PyPi does not support python 3.3; though, I don't know for certain whether isort is (or it's deps are) backward compatible with 3.3. Has anyone tested this branch on ST3 to see if it still works?
  • Could you kindly clarify what you mean by?:

I think you will need to rename this package, perhaps to Sublime Isort.

Note: I have been using the plugin myself in ST4 without any particular problems. I think because Sublime loads it with its python 3.3 compatibility layer on startup:

reloading python 3.3 plugin isort.argparse
reloading python 3.3 plugin isort.isort_file

Perhaps we could ship this change for ST4 only, under a sub-dir?

@@ -0,0 +1,8 @@
# Default ignored files
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the .idea folder committed to git.

For easier exclusion, you may want to ignore the .idea folder in your global .gitignore

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I can do that, if we get the other problems solved. I just thought this was abandoned, so that's why I commited my .idea/ folders.

Globally though this is useful to me.

@stevenxxiu
Copy link
Author

I don't know for certain whether isort is (or it's deps are) backward compatible with 3.3.

isort · PyPI says it requires Python 3.6+. I did run it with Python 3.3 once, and it didn't work at all. This is why I added the .python-version file.

Perhaps we could ship this change for ST4 only, under a sub-dir?

Sublime Text 4 is required due to the Python version requirement above, so it makes more sense to just break incompatability with Sublime Text 3. Sublime Text 3 users can use the old version.

Note: I have been using the plugin myself in ST4 without any particular problems.

Is this for my branch? I had import conflicts and wasn't able to get it to work.

@nk9
Copy link

nk9 commented Mar 28, 2022

Would love to be using this on ST4. Is anything preventing this PR from being accepted at this point?

@asfaltboy
Copy link
Owner

asfaltboy commented Apr 1, 2022

I'm keen on not braking things for current users. How about we tag the st3- version, then update the repo with a compatibility mapping, as described in package_control release docs?

If we can agree on a release strategy (and clean up anything not relating to isort in the PR changes), then I don't see any reason not to merge this.

@stevenxxiu
Copy link
Author

I'm keen on not braking things for current users. How about we tag the st3- version, then update the repo with a compatibility mapping, as described in package_control release docs?

I'm guessing that file isn't in this repository?

I moved this PR to #3, so it excludes the PyCharm files.

Lets discuss it there.

@stevenxxiu stevenxxiu closed this Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants