6 ms·
Does ruff replace isort? Because I'm really unhappy with it, it doesn't work with tabs and conflicts with yapf all the time.
by gjulianm 4y ago
Does ruff replace isort? Because I'm really unhappy with it, it doesn't work with tabs and conflicts with yapf all the time.
- anderskaseorg 4y agoYes, as of last month. I’m not sure if it works with YAPF; it’s designed to work with Black and doesn’t currently have many of isort’s configuration options. Worth a try!
- gjulianm 4y agoThanks! The configuration options don't matter too much, I was really unhappy with the options isort gives.
- drcongo 4y ago> it doesn't work with tabs What do you mean by this? Are you indenting Python with tabs?
- makapuf 4y agoIf your import statements are indented, they must be in control statements (try/except or conditional imports, I fail to see why you would put those in a loop) thus they will be difficult to reorder if you import another module (with different name or stdlib status) on import error.
- drcongo 4y agoI'm not sure what you mean here, but package names can be indented without conditionals or tries, as in... from application.module.modules import ( Model1, Model2, Model3, Model4, Model5, Model6 ) iSort handles this fine if you're using spaces for indentation.
- gjulianm 4y agoYes. The code started as being indented by tabs, so changing it now is a mess. Also, not to start a flamewar, but I've always preferred tabs to spaces in any language, I find them more reliable, easier to use...
- drcongo 4y agoNot going to argue about your personal preference, but in Python spaces for indentation isn't just a personal preference - you'll run into a fair amount of issues with that, this one being just the tip of the iceberg.
- gjulianm 4y agoApart from isort not knowing how to deal with tabs, and changing the defaults "spaces" to "tabs" in the tools (along with line length too, because for some reason the 80 character limit is set in stone even though it's absolutely outdated) I haven't had many issues. And this has been running for years already.
- dontlaugh 4y agoNot necessarily. Consistently indenting with tabs and aligning with spaces does work, but is tricky to enforce.
- Stratoscope 4y agoThe key to success with tabs in any language is simple: Don't use alignment. Instead, only use indentation. It is interesting to note that Black-formatted code uses indentation only and never uses alignment. It would be perfectly compatible with tabs, unlike Google-formatted code which relies heavily on column alignment.
- captnswing 4y agoyes it does. see see https://github.com/charliermarsh/ruff#supported-rules https://github.com/charliermarsh/ruff#supported-rules for the rules it supports. "IOO1" being the code for isort relevant section from my pyproject.toml [tool.ruff] line-length = 88 # pyflakes, pycodestyle, isort select = ["F", "E", "W", "I001"]